ObjectInfo.h
Go to the documentation of this file.
1 
20 #pragma once
21 
22 #include "PropertyInfo.h"
23 
24 #define CONFIGDB_OBJECT_TYPE_MAP(XX) \
25  XX(Object) \
26  XX(Array) \
27  XX(ObjectArray) \
28  XX(Union)
29 
30 namespace ConfigDB
31 {
32 enum class ObjectType : uint32_t {
33 #define XX(name) name,
35 #undef XX
36 };
37 
38 struct ObjectInfo {
41  uint32_t structSize;
42  uint32_t objectCount;
43  uint32_t propertyCount;
44  uint32_t aliasCount;
46 
47  static const ObjectInfo empty;
48 
49  bool isArray() const
50  {
51  return type == ObjectType::Array || type == ObjectType::ObjectArray;
52  }
53 
55 
56  int findObject(const char* name, size_t length) const;
57 
58  int findProperty(const char* name, size_t length) const;
59 
60  const PropertyInfo& getObject(unsigned index) const
61  {
62  assert(index < objectCount);
63  return (index < objectCount) ? propinfo[index] : PropertyInfo::empty;
64  }
65 
66  const PropertyInfo& getProperty(unsigned index) const
67  {
68  assert(index < propertyCount);
69  return (index < propertyCount) ? propinfo[objectCount + index] : PropertyInfo::empty;
70  }
71 
72 private:
73  int findAlias(const char* name, size_t length) const;
74 };
75 
76 } // namespace ConfigDB
77 
#define PGM_VOID_P
Definition: Arch/Esp32/Components/libc/src/include/sys/pgmspace.h:31
#define CONFIGDB_OBJECT_TYPE_MAP(XX)
Definition: ObjectInfo.h:24
String toString(ConfigDB::ObjectType type)
The String class.
Definition: WString.h:133
Definition: Array.h:26
ObjectType
Definition: ObjectInfo.h:32
FSTR::Array< Ssl::CipherSuite > Array
Definition: CipherSuite.h:182
Definition: ObjectInfo.h:38
int findProperty(const char *name, size_t length) const
int findObject(const char *name, size_t length) const
String getTypeDesc() const
uint32_t objectCount
Definition: ObjectInfo.h:42
const PropertyInfo & getObject(unsigned index) const
Definition: ObjectInfo.h:60
static const ObjectInfo empty
Definition: ObjectInfo.h:47
PGM_VOID_P defaultData
Definition: ObjectInfo.h:40
const PropertyInfo & getProperty(unsigned index) const
Definition: ObjectInfo.h:66
uint32_t structSize
Definition: ObjectInfo.h:41
uint32_t aliasCount
Definition: ObjectInfo.h:44
ObjectType type
Definition: ObjectInfo.h:39
uint32_t propertyCount
Definition: ObjectInfo.h:43
bool isArray() const
Definition: ObjectInfo.h:49
const PropertyInfo propinfo[]
Definition: ObjectInfo.h:45
Property metadata.
Definition: PropertyInfo.h:112
static const PropertyInfo empty
Definition: PropertyInfo.h:151