diff options
Diffstat (limited to 'core/src/Model/Workflow/Value.hpp')
-rw-r--r-- | core/src/Model/Workflow/Value.hpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/core/src/Model/Workflow/Value.hpp b/core/src/Model/Workflow/Value.hpp index 8b3e63a..ff62d43 100644 --- a/core/src/Model/Workflow/Value.hpp +++ b/core/src/Model/Workflow/Value.hpp @@ -5,6 +5,7 @@ #include <iosfwd> #include <memory> +#include <string> class BaseValue { @@ -14,6 +15,12 @@ public: KD_Numeric, KD_Text, KD_DateTime, + KD_DatabaseRowId, + + KD_BaseObject, + KD_SaleDatabaseRow, + KD_PurchaseDatabaseRow, + KD_BaseObjectLast = KD_PurchaseDatabaseRow, /// An unspecified type, otherwise known as "any" in some contexts. InvalidKind, @@ -34,6 +41,8 @@ public: static const char* Format(Kind kind); static std::unique_ptr<BaseValue> CreateByKind(Kind kind); + static bool IsInstance(const BaseValue* value); + BaseValue(Kind kind); virtual ~BaseValue() = default; @@ -51,3 +60,32 @@ public: virtual void ReadFrom(std::istream& stream); virtual void WriteTo(std::ostream& stream); }; + +class BaseObjectDescription +{ +public: + struct Property + { + std::string Name; + BaseValue::Kind Kind; + bool Mutatable = true; + }; + +public: + std::vector<Property> Properties; +}; + +class BaseObjectValue : public BaseValue +{ +public: + /// \param kind A value kind enum, within the range of KD_BaseObject and KD_BaseObjectLast (both inclusive). + static const BaseObjectDescription& QueryObjectInfo(Kind kind); + + static bool IsInstance(const BaseValue* value); + BaseObjectValue(Kind kind); + + const BaseObjectDescription& GetObjectDescription() const; + + virtual const BaseValue* GetProperty(int idx) const = 0; + virtual bool SetProperty(int idx, std::unique_ptr<BaseValue> value) = 0; +}; |