Working on renaming and structuring source

This commit is contained in:
Marcel M. Otte 2018-01-16 17:35:42 +01:00
parent e997802305
commit 9b5ce8b7a1
12 changed files with 48 additions and 20 deletions

View File

@ -1,12 +1,12 @@
#include "AFieldFactory.h" #include "AFieldFactory.h"
namespace NPC_core { namespace NPC_core {
namespace Control { namespace Control {
AFieldFactory::AFieldFactory() FieldFactory::FieldFactory()
{ {
} }
std::shared_ptr<Model::Field> AFieldFactory::createField(std::string name, std::shared_ptr<Model::Structure> parentStructure) std::shared_ptr<Model::Field> FieldFactory::createField(std::string name, std::shared_ptr<Model::Structure> parentStructure)
{ {
auto f = std::make_shared<Model::Field>(); auto f = std::make_shared<Model::Field>();
f->setName(name); f->setName(name);
@ -14,7 +14,7 @@ std::shared_ptr<Model::Field> AFieldFactory::createField(std::string name, std::
return f; return f;
} }
std::shared_ptr<Model::Field> AFieldFactory::createFieldFull(std::string name, std::map<std::string, std::string> syntaxes, std::shared_ptr<Model::Structure> parentStructure) std::shared_ptr<Model::Field> FieldFactory::createFieldFull(std::string name, std::map<std::string, std::string> syntaxes, std::shared_ptr<Model::Structure> parentStructure)
{ {
auto f = std::make_shared<Model::Field>(); auto f = std::make_shared<Model::Field>();
f->setName(name); f->setName(name);

View File

@ -6,11 +6,11 @@
namespace NPC_core { namespace NPC_core {
namespace Control { namespace Control {
class AFieldFactory class FieldFactory
{ {
public: public:
AFieldFactory(); FieldFactory();
virtual ~AFieldFactory(); virtual ~FieldFactory();
virtual std::shared_ptr<Model::Field> createField(std::string name, std::shared_ptr<Model::Structure> parentStructure = nullptr); virtual std::shared_ptr<Model::Field> createField(std::string name, std::shared_ptr<Model::Structure> parentStructure = nullptr);
virtual std::shared_ptr<Model::Field> createFieldFull(std::string name, std::map<std::string, std::string> syntaxes, std::shared_ptr<Model::Structure> parentStructure = nullptr); virtual std::shared_ptr<Model::Field> createFieldFull(std::string name, std::map<std::string, std::string> syntaxes, std::shared_ptr<Model::Structure> parentStructure = nullptr);

View File

@ -1,7 +1,7 @@
#include "AModelFactory.h" #include "AModelFactory.h"
namespace NPC_core { namespace NPC_core {
namespace Control { namespace Control {
AModelFactory::AModelFactory() ModelFactory::ModelFactory()
{ {
} }

View File

@ -3,10 +3,10 @@
namespace NPC_core { namespace NPC_core {
namespace Control { namespace Control {
class AModelFactory class ModelFactory
{ {
public: public:
AModelFactory(); ModelFactory();
}; };
}} }}
#endif // AMODELFACTORY_H #endif // AMODELFACTORY_H

View File

@ -1,7 +1,7 @@
#include "ARepositoryFactory.h" #include "ARepositoryFactory.h"
namespace NPC_core { namespace NPC_core {
namespace Control { namespace Control {
ARepositoryFactory::ARepositoryFactory() RepositoryFactory::RepositoryFactory()
{ {
} }

View File

@ -3,10 +3,10 @@
namespace NPC_core { namespace NPC_core {
namespace Control { namespace Control {
class ARepositoryFactory class RepositoryFactory
{ {
public: public:
ARepositoryFactory(); RepositoryFactory();
}; };
}} }}
#endif // AREPOSITORYFACTORY_H #endif // AREPOSITORYFACTORY_H

View File

@ -1,7 +1,7 @@
#include "AStructureFactory.h" #include "AStructureFactory.h"
namespace NPC_core { namespace NPC_core {
namespace Control { namespace Control {
AStructureFactory::AStructureFactory() StructureFactory::StructureFactory()
{ {
} }

View File

@ -3,10 +3,10 @@
namespace NPC_core { namespace NPC_core {
namespace Control { namespace Control {
class AStructureFactory class StructureFactory
{ {
public: public:
AStructureFactory(); StructureFactory();
}; };
}} }}
#endif // ASTRUCTUREFACTORY_H #endif // ASTRUCTUREFACTORY_H

View File

@ -17,12 +17,12 @@ void Field::setName(const std::string &value)
name = value; name = value;
} }
std::map<std::string, std::string> Field::getSyntaxes() const std::shared_ptr<std::map<std::string, std::string> > Field::getSyntaxes() const
{ {
return syntaxes; return syntaxes;
} }
void Field::setSyntaxes(const std::map<std::string, std::string> &value) void Field::setSyntaxes(const std::shared_ptr<std::map<std::string, std::string>> &value)
{ {
syntaxes = value; syntaxes = value;
} }
@ -47,5 +47,15 @@ void Field::setParentStructure(const std::shared_ptr<Structure> &value)
parentStructure = value; parentStructure = value;
} }
std::shared_ptr<std::map<std::string, std::string> > Field::getChooseableValues() const
{
return chooseableValues;
}
void Field::setChooseableValues(const std::shared_ptr<std::map<std::string, std::string> > &value)
{
chooseableValues = value;
}
} }
} }

View File

@ -20,8 +20,8 @@ public:
std::string getName() const; std::string getName() const;
void setName(const std::string &value); void setName(const std::string &value);
std::map<std::string, std::string> getSyntaxes() const; std::shared_ptr<std::map<std::string, std::string>> getSyntaxes() const;
void setSyntaxes(const std::map<std::string, std::string> &value); void setSyntaxes(const std::shared_ptr<std::map<std::string, std::string>> &value);
std::string getValue() const; std::string getValue() const;
void setValue(const std::string &value); void setValue(const std::string &value);
@ -29,11 +29,15 @@ public:
std::shared_ptr<Structure> getParentStructure() const; std::shared_ptr<Structure> getParentStructure() const;
void setParentStructure(const std::shared_ptr<Structure> &value); void setParentStructure(const std::shared_ptr<Structure> &value);
std::shared_ptr<std::map<std::string, std::string> > getChooseableValues() const;
void setChooseableValues(const std::shared_ptr<std::map<std::string, std::string> > &value);
protected: protected:
std::shared_ptr<Structure> parentStructure; std::shared_ptr<Structure> parentStructure;
std::string name; std::string name;
std::map<std::string, std::string> syntaxes; // example : regex; for validation std::shared_ptr<std::map<std::string, std::string>> syntaxes; // example : regex; for validation
std::string value; std::string value;
std::shared_ptr<std::map<std::string, std::string>> chooseableValues;
}; };
}} }}

View File

@ -15,4 +15,14 @@ void Structure::setName(const std::string &value)
{ {
name = value; name = value;
} }
uint Structure::getLayer() const
{
return layer;
}
void Structure::setLayer(const uint &value)
{
layer = value;
}
}} }}

View File

@ -20,9 +20,13 @@ public:
std::string getName() const; std::string getName() const;
void setName(const std::string &value); void setName(const std::string &value);
uint getLayer() const;
void setLayer(const uint &value);
private: private:
Tree<Field> elements; Tree<Field> elements;
std::string name; std::string name;
uint layer;
}; };
}} }}