X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FDataValueRepository.h;fp=bundles%2Forg.simantics.databoard%2Fcpp%2FDataBoardTest%2FDataBoard%2FDataValueRepository.h;h=7b16fe20e11c2f0bddcef5d30d3edfc6a2b25aad;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/DataValueRepository.h b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/DataValueRepository.h new file mode 100644 index 000000000..7b16fe20e --- /dev/null +++ b/bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoard/DataValueRepository.h @@ -0,0 +1,61 @@ +#pragma once + +#include "DataBoardAPI.h" + +#include "SimanticsDataParser.h" +#include "SimanticsDataLexer.h" + +#include +#include + +namespace Databoard { + + namespace Type { + class DataType; + class DataBoardRepository; + struct strTypeDefinition; + } + + namespace Value { + + class Value; + + struct DATABOARD_API strDataValueDefinition { + std::string name; + std::string type; + Value* value; + + std::string writeOut() const; + }; + + class DATABOARD_API DataValueRepository { + public: + DataValueRepository(); + virtual ~DataValueRepository(); + + int count(); + const strDataValueDefinition* getDataValue(int i); + const strDataValueDefinition* getDataValue(std::string value); + + bool open(std::string fileName, Databoard::Type::DataBoardRepository* dataBoardRepository); + Value* open(std::string fileName, Databoard::Type::DataType* dataType); + + + protected: + + std::vector values; + + private: + + Databoard::Type::DataBoardRepository* dataBoardRepository; + + Value* parse(pANTLR3_BASE_TREE tree, Value* parent = NULL, int indent = 0); + void print(pANTLR3_BASE_TREE tree, int indent = 0); + + const Databoard::Type::strTypeDefinition* parseTypeReference(pANTLR3_BASE_TREE tree); + Value* parseValues(pANTLR3_BASE_TREE tree, Databoard::Type::DataType* dataBoard, int indent); + + void addDataValue(std::string name, std::string type, Value* dataValue); + }; + } +}