unknown state of work

This commit is contained in:
Marcel M. Otte 2020-12-30 12:46:05 +01:00
parent 0ccbee1438
commit 8785596ba2
24 changed files with 211 additions and 142 deletions

View File

@ -1,30 +1,31 @@
# NPC core
# NPC
```plantuml
abstract class ARepository
abstract class ARepositoryFactory
class RepositoryFactory
class Repository {
package Core {
package Control {
class RepositoryFactory
class ModelFactory
class StructureFactory
class FieldFactory{
+ createField()
}
}
package Model as PKGmodel {
class Repository {
+addStructure()
+removeStructure()
+getStructure()
}
abstract class AStackModelFactory
class StackModelFactory
abstract class AStackModel
class StackModel {
}
class Model {
+getBinary():byte[]
+getStructures():Structure[]
+addStructure()
+removeStructure()
}
abstract class AStructureFactory
class StructureFactory
abstract class AStructure
class Structure {
}
class Structure {
-name
-description
-fields
@ -32,75 +33,83 @@ class Structure {
+putData(Field, data)
+validateData(Field, data)
+updateData()
}
abstract class AFieldFactory{
+ createField()
+ createFieldBinaryInformation()
+ createFieldLogicalInformation()
+ createFieldVisualInformation()
+ createFieldRepresentation()
}
class FieldFactory
abstract class AField
class Field {
}
class Field {
- owningStructure
- binary
- logical
- visual
- representation
}
}
}
package Editor {
class MainWindow
class DockWidget_Tools
class DockWidget_Helpers
class StackContainer
class Syntax
class Name
class Input
class Representation
class StructureField
StructureField *-- Syntax
StructureField *-- Name
StructureField *-- Input
StructureField *-- Representation
MainWindow *- StackContainer: as centralWidget
}
class RandomAccessBinary {
- binaryData
+ setBytes(uint position, std::vector<uint8_t> data)
+ setByte(uint position, uint8_t data)
+ setByte(uint position, uint8_t data)
+ setBit(uint64_t position, bool value)
+ setBit(uint bytePosition, uint bitPosition, bool value)
+ setBits(uint64_t position, uint bits, uint value)
+ setBits(uint bytePosition, uint bitPosition, uint bits, uint value)
+ setBit(uint64_t position, bool value)
+ setBit(uint bytePosition, uint bitPosition, bool value)
+ setBits(uint64_t position, uint bits, uint value)
+ setBits(uint bytePosition, uint bitPosition, uint bits, uint value)
+ getByte(uint position)
+ getBytes(uint position, uint bytes)
+ getByte(uint position)
+ getBytes(uint position, uint bytes)
+ getBit(uint64_t position)
+ getBit(uint bytePosition, uint bitPosition)
+ getBits(uint64_t position, uint bits)
+ getBits(uint bytePosition, uint bitPosition, uint bits)
+ getBit(uint64_t position)
+ getBit(uint bytePosition, uint bitPosition)
+ getBits(uint64_t position, uint bits)
+ getBits(uint bytePosition, uint bitPosition, uint bits)
+ get_uint32(uint position)
+ get_uint16(uint position)
+ get_uint64(uint position)
+ get_float(uint position)
+ get_double(uint position)
+ get_uint32(uint position)
+ get_uint16(uint position)
+ get_uint64(uint position)
+ get_float(uint position)
+ get_double(uint position)
+ get_string(uint position, uint length)
+ get_string(uint position, uint length)
+ get_hex_string(uint position, uint length)
+ get_hex_string()
+ get_hex_string(uint position, uint length)
+ get_hex_string()
}
ARepositoryFactory <|-- RepositoryFactory
ARepository <|-- Repository
RepositoryFactory --> Repository : creates >
AStackModelFactory <|-- StackModelFactory
AStackModel <|-- StackModel
StackModelFactory --> StackModel: creates >
ModelFactory -> Model: creates >
AStructureFactory <|-- StructureFactory
AStructure <|-- Structure
StructureFactory --> Structure : creates >
StackModel *-- Structure
Repository *-- Structure
StructureFactory -> Structure : creates >
Model *- Structure
Repository *- Structure
AFieldFactory <|-- FieldFactory
AField <|-- Field
FieldFactory --> Field : creates >
FieldFactory -> Field : creates >
Structure *-- Field
Structure *- Field
StackModel *-- "1" RandomAccessBinary
Model *-- "1" RandomAccessBinary
StructureField *-- Field
StackContainer *-- StructureField
```

View File

