Edinburgh Speech Tools 2.4-release
Loading...
Searching...
No Matches
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
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_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)
 EST_TKVL ()
 default constructor
 EST_TKVL (const EST_TKVL< EST_String, EST_String > &kv)
 copy constructor
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 EST_Stringval (const EST_String &rkey, bool m=0) const
 return value according to key (const)
EST_Stringval (const EST_String &rkey, bool m=0)
 return value according to key (non-const)
const EST_Stringval (EST_Litem *ptr, bool m=0) const
 return value according to ptr
EST_Stringval (EST_Litem *ptr, bool m=0)
 return value according to ptr
const EST_Stringval_def (const EST_String &rkey, const EST_String &def) const
 value or default
const EST_Stringkey (EST_Litem *ptr, int m=1) const
 find key, reference by ptr
EST_Stringkey (EST_Litem *ptr, int m=1)
 find key, reference by ptr
const EST_Stringkey (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
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_Stringoperator+ (const EST_TKVL< EST_String, EST_String > &kv)
 make new concatenated list

Friends

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

Additional Inherited Members

typedef EST_TKVI< EST_String, EST_StringEntry
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
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 EST_Stringdefault_val
 default value, returned when there is no such entry.
static EST_Stringdefault_key
 default value, returned when there is no such entry.
void point_to_first (IPointer &ip) const
void move_pointer_forwards (IPointer &ip) const
bool points_to_something (const IPointer &ip) const
EST_TKVI< EST_String, EST_String > & points_at (const IPointer &ip)
void point_to_first (IPointer_k &ip) const
void move_pointer_forwards (IPointer_k &ip) const
bool points_to_something (const IPointer_k &ip) const
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

◆ add_prefix()

void EST_Option::add_prefix ( EST_String prefix)

add prefix to every key

Definition at line 170 of file EST_Option.cc.

◆ remove_prefix()

void EST_Option::remove_prefix ( EST_String prefix)

remove prefix from every key

Definition at line 178 of file EST_Option.cc.

◆ load()

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 138 of file EST_Option.cc.

◆ override_val()

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 48 of file EST_Option.cc.

◆ override_fval()

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 56 of file EST_Option.cc.

◆ override_ival()

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 66 of file EST_Option.cc.

◆ ival()

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.

◆ dval()

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.

◆ fval()

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.

◆ sval()

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.

◆ add_iitem()

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.

◆ add_fitem()

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

Definition at line 127 of file EST_Option.cc.

◆ operator<<

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

print options

Definition at line 183 of file EST_Option.cc.


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