![]() |
Fledge
An open source edge computing platform for industrial users
|
DefaultConfigCategory. More...
#include <config_category.h>
Public Member Functions | |
DefaultConfigCategory (const std::string &name, const std::string &json) | |
DefaultConfigCategory (const ConfigCategory &orig) | |
~DefaultConfigCategory () | |
Destructor for the default configuration category. More... | |
std::string | toJSON () const |
Return JSON string of all category components of a DefaultConfigCategory class. | |
std::string | itemsToJSON () const |
Return DefaultConfigCategory "default" items only. | |
![]() | |
ConfigCategory (const std::string &name, const std::string &json) | |
ConfigCategory (const ConfigCategory &orig) | |
Copy constructor for a configuration category. More... | |
ConfigCategory (const ConfigCategory *orig) | |
Copy constructor for a configuration category when copying from a pointer. More... | |
~ConfigCategory () | |
Configuration category destructor. | |
void | addItem (const std::string &name, const std::string description, const std::string &type, const std::string def, const std::string &value) |
Add an item to a configuration category. | |
void | addItem (const std::string &name, const std::string description, const std::string def, const std::string &value, const std::vector< std::string > options) |
void | removeItems () |
Delete all the items from the configuration category. More... | |
void | removeItemsType (ItemType type) |
Delete all the items from the configuration category having a specific type. More... | |
void | keepItemsType (ItemType type) |
Delete all the items from the configuration category not having a specific type. More... | |
bool | extractSubcategory (ConfigCategory &subCategories) |
Extracts, process and adds subcategory information from a given category to the current instance. More... | |
void | setDescription (const std::string &description) |
Set the description for the configuration category. More... | |
std::string | getName () const |
std::string | getDescription () const |
std::string | getDisplayName () const |
void | setDisplayName (const std::string &displayName) |
unsigned int | getCount () const |
bool | itemExists (const std::string &name) const |
Check for the existence of an item within the configuration category. More... | |
bool | setItemDisplayName (const std::string &name, const std::string &displayName) |
Set the display name of an item. More... | |
std::string | getValue (const std::string &name) const |
Return the value of the configuration category item. More... | |
std::vector< std::string > | getValueList (const std::string &name) const |
Return the value of the configuration category item list, this is a convience function used when simple lists are defined and allows for central processing of the list values. More... | |
std::map< std::string, std::string > | getValueKVList (const std::string &name) const |
Return the value of the configuration category item kvlist, this is a convience function used when key/value lists are defined and allows for central processing of the list values. More... | |
std::string | getType (const std::string &name) const |
Return the type of the configuration category item. More... | |
std::string | getDescription (const std::string &name) const |
std::string | getDefault (const std::string &name) const |
Return the default value of the configuration category item. More... | |
bool | setDefault (const std::string &name, const std::string &value) |
Update the default value of the configuration category item. More... | |
bool | setValue (const std::string &name, const std::string &value) |
Update the value of the configuration category item. More... | |
std::string | getDisplayName (const std::string &name) const |
std::string | getmParentName () const |
std::vector< std::string > | getOptions (const std::string &name) const |
Return the options of the configuration category item. More... | |
std::string | getLength (const std::string &name) const |
Return the length value of the configuration category item. More... | |
std::string | getMinimum (const std::string &name) const |
Return the minimum value of the configuration category item. More... | |
std::string | getMaximum (const std::string &name) const |
Return the maximum of the configuration category item. More... | |
bool | isString (const std::string &name) const |
Return if the configuration item is a string item. More... | |
bool | isEnumeration (const std::string &name) const |
Return if the configuration item is an enumeration item. More... | |
bool | isJSON (const std::string &name) const |
Return if the configuration item is a JSON item. More... | |
bool | isBool (const std::string &name) const |
Return if the configuration item is a Bool item. More... | |
bool | isNumber (const std::string &name) const |
Return if the configuration item is a Numeric item. More... | |
bool | isDouble (const std::string &name) const |
Return if the configuration item is a Double item. More... | |
bool | isList (const std::string &name) const |
Return if the configuration item is a list item. More... | |
bool | isKVList (const std::string &name) const |
Return if the configuration item is a kvlist item. More... | |
bool | isDeprecated (const std::string &name) const |
Return if the configuration item is deprecated a item. More... | |
std::string | toJSON (const bool full=false) const |
Return JSON string of all category components. More... | |
std::string | itemsToJSON (const bool full=false) const |
Return JSON string of category items only. More... | |
ConfigCategory & | operator= (ConfigCategory const &rhs) |
Operator= for ConfigCategory. | |
ConfigCategory & | operator+= (ConfigCategory const &rhs) |
Operator+= for ConfigCategory. | |
void | setItemsValueFromDefault () |
Set the m_value from m_default for each item. | |
void | checkDefaultValuesOnly () const |
Check whether at least one item in the category object has both 'value' and 'default' set. More... | |
std::string | itemToJSON (const std::string &itemName) const |
Return JSON string of a category item. More... | |
std::string | to_string (const rapidjson::Value &v) const |
Convert a RapidJSON value to a string. More... | |
std::vector< std::string > | getPermissions (const std::string &name) const |
Return the permissions of the configuration category item. More... | |
bool | hasPermission (const std::string &name, const std::string &username) const |
Return true if the user has permission to update the named item. More... | |
std::string | getItemAttribute (const std::string &itemName, ItemAttribute itemAttribute) const |
Return the requested attribute of a configuration category item. More... | |
bool | setItemAttribute (const std::string &itemName, ItemAttribute itemAttribute, const std::string &value) |
Set the requested attribute of a configuration category item. More... | |
std::vector< std::pair< std::string, std::string > > * | parseBucketItemValue (const std::string &) |
Parse BucketItem value in JSON dict format and return the key value pairs within that. More... | |
const_iterator | begin () const |
const_iterator | end () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
Additional Inherited Members | |
![]() | |
enum | ItemType { UnknownType, StringItem, EnumerationItem, JsonItem, BoolItem, NumberItem, DoubleItem, ScriptItem, CategoryType, CodeItem, BucketItem, ListItem, KVListItem } |
enum | ItemAttribute { ORDER_ATTR, READONLY_ATTR, MANDATORY_ATTR, FILE_ATTR, MINIMUM_ATTR, MAXIMUM_ATTR, LENGTH_ATTR, VALIDITY_ATTR, GROUP_ATTR, DISPLAY_NAME_ATTR, DEPRECATED_ATTR, RULE_ATTR, BUCKET_PROPERTIES_ATTR, LIST_SIZE_ATTR, ITEM_TYPE_ATTR, LIST_NAME_ATTR, KVLIST_KEY_NAME_ATTR, KVLIST_KEY_DESCRIPTION_ATTR, JSON_SCHEMA_ATTR } |
using | iterator = std::vector< CategoryItem * >::iterator |
using | const_iterator = std::vector< CategoryItem * >::const_iterator |
![]() | |
std::vector< CategoryItem * > | m_items |
std::string | m_name |
std::string | m_parent_name |
std::string | m_description |
std::string | m_displayName |
json input parameter must contain only "default" items. itemsToJSON() reports only "defaults"
This class must be used when creating/updating a category via ManagementClient::addCategoryDefault(DefaultConfigCategory categoryDefault)
DefaultConfigCategory::~DefaultConfigCategory | ( | ) |
Destructor for the default configuration category.
Simply call the base class destructor.