#include <include/EST_Option.h>
Public Member Functions | |
void | add_prefix (EST_String prefix) |
add prefix to every key | |
void | remove_prefix (EST_String prefix) |
remove prefix from every key | |
EST_read_status | load (const EST_String &filename, const EST_String &comment=";") |
int | override_val (const EST_String rkey, const EST_String rval) |
add to end of list or overwrite. If rval is empty, do nothing | |
int | override_fval (const EST_String rkey, const float rval) |
add to end of list or overwrite. If rval is empty, do nothing | |
int | override_ival (const EST_String rkey, const int rval) |
add to end of list or overwrite. If rval is empty, do nothing | |
int | ival (const EST_String &rkey, int m=1) const |
double | dval (const EST_String &rkey, int m=1) const |
float | fval (const EST_String &rkey, int m=1) const |
const EST_String & | sval (const EST_String &rkey, int m=1) const |
int | add_iitem (const EST_String &rkey, const int &rval) |
int | add_fitem (const EST_String &rkey, const float &rval) |
Public Member Functions inherited from EST_TKVL< EST_String, EST_String > | |
const int | length () const |
number of key value pairs in list | |
EST_Litem * | head () const |
Return First key value pair in list. | |
void | clear () |
Empty list. | |
const int | present (const EST_String &rkey) const |
Returns true if key is present. | |
void | map (void(*func)(EST_String &, EST_String &)) |
apply function to each pair | |
EST_TKVL< EST_String, EST_String > & | operator= (const EST_TKVL< EST_String, EST_String > &kv) |
full copy of KV list. | |
EST_TKVL< EST_String, EST_String > & | operator+= (const EST_TKVL< EST_String, EST_String > &kv) |
add kv after existing list. | |
EST_TKVL< EST_String, EST_String > | operator+ (const EST_TKVL< EST_String, EST_String > &kv) |
make new concatenated list | |
EST_TKVL () | |
default constructor | |
EST_TKVL (const EST_TKVL< EST_String, EST_String > &kv) | |
copy constructor | |
const EST_String & | val (const EST_String &rkey, bool m=0) const |
return value according to key (const) | |
EST_String & | val (const EST_String &rkey, bool m=0) |
return value according to key (non-const) | |
const EST_String & | val (EST_Litem *ptr, bool m=0) const |
return value according to ptr | |
EST_String & | val (EST_Litem *ptr, bool m=0) |
return value according to ptr | |
const EST_String & | val_def (const EST_String &rkey, const EST_String &def) const |
value or default | |
const EST_String & | key (EST_Litem *ptr, int m=1) const |
find key, reference by ptr | |
EST_String & | key (EST_Litem *ptr, int m=1) |
find key, reference by ptr | |
const EST_String & | key (const EST_String &v, int m=1) const |
return first matching key, referenced by val | |
int | change_val (const EST_String &rkey, const EST_String &rval) |
int | change_val (EST_Litem *ptr, const EST_String &rval) |
int | change_key (EST_Litem *ptr, const EST_String &rkey) |
change name of key pair. | |
int | add_item (const EST_String &rkey, const EST_String &rval, int no_search=0) |
add key-val pair to list | |
int | remove_item (const EST_String &rkey, int quiet=0) |
remove key and val pair from list | |
Friends | |
ostream & | operator<< (ostream &s, const EST_Option &kv) |
print options | |
Additional Inherited Members | |
Public Types inherited from EST_TKVL< EST_String, EST_String > | |
typedef EST_TKVI< EST_String, EST_String > | Entry |
typedef EST_TStructIterator < EST_TKVL< EST_String, EST_String >, IPointer, Entry > | Entries |
typedef EST_TRwStructIterator < EST_TKVL< EST_String, EST_String >, IPointer, Entry > | RwEntries |
typedef EST_String | KeyEntry |
typedef EST_TIterator < EST_TKVL< EST_String, EST_String >, IPointer_k, KeyEntry > | KeyEntries |
typedef EST_TRwIterator < EST_TKVL< EST_String, EST_String >, IPointer_k, KeyEntry > | KeyRwEntries |
Public Attributes inherited from EST_TKVL< EST_String, EST_String > | |
EST_TList< EST_TKVI < EST_String, EST_String > > | list |
Linked list of key-val pairs. Don't use this as it will be made private in the future. | |
Static Public Attributes inherited from EST_TKVL< EST_String, EST_String > | |
static EST_String * | default_val |
default value, returned when there is no such entry. | |
static EST_String * | default_key |
default value, returned when there is no such entry. | |
Protected Member Functions inherited from EST_TKVL< EST_String, EST_String > | |
void | point_to_first (IPointer &ip) const |
void | point_to_first (IPointer_k &ip) const |
void | move_pointer_forwards (IPointer &ip) const |
void | move_pointer_forwards (IPointer_k &ip) const |
bool | points_to_something (const IPointer &ip) const |
bool | points_to_something (const IPointer_k &ip) const |
EST_TKVI< EST_String, EST_String > & | points_at (const IPointer &ip) |
EST_String & | points_at (const IPointer_k &ip) |
Provide a high level interface for String String key value lists.
Definition at line 50 of file EST_Option.h.
EST_read_status EST_Option::load | ( | const EST_String & | filename, |
const EST_String & | comment = ";" |
||
) |
read keyval list from file. The file type is an ascii file
with each line representing one key value pair. The first entry in the line defines the key, and the rest, which may contain whitespaces, defins the value. Lines starting with the comment character are ignored.
Definition at line 138 of file EST_Option.cc.
int EST_Option::ival | ( | const EST_String & | rkey, |
int | m = 1 |
||
) | const |
return value of type int relating to key. By default, an error occurs if the key is not present. Use m=0 if to get a dummy value returned if key is not present
Definition at line 76 of file EST_Option.cc.
double EST_Option::dval | ( | const EST_String & | rkey, |
int | m = 1 |
||
) | const |
return value of type float relating to key. By default, an error occurs if the key is not present. Use m=0 if to get a dummy value returned if key is not present
Definition at line 109 of file EST_Option.cc.
float EST_Option::fval | ( | const EST_String & | rkey, |
int | m = 1 |
||
) | const |
return value of type float relating to key. By default, an error occurs if the key is not present. Use m=0 if to get a dummy value returned if key is not present
Definition at line 98 of file EST_Option.cc.
const EST_String & EST_Option::sval | ( | const EST_String & | rkey, |
int | m = 1 |
||
) | const |
return value of type String relating to key. By default, an error occurs if the key is not present. Use m=0 if to get a dummy value returned if key is not present
Definition at line 87 of file EST_Option.cc.
int EST_Option::add_iitem | ( | const EST_String & | rkey, |
const int & | rval | ||
) |
return value of type String relating to key. By default, an error occurs if the key is not present. Use m=0 if to get a dummy value returned if key is not present
Definition at line 120 of file EST_Option.cc.