Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
AbstractLogicsElement.hpp
Go to the documentation of this file.
1#ifndef LIBS_LOGIC_ABSTRACTLOGICSELEMENT_HPP_
2#define LIBS_LOGIC_ABSTRACTLOGICSELEMENT_HPP_
3
5#include "logic/enums.hpp"
7
8#include <map>
9#include <optional>
10#include <string>
11#include <utility>
12#include <vector>
13
15{
16public:
21 enum class EPartType
22 {
28 };
29
30 typedef std::pair<TIndex, EPartType> TPairIndexPartType;
31 typedef std::map<TIndex, EPartType> TMapIndexPartType;// <index in the parent component, part type>
32 typedef std::map<TPairIndexPartType, AbstractCanvasItem::TTupleDrawingMode> TMapPartTypeDrawingMode;
33 typedef std::map<AbstractCanvasItem::TTupleDrawingMode, TMapPartTypeDrawingMode>
34 TMapDrawingModePartsDrawingMode;// how to draw each part for a particular drawing mode
35
36 inline static constexpr std::string_view kPrvKeySectionLogicsElementData = "LogicsElementData";
37
38 static iv::logic::eLogicsElementType enumLogicsElementType(const std::string &strType);
40
42 const iv::file::xml::node &node);// need to read first the type in order to read the rest of the element.
43
44 explicit AbstractLogicsElement(iv::logic::eLogicsElementType logicsElementType);
46 const std::string &name);
48 ~AbstractLogicsElement() override = default;
53
54 iv::file::xml::node read(const iv::file::xml::node &node) override;
55 iv::file::xml::node save(iv::file::xml::node &node) const override;
56
57 std::vector<std::shared_ptr<AbstractCanvasItem>> getLinkedItems() override;
58 [[nodiscard]] virtual std::string maxText() const;
59 void updateLinkedItems() override;
60 void resetLinkedItems() override;
61
62 [[nodiscard]] const iv::logic::eLogicsElementType &getElementType() const;
63 [[nodiscard]] const std::string &getElementName() const;
64
65 [[nodiscard]] virtual std::string getMainText() const;
66 [[nodiscard]] virtual std::string getDescriptiveText() const;
67
68 virtual std::optional<iv::types::Size> getDefaultSize() const;
69
70private:
72 std::string m_name;
73};
74
75#endif /* LIBS_LOGIC_ABSTRACTLOGICSELEMENT_HPP_ */
Definition AbstractCanvasItem.hpp:24
uint32_t TId
Definition AbstractCanvasItem.hpp:47
Definition AbstractLogicsElement.hpp:15
static std::string strLogicsElementType(iv::logic::eLogicsElementType type)
Definition AbstractLogicsElement.cpp:28
iv::file::xml::node save(iv::file::xml::node &node) const override
Definition AbstractLogicsElement.cpp:82
virtual std::optional< iv::types::Size > getDefaultSize() const
Definition AbstractLogicsElement.cpp:134
AbstractLogicsElement()=delete
std::map< TIndex, EPartType > TMapIndexPartType
Definition AbstractLogicsElement.hpp:31
virtual std::string maxText() const
Definition AbstractLogicsElement.cpp:101
const iv::logic::eLogicsElementType & getElementType() const
Definition AbstractLogicsElement.cpp:114
virtual std::string getDescriptiveText() const
Definition AbstractLogicsElement.cpp:129
std::string m_name
Definition AbstractLogicsElement.hpp:72
std::map< AbstractCanvasItem::TTupleDrawingMode, TMapPartTypeDrawingMode > TMapDrawingModePartsDrawingMode
Definition AbstractLogicsElement.hpp:34
std::vector< std::shared_ptr< AbstractCanvasItem > > getLinkedItems() override
Definition AbstractLogicsElement.cpp:96
iv::file::xml::node read(const iv::file::xml::node &node) override
Definition AbstractLogicsElement.cpp:67
AbstractLogicsElement & operator=(const AbstractLogicsElement &other)=delete
std::pair< TIndex, EPartType > TPairIndexPartType
Definition AbstractLogicsElement.hpp:30
EPartType
Definition AbstractLogicsElement.hpp:22
virtual std::string getMainText() const
Definition AbstractLogicsElement.cpp:124
AbstractLogicsElement(const AbstractLogicsElement &other)=delete
void resetLinkedItems() override
Definition AbstractLogicsElement.cpp:110
std::map< TPairIndexPartType, AbstractCanvasItem::TTupleDrawingMode > TMapPartTypeDrawingMode
Definition AbstractLogicsElement.hpp:32
~AbstractLogicsElement() override=default
static constexpr std::string_view kPrvKeySectionLogicsElementData
Definition AbstractLogicsElement.hpp:36
void updateLinkedItems() override
Definition AbstractLogicsElement.cpp:106
AbstractLogicsElement(AbstractLogicsElement &&other)=delete
static iv::logic::eLogicsElementType readLogicsElementType(const iv::file::xml::node &node)
Definition AbstractLogicsElement.cpp:43
AbstractLogicsElement & operator=(AbstractLogicsElement &&other)=delete
const std::string & getElementName() const
Definition AbstractLogicsElement.cpp:119
iv::logic::eLogicsElementType m_logicsElementType
Definition AbstractLogicsElement.hpp:71
static iv::logic::eLogicsElementType enumLogicsElementType(const std::string &strType)
Definition AbstractLogicsElement.cpp:13
Definition xmlFile.hpp:15
eLogicsElementType
Definition enums.hpp:8