Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ __history/
# RAD Studio user settings
*.dproj.local
*.cbproj.local
Compile

# Deployment files
*.deployproj
Expand Down
21 changes: 19 additions & 2 deletions src/MainUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "EventSubscriptions.h"
#include "Roles.h"
#include "CommonCommands.h"
#include "TConstants.h"
#include "CommonPictures.h"
#include "CommandGroups.h"
#include "CommonForms.h"
Expand Down Expand Up @@ -1556,6 +1557,19 @@ void __fastcall TMainForm::FillVirtualTree() {
{
FillTreeMD(parentNode, MainForm->mdCalculationRegisters, md_CalculationRegisters, category.imgIndex);
}
else if (category.name == md_Constants)
{
// Константы
for (int i = 0; i < MainForm->mdConstants->Count; i++)
{
PVirtualNode childNodeConst = VirtualStringTreeValue1C->AddChild(parentNode);
VirtualTreeData *childDataConst = (VirtualTreeData*)VirtualStringTreeValue1C->GetNodeData(childNodeConst);
TConstants* CurConstant = static_cast<TConstants*>(MainForm->mdConstants->Items[i]);
childDataConst->Name = CurConstant->name;
childDataConst->Age = 30;
childDataConst->ImgIndex = category.imgIndex;
}
}
else if (category.name == md_InformationRegisters)
{
FillTreeMD(parentNode, MainForm->mdInformationRegisters, md_InformationRegisters, category.imgIndex);
Expand Down Expand Up @@ -2996,7 +3010,10 @@ void fill_md(tree* tr, String guid_md, std::vector<String> &md_list)
else if (guid_md == GUID_WSReferences)
{}
else if (guid_md == GUID_Constants)
{}
{
TConstants* CurConstant = new TConstants(cf, curNode->get_value(), val);
MainForm->mdConstants->Add(CurConstant);
}
else if (guid_md == GUID_Documents)
{
TDocuments* CurDocuments = new TDocuments(cf, curNode->get_value(), val);
Expand Down Expand Up @@ -3183,7 +3200,7 @@ void get_cf_name(tree* tr, Messager* mess)

// константы
fill_md(tr, GUID_Constants, MainForm->Constants);
mess->AddMessage(L"Константы обработаны", MessageState::msInfo);
mess->AddMessage(L"Константы обработаны: " + IntToStr((int)MainForm->Constants.size()), MessageState::msInfo);

// обработки
fill_md(tr, GUID_DataProcessors, MainForm->DataProcessors);
Expand Down
7 changes: 7 additions & 0 deletions src/MetaDataManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "Bots.h"
#include "CommonAttributes.h"
#include "CommonCommands.h"
#include "TConstants.h"
#include "CommandGroups.h"
#include "CommonTemplates.h"
#include "ExchangePlans.h"
Expand Down Expand Up @@ -723,3 +724,9 @@ vector<shared_ptr<TInterfaces>>& MetaDataManager::getInterfaces()
{
return Interfaces;
}

// Метод для получения списка констант
vector<shared_ptr<TConstants>>& MetaDataManager::getConstants()
{
return Constants;
}
3 changes: 3 additions & 0 deletions src/MetaDataManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "Bots.h"
#include "CommonAttributes.h"
#include "CommonCommands.h"
#include "TConstants.h"
#include "CommonTemplates.h"
#include "CommandGroups.h"
#include "ExchangePlans.h"
Expand All @@ -47,6 +48,7 @@ class MetaDataManager {
vector<shared_ptr<TBots>> Bots;
vector<shared_ptr<TCommonAttributes>> CommonAttributes;
vector<shared_ptr<TCommonCommands>> CommonCommands;
vector<shared_ptr<TConstants>> Constants;
vector<shared_ptr<TCommonTemplates>> CommonTemplates;
vector<shared_ptr<TCommandGroups>> CommandGroups;
vector<shared_ptr<TExchangePlans>> ExchangePlans;
Expand All @@ -68,6 +70,7 @@ class MetaDataManager {
vector<shared_ptr<TBots>>& getBots();
vector<shared_ptr<TCommonAttributes>>& getCommonAttributes();
vector<shared_ptr<TCommonCommands>>& getCommonCommands();
vector<shared_ptr<TConstants>>& getConstants();
vector<shared_ptr<TCommonTemplates>>& getCommonTemplates();
vector<shared_ptr<TCommandGroups>>& getCommandGroups();
vector<shared_ptr<TExchangePlans>>& getExchangePlans();
Expand Down
68 changes: 68 additions & 0 deletions src/TConstants.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//---------------------------------------------------------------------------

#pragma hdrstop

#include "TConstants.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)


__fastcall TConstants::TConstants() : BaseMetadataObject()
{
name = "";
}

__fastcall TConstants::TConstants(v8catalog* _parent, const String& _guid) : BaseMetadataObject(_parent, _guid)
{
name = "";
}

__fastcall TConstants::TConstants(v8catalog* _parent, const String& _guid, const String& _name) : BaseMetadataObject(_parent, _guid, _name)
{
name = _name;
}

__fastcall TConstants::~TConstants()
{
}

String __fastcall TConstants::GetConstantsName()
{
return name;
}

void __fastcall TConstants::SetConstantsName(String _name)
{
name = _name;
}

std::vector<std::unique_ptr<TRequisite>>& TConstants::getAttributes()
{
return attributes;
}

std::vector<std::unique_ptr<TComand>>& TConstants::getCommands()
{
return commands;
}

std::vector<std::unique_ptr<TMoxel>>& TConstants::getLayouts()
{
return layouts;
}

std::vector<std::unique_ptr<TTabular>>& TConstants::getTabularSections()
{
return tabularSections;
}

std::vector<std::unique_ptr<TForm1C>>& TConstants::getForms()
{
return forms;
}

void __fastcall TConstants::initializeFromTree()
{
// Инициализация константы из дерева метаданных
// Имя константы уже установлено в конструкторе
}
49 changes: 49 additions & 0 deletions src/TConstants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//---------------------------------------------------------------------------

#ifndef TConstantsH
#define TConstantsH

#include "BaseMetadataObject.h"
//---------------------------------------------------------------------------

/**
* @class TConstants
* @brief Класс для хранения констант (md_Constants)
*
* Константы - это объекты метаданных, которые содержат
* постоянные значения, используемые в различных частях конфигурации.
*/
class TConstants : public BaseMetadataObject
{
private:
// constantsName хранится в унаследованном поле name из BaseMetadataObject

public:
__fastcall TConstants();
__fastcall TConstants(v8catalog* _parent, const String& _guid);
__fastcall TConstants(v8catalog* _parent, const String& _guid, const String& _name);
virtual __fastcall ~TConstants();

// Методы для получения имени константы
String __fastcall GetConstantsName();
void __fastcall SetConstantsName(String _name);

// Реализация виртуальных методов BaseMetadataObject
std::vector<std::unique_ptr<TRequisite>>& getAttributes() override;
std::vector<std::unique_ptr<TComand>>& getCommands() override;
std::vector<std::unique_ptr<TMoxel>>& getLayouts() override;
std::vector<std::unique_ptr<TTabular>>& getTabularSections() override;
std::vector<std::unique_ptr<TForm1C>>& getForms() override;

void __fastcall initializeFromTree() override;

private:
// Внутренние хранилища для совместимости с интерфейсом
std::vector<std::unique_ptr<TRequisite>> attributes;
std::vector<std::unique_ptr<TComand>> commands;
std::vector<std::unique_ptr<TMoxel>> layouts;
std::vector<std::unique_ptr<TTabular>> tabularSections;
std::vector<std::unique_ptr<TForm1C>> forms;
};

#endif