Property.h
Go to the documentation of this file.
1 
20 #pragma once
21 
22 #include "PropertyData.h"
23 
24 namespace ConfigDB
25 {
26 class Store;
27 
32 {
33 public:
34  PropertyConst() = default;
35 
44  {
45  }
46 
47  String getValue() const;
48 
49  explicit operator bool() const
50  {
51  return store;
52  }
53 
55 
56  const PropertyInfo& info() const
57  {
58  return *propinfo;
59  }
60 
61 protected:
63  const Store* store{};
64  const PropertyData* data{};
66 };
67 
68 class Property : public PropertyConst
69 {
70 public:
72 
73  bool setJsonValue(const char* value, size_t valueLength);
74 
75  bool setJsonValue(const String& value)
76  {
77  return setJsonValue(value.c_str(), value.length());
78  }
79 };
80 
81 } // namespace ConfigDB
Manages a key/value pair stored in an object, or a simple array value.
Definition: Property.h:32
const PropertyData * data
Definition: Property.h:64
const Store * store
Definition: Property.h:63
const PropertyData * defaultData
Definition: Property.h:65
const PropertyInfo * propinfo
Definition: Property.h:62
String getValue() const
PropertyConst(const Store &store, const PropertyInfo &info, const PropertyData *data, const PropertyData *defaultData)
Create a Property instance.
Definition: Property.h:41
const PropertyInfo & info() const
Definition: Property.h:56
String getJsonValue() const
Definition: Property.h:69
bool setJsonValue(const String &value)
Definition: Property.h:75
bool setJsonValue(const char *value, size_t valueLength)
Manages access to an object store, typically one file.
Definition: ConfigDB/src/include/ConfigDB/Store.h:43
The String class.
Definition: WString.h:133
const char * c_str() const
Get a constant (un-modifiable) pointer to String content.
Definition: WString.h:609
size_t length(void) const
Obtain the String length in characters, excluding NUL terminator.
Definition: WString.h:238
Definition: Array.h:26
Property metadata.
Definition: PropertyInfo.h:112
static const PropertyInfo empty
Definition: PropertyInfo.h:151
Definition: PropertyData.h:44