@ -8,10 +8,10 @@ set(HEADERS
model/Model.h
model/Structure.h
model/Field.h
control/ARepositoryFactory.h
control/AFieldFactory.h
control/AStructureFactory.h
control/AModelFactory.h
control/RepositoryFactory.h
control/FieldFactory.h
control/StructureFactory.h
control/ModelFactory.h
schemaio/AStructureReaderFactory.h
schemaio/AStructureWriterFactory.h
@ -28,10 +28,10 @@ set(SOURCES
model/Model.cpp
model/Structure.cpp
model/Field.cpp
control/ARepositoryFactory.cpp
control/AFieldFactory.cpp
control/AStructureFactory.cpp
control/AModelFactory.cpp
control/RepositoryFactory.cpp
control/FieldFactory.cpp
control/StructureFactory.cpp
control/ModelFactory.cpp
schemaio/AStructureReaderFactory.cpp
schemaio/AStructureWriterFactory.cpp

View File

@ -1,5 +1,5 @@
#include "AFieldFactory.h"
namespace NPC_core {
#include "FieldFactory.h"
namespace NPC { namespace core {
namespace Control {
FieldFactory::FieldFactory()
{
@ -14,12 +14,17 @@ std::shared_ptr<Model::Field> FieldFactory::createField(std::string name, std::s
return f;
}
std::shared_ptr<Model::Field> FieldFactory::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::shared_ptr<std::map<std::string, std::string>> syntaxes, std::shared_ptr<Model::Structure> parentStructure)
{
auto f = std::make_shared<Model::Field>();
f->setName(name);
auto f = this->createField(name, parentStructure);
f->setSyntaxes(syntaxes);
f->setParentStructure(parentStructure);
return f;
}
}}
std::shared_ptr<Model::Field> FieldFactory::createFieldWithPredefinedValues(std::string name, std::shared_ptr<std::map<std::string, std::string> > choosableValues, std::shared_ptr<std::map<std::string, std::string> > syntaxes, std::shared_ptr<Model::Structure> parentStructure)
{
auto f = this->createFieldFull(name, syntaxes, parentStructure);
f->setChooseableValues(choosableValues);
return f;
}
}}}

View File

@ -4,7 +4,7 @@
#include "../model/Field.h"
#include <memory>
namespace NPC_core {
namespace NPC { namespace core {
namespace Control {
class FieldFactory
{
@ -13,7 +13,10 @@ public:
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> 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::shared_ptr<std::map<std::string, std::string>> syntaxes, std::shared_ptr<Model::Structure> parentStructure = nullptr);
virtual std::shared_ptr<Model::Field> createFieldWithPredefinedValues(std::string name, std::shared_ptr<std::map<std::string, std::string>> choosableValues,
std::shared_ptr<std::map<std::string, std::string>> syntaxes,
std::shared_ptr<Model::Structure> parentStructure = nullptr);
};
}}
}}}
#endif // AFIELDFACTORY_H

View File

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

View File

@ -1,12 +1,12 @@
#ifndef AMODELFACTORY_H
#define AMODELFACTORY_H
namespace NPC_core {
namespace NPC { namespace core {
namespace Control {
class ModelFactory
{
public:
ModelFactory();
};
}}
}}}
#endif // AMODELFACTORY_H

View File

@ -0,0 +1,8 @@
#include "RepositoryFactory.h"
namespace NPC { namespace core {
namespace Control {
RepositoryFactory::RepositoryFactory()
{
}
}}}

View File

@ -1,12 +1,12 @@
#ifndef AREPOSITORYFACTORY_H
#define AREPOSITORYFACTORY_H
namespace NPC_core {
namespace NPC { namespace core {
namespace Control {
class RepositoryFactory
{
public:
RepositoryFactory();
};
}}
}}}
#endif // AREPOSITORYFACTORY_H

View File

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

View File

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

View File

@ -1,12 +1,12 @@
#ifndef ASTRUCTUREFACTORY_H
#define ASTRUCTUREFACTORY_H
namespace NPC_core {
namespace NPC { namespace core {
namespace Control {
class StructureFactory
{
public:
StructureFactory();
};
}}
}}}
#endif // ASTRUCTUREFACTORY_H

View File

@ -1,6 +1,6 @@
#include "Field.h"
namespace NPC_core {
namespace NPC { namespace core {
namespace Model {
Field::Field()
{
@ -58,4 +58,4 @@ void Field::setChooseableValues(const std::shared_ptr<std::map<std::string, std:
}
}
}
}}

View File

@ -6,7 +6,7 @@
#include <string>
#include <map>
namespace NPC_core {
namespace NPC { namespace core {
namespace Model {
class Structure;
@ -39,6 +39,6 @@ protected:
std::string value;
std::shared_ptr<std::map<std::string, std::string>> chooseableValues;
};
}}
}}}
#endif // AFIELD_H

View File

@ -1,8 +1,8 @@
#include "Model.h"
namespace NPC_core {
namespace NPC { namespace core {
namespace Model {
Model::Model()
{
}
}}
}}}

View File

@ -4,7 +4,7 @@
#include "../Tree.h"
#include "Field.h"
namespace NPC_core {
namespace NPC { namespace core {
namespace Model {
class Model
{
@ -15,5 +15,5 @@ public:
private:
Tree<Field> stack;
};
}}
}}}
#endif // AMODEL_H

View File

@ -1,8 +1,8 @@
#include "Repository.h"
namespace NPC_core {
namespace NPC { namespace core {
namespace Model {
Repository::Repository()
{
}
}}
}}}

View File

@ -4,7 +4,7 @@
#include <map>
#include "Structure.h"
namespace NPC_core {
namespace NPC { namespace core {
namespace Model {
class Repository
{
@ -15,5 +15,5 @@ public:
private:
std::map<std::string, Structure> structures;
};
}}
}}}
#endif // AREPOSITORY_H

View File

@ -1,5 +1,5 @@
#include "Structure.h"
namespace NPC_core {
namespace NPC { namespace core {
namespace Model {
Structure::Structure()
{
@ -25,4 +25,20 @@ void Structure::setLayer(const uint &value)
{
layer = value;
}
}}
std::shared_ptr<Tree<Field> > Structure::getElements() const
{
return elements;
}
void Structure::setElements(const std::shared_ptr<Tree<Field> > &value)
{
elements = value;
}
std::shared_ptr<TreeNode<Field> > Structure::getElementCopy()
{
if(elements != nullptr)
return elements->getRoot()->rcopy();
}
}}}

View File

@ -6,7 +6,7 @@
#include "Field.h"
#include "../Tree.h"
namespace NPC_core {
namespace NPC { namespace core {
namespace Model {
class Field;
@ -28,6 +28,6 @@ private:
std::string name;
uint layer;
};
}}
}}}
#endif // ASTRUCTURE_H

View File

@ -2,11 +2,13 @@
set(HEADERS
flowlayout.h
StructureField.h
StackContainer.h
)
set(SOURCES
flowlayout.cpp
StructureField.cpp
StackContainer.cpp
)
add_library(editor ${HEADERS} ${SOURCES})

View File

@ -0,0 +1,6 @@
#include "StackContainer.h"
using namespace NPC::editor;
StackContainer::StackContainer(QWidget *parent) : QWidget(parent)
{
}

View File

@ -0,0 +1,26 @@
#ifndef STACKCONTAINER_H
#define STACKCONTAINER_H
#include <QWidget>
#include <memory>
#include "../core/model/Model.h"
namespace NPC {
namespace editor {
class StackContainer : public QWidget
{
Q_OBJECT
public:
explicit StackContainer(QWidget *parent = nullptr);
void setModel(std::shared_ptr<NPC::core::Model::Model> model);
signals:
public slots:
};
}}
#endif // STACKCONTAINER_H

View File

@ -1,6 +1,7 @@
#include "StructureField.h"
namespace NPC_editor {
namespace NPC {
namespace editor {
StructureField::StructureField(QWidget *parent) : QWidget(parent)
{
@ -14,7 +15,7 @@ StructureField::StructureField(QWidget *parent) : QWidget(parent)
this->syntax = new QLabel(this);
}
StructureField::StructureField(const std::shared_ptr<NPC_core::Model::Field> field, QWidget *parent) : QWidget(parent)
StructureField::StructureField(const std::shared_ptr<NPC::core::Model::Field> field, QWidget *parent) : StructureField(parent)
{
this->field = field;
}
@ -56,4 +57,4 @@ void StructureField::initialRender()
this->render();
}
}
}}

View File

@ -10,14 +10,15 @@
#include "../core/model/Field.h"
#include <memory>
namespace NPC_editor {
namespace NPC{
namespace editor {
class StructureField : public QWidget
{
Q_OBJECT
public:
explicit StructureField(QWidget *parent = nullptr);
explicit StructureField(const std::shared_ptr<NPC_core::Model::Field> field, QWidget *parent = nullptr);
explicit StructureField(const std::shared_ptr<NPC::core::Model::Field> field, QWidget *parent = nullptr);
signals:
@ -30,7 +31,7 @@ public slots:
void initialRender();
private:
std::shared_ptr<NPC_core::Model::Field> field;
std::shared_ptr<NPC::core::Model::Field> field;
// layout
QVBoxLayout* layout;
QLabel* title;
@ -41,5 +42,5 @@ private:
QRegExpValidator* validator;
QWidget* subContainer;
};
}
}}
#endif // STRUCTUREFIELD_H