|
cgv
|
A convenience class for compiling strings of delimited key-value pairs useful for defining GUI control options. More...
#include <property_string.h>
Public Member Functions | |
| property_string (const std::string &key_value_delimiter="=", const std::string &property_delimiter=";") | |
| Construct a new empty property string using the given delimiters. | |
| bool | empty () const |
| Check if empty. | |
| void | clear () |
| Clear content. | |
| template<typename T > | |
| void | add (const std::string &key, T value) |
| Add key-value pair to end of content, converting value to string. | |
| template<typename T > | |
| void | add_bracketed (const std::string &key, const T value, char bracket='\'') |
| See add. | |
| template<typename T > | |
| void | add_bracketed (const std::string &key, const T value, char opening_bracket, char closing_bracket) |
| See add. | |
| operator std::string () const | |
| Implicit conversion to std::string. | |
A convenience class for compiling strings of delimited key-value pairs useful for defining GUI control options.
Both the key-value and the pair delimiters can be set separately. Instances of this class are implicitly convertible to string.
Usage: cgv::gui::property_string options; // using default delimiters options.add("width", 100); options.add("active", "true"); options.add_bracketed("label", "Example");
// use as string with implicit conversion std::string str = options;
Results in: "width=100;active=true;label='Example'"
Definition at line 24 of file property_string.h.
|
inline |
Construct a new empty property string using the given delimiters.
| key_value_delimiter | The delimiter used between key and value. |
| property_delimiter | The delimiter used between key-value pairs (properties). |
Definition at line 105 of file property_string.h.
|
inline |
Add key-value pair to end of content, converting value to string.
| T | The value type. |
| key | The key string. |
| value | The value. |
Definition at line 126 of file property_string.h.
Referenced by cgv::gui::directory_helper::create_gui(), and cgv::gui::file_helper::create_gui().
|
inline |
See add.
Enclose value in given bracket.
| T | The value type. |
| key | The key string. |
| value | The value. |
| bracket | The bracket character used to enclose the value. |
Definition at line 137 of file property_string.h.
Referenced by cgv::gui::directory_helper::create_gui(), and cgv::gui::file_helper::create_gui().
|
inline |
See add.
Enclose value in given bracket.
| T | The value type. |
| key | The key string. |
| value | The value. |
| bracket | The bracket character used to enclose the value. |
Definition at line 149 of file property_string.h.
|
inline |
Clear content.
Definition at line 116 of file property_string.h.
|
inline |
Check if empty.
Definition at line 111 of file property_string.h.
|
inline |
Implicit conversion to std::string.
Definition at line 155 of file property_string.h.