20 #ifndef COIL_PROPERTIES_H 21 #define COIL_PROPERTIES_H 150 Properties(std::map<std::string, std::string>& defaults);
210 Properties(
const char* defaults[],
long num = LONG_MAX);
340 inline const std::vector<Properties*>&
getLeaf(
void)
const {
return leaf;}
390 const std::string&
getProperty(
const std::string& key)
const;
420 const std::string&
getProperty(
const std::string& key,
421 const std::string& def)
const;
451 const std::string&
operator[](
const std::string& key)
const;
485 std::string&
operator[](
const std::string& key);
511 const std::string&
getDefault(
const std::string& key)
const;
566 std::string
setDefault(
const std::string& key,
const std::string& value);
595 void setDefaults(
const char* defaults[],
long num = LONG_MAX);
621 void list(std::ostream& out);
749 void load(std::istream& inStream);
776 void save(std::ostream& out,
const std::string& header);
860 void store(std::ostream& out,
const std::string& header);
909 int size(
void)
const;
1105 static void splitKeyValue(
const std::string& str, std::string& key,
1106 std::string& value);
1139 static bool split(
const std::string& str,
const char delim,
1140 std::vector<std::string>& value);
1175 std::vector<Properties*>::size_type
index,
1200 std::string curr_name,
1224 static void _store(std::ostream& out, std::string curr_name,
1280 static std::string
indent(
int index);
1317 #endif // COIL_PROPERTIES_H const std::string & getDefault(const std::string &key) const
Get the default values with specified key.
static void splitKeyValue(const std::string &str, std::string &key, std::string &value)
Split the string into a pair of the key and the value.
static std::string indent(int index)
Create indents.
const Properties * getRoot(void) const
Get root element.
Properties(const char *key="", const char *value="")
Constructor(Create only root node)
void clear(void)
Clear the children.
void store(std::ostream &out, const std::string &header)
Stores property list to the output stream.
static void _propertiyNames(std::vector< std::string > &names, std::string curr_name, const Properties *curr)
Get property name list.
std::vector< std::string > propertyNames(void) const
Return an vector of all the keys in this property.
static bool split(const std::string &str, const char delim, std::vector< std::string > &value)
Split the string.
void list(std::ostream &out)
Prints this property list out to the specified output stream.
const char * getName(void) const
Get Names.
const char * getDefaultValue(void) const
Get default values.
Properties * hasKey(const char *key) const
Check whether key exists in the children.
const std::vector< Properties * > & getLeaf(void) const
Get elements of leaf.
std::string default_value
void setDefaults(const char *defaults[], long num=LONG_MAX)
Set a default value together in the property list.
const std::string & getProperty(const std::string &key) const
Search for the property with the specified key in this property.
const std::string m_empty
Properties *const findNode(const std::string &key) const
Get node of properties.
virtual ~Properties(void)
Destructor.
std::string setProperty(const std::string &key, const std::string &value)
Set a value associated with key in the property list.
bool createNode(const std::string &key)
Create newly node of Properties.
Properties * removeNode(const char *leaf_name)
Remove node of Properties.
void load(std::istream &inStream)
Loads property list that consists of key:value from input stream.
static Properties * _getNode(std::vector< std::string > &keys, std::vector< Properties *>::size_type index, const Properties *curr)
Get properties.
prop
Organization::get_organization_property ();.
const std::string & operator[](const std::string &key) const
Search for the property with the specified key in property list.
static std::ostream & _dump(std::ostream &out, const Properties &curr, int index)
Save property's contents.
static void _store(std::ostream &out, std::string curr_name, Properties *curr)
Store the property name list.
std::vector< Properties * > leaf
Properties & operator=(const Properties &prop)
Assignment operator.
int size(void) const
Get the number of Properties.
const char * getValue(void) const
Get values.
Properties & getNode(const std::string &key)
Get node of properties.
void save(std::ostream &out, const std::string &header)
Save the property list to the specified stream.
Properties & operator<<(const Properties &prop)
Merge properties.
std::string setDefault(const std::string &key, const std::string &value)
Set a default value associated with key in the property list.
Common Object Interface Layer.