Edinburgh Speech Tools  2.1-release
EST_Option Class Reference

#include <include/EST_Option.h>

Inheritance diagram for EST_Option:
Collaboration diagram for EST_Option:

Public Member Functions

void add_prefix (EST_String prefix)
 add prefix to every key More...
 
void remove_prefix (EST_String prefix)
 remove prefix from every key More...
 
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 More...
 
int override_fval (const EST_String rkey, const float rval)
 add to end of list or overwrite. If rval is empty, do nothing More...
 
int override_ival (const EST_String rkey, const int rval)
 add to end of list or overwrite. If rval is empty, do nothing More...
 
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_Stringsval (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 >
int length () const
 number of key value pairs in list More...
 
EST_Litemhead () const
 Return First key value pair in list. More...
 
void clear ()
 Empty list. More...
 
int present (const EST_String &rkey) const
 Returns true if key is present. More...
 
void map (void(*func)(EST_String &, EST_String &))
 apply function to each pair More...
 
EST_TKVL< EST_String, EST_String > & operator= (const EST_TKVL< EST_String, EST_String > &kv)
 full copy of KV list. More...
 
EST_TKVL< EST_String, EST_String > & operator+= (const EST_TKVL< EST_String, EST_String > &kv)
 add kv after existing list. More...
 
EST_TKVL< EST_String, EST_Stringoperator+ (const EST_TKVL< EST_String, EST_String > &kv)
 make new concatenated list More...
 
 EST_TKVL ()
 default constructor More...
 
 EST_TKVL (const EST_TKVL< EST_String, EST_String > &kv)
 copy constructor More...
 
const EST_Stringval (const EST_String &rkey, bool m=0) const
 return value according to key (const) More...
 
EST_Stringval (const EST_String &rkey, bool m=0)
 return value according to key (non-const) More...
 
const EST_Stringval (EST_Litem *ptr, bool m=0) const
 return value according to ptr More...
 
EST_Stringval (EST_Litem *ptr, bool m=0)
 return value according to ptr More...
 
const EST_Stringval_def (const EST_String &rkey, const EST_String &def) const
 value or default More...
 
const EST_Stringkey (EST_Litem *ptr, int m=1) const
 find key, reference by ptr More...
 
EST_Stringkey (EST_Litem *ptr, int m=1)
 find key, reference by ptr More...
 
const EST_Stringkey (const EST_String &v, int m=1) const
 return first matching key, referenced by val More...
 
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. More...
 
int add_item (const EST_String &rkey, const EST_String &rval, int no_search=0)
 add key-val pair to list More...
 
int remove_item (const EST_String &rkey, int quiet=0)
 remove key and val pair from list More...
 

Friends

ostream & operator<< (ostream &s, const EST_Option &kv)
 print options More...
 

Additional Inherited Members

- Public Types inherited from EST_TKVL< EST_String, EST_String >
typedef EST_TKVI< EST_String, EST_StringEntry
 
typedef EST_TStructIterator< EST_TKVL< EST_String, EST_String >, IPointer, EntryEntries
 
typedef EST_TRwStructIterator< EST_TKVL< EST_String, EST_String >, IPointer, EntryRwEntries
 
typedef EST_String KeyEntry
 
typedef EST_TIterator< EST_TKVL< EST_String, EST_String >, IPointer_k, KeyEntryKeyEntries
 
typedef EST_TRwIterator< EST_TKVL< EST_String, EST_String >, IPointer_k, KeyEntryKeyRwEntries
 
- 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. More...
 
- Static Public Attributes inherited from EST_TKVL< EST_String, EST_String >
static EST_Stringdefault_val
 default value, returned when there is no such entry. More...
 
static EST_Stringdefault_key
 default value, returned when there is no such entry. More...
 
- 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_Stringpoints_at (const IPointer_k &ip)
 

Detailed Description

Provide a high level interface for String String key value lists.

Definition at line 50 of file EST_Option.h.

Member Function Documentation

void EST_Option::add_prefix ( EST_String  prefix)

add prefix to every key

Definition at line 176 of file EST_Option.cc.

void EST_Option::remove_prefix ( EST_String  prefix)

remove prefix from every key

Definition at line 184 of file EST_Option.cc.

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.

Returns
returns EST_read_status errors,
See also

Definition at line 144 of file EST_Option.cc.

int EST_Option::override_val ( const EST_String  rkey,
const EST_String  rval 
)

add to end of list or overwrite. If rval is empty, do nothing

Definition at line 54 of file EST_Option.cc.

int EST_Option::override_fval ( const EST_String  rkey,
const float  rval 
)

add to end of list or overwrite. If rval is empty, do nothing

Definition at line 62 of file EST_Option.cc.

int EST_Option::override_ival ( const EST_String  rkey,
const int  rval 
)

add to end of list or overwrite. If rval is empty, do nothing

Definition at line 72 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 82 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 115 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 104 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 93 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 126 of file EST_Option.cc.

int EST_Option::add_fitem ( const EST_String rkey,
const float &  rval 
)

Definition at line 133 of file EST_Option.cc.

Friends And Related Function Documentation

ostream& operator<< ( ostream &  s,
const EST_Option kv 
)
friend

print options

Definition at line 189 of file EST_Option.cc.


The documentation for this class was generated from the following files: