Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

dsApprc Class Reference

#include <dsApprc.h>

Inheritance diagram for dsApprc:

dsTranslation Parser List of all members.

Public Methods

 dsApprc ()
 dsApprc (const char *filename)
 dsApprc (std::istream &is)
 ~dsApprc ()
void load (const char *filename)
void load (std::istream &is)
void dump (std::ostream &os)
void set_delimiter (char delim)
void set_xlat (int table)
void add (const char *key, const char *val)
void add (const char *key, int val)
char * seek (const char *key)
char * seek (const char *key, int idx)
void push (const char *key)
void push (int array_key)
void pop ()
int getbool (const char *key)
int getbool (const char *key, int defval)
long getlong (const char *key)
long getlong (const char *key, long defval)
double getdouble (const char *key)
double getdouble (const char *key, double defval)
char * getstring (const char *key)
char * getstring (const char *key, int idx)
char * getstring (const char *key, char *defval)

Protected Methods

int expand_condition (char *cond)
char * expand_var (char *ptr, int *vlen=0)
void _add (char *line)
void _add2 (const char *key, const char *val)
char * trim (char *src)
void undefined_key_exception (const char *key)

Protected Attributes

dsHashTable_h
int _recursion_cnt
char * _keyst
int _kslen
char _key_delim
int _xlat_table

Friends

class dsGetoptMore

Detailed Description

This class is designed to support application resource file with conditional block, variables, and arrays of key. Each variable should be as key=value pair, Server-startup-chdir=Yes you can access it by absolute reference GETB("Server-startup-chdir") or put into stack commopn prefix and then relate them

PUSH("Server");
PUSH("startup");
GETB("-chdir");

It's also possible to use conditional blocks and variables:

Inside your program:
ADD("Debug","Yes");
ADD("TesChdir","No");
Inside resource file:
.if == Yes && == NO
Server-startup-chdir=No
.endif
My-key=/name
My-env-key=/usr/bin:$/usr/local/bin:/usr/X11R6/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/samba/bin:/usr/local/sybase-12.5/bin:/usr/java/j2sdk_nb/j2sdk1.4.2/bin:/home/oracle/products/8.1.7/bin:/usr/local/palmdev/bin:/usr/local/qt/bin:/usr/local/wine/bin:/usr/local/vslick8.01/bin:/usr/local/mysql/bin:/usr/local/kde/bin:/usr/local/cocor
My-array-key[]=button1
My-array-key[]=button2
My-array-key[]=button3


Constructor & Destructor Documentation

dsApprc::dsApprc  
 

Build object, but doesn't load rc file

dsApprc::dsApprc const char *    filename
 

Buid object and load file

Parameters:
filename name of file to load
Exceptions:
keyException thrown if file contains reference to unknown keys

dsApprc::dsApprc std::istream &    is
 

Buid object and load stream

Parameters:
is stream to load
Exceptions:
keyException thrown if file contains reference to unknown keys

dsApprc::~dsApprc  
 


Member Function Documentation

void dsApprc::_add char *    line [protected]
 

void dsApprc::_add2 const char *    key,
const char *    val
[protected]
 

void dsApprc::add const char *    key,
int    val
[inline]
 

Add key and value. Already defined keys will be redefined.

Parameters:
key key to add
value value to add

void dsApprc::add const char *    key,
const char *    val
 

Add key and value. Already defined keys will be redefined.

Parameters:
key key to add
value value to add

void dsApprc::dump std::ostream &    os
 

Output existing keys to stream

Parameters:
os - output stream

int dsApprc::expand_condition char *    cond [protected]
 

char * dsApprc::expand_var char *    ptr,
int *    vlen = 0
[protected]
 

int dsApprc::getbool const char *    key,
int    defval
[inline]
 

Find a key, convert it's value to boolean. Recognised formats Yes/No, True/False,1/0 if key not defined return default value return getbool("Permit", getbool("Permit-default"));

Parameters:
key key to find
defval default value
Returns:
default value

int dsApprc::getbool const char *    key [inline]
 

Find a key, convert it's value to boolean. Recognised formats Yes/No, True/False,1/0 See Also: GETB()

Parameters:
key key to find
Exceptions:
INIException thrown if key not defined

double dsApprc::getdouble const char *    key,
double    defval
[inline]
 

Find a key, convert it's value to double. if key not defined return default value

Parameters:
key key to find
defval default value
Returns:
default value

double dsApprc::getdouble const char *    key [inline]
 

Find a key, convert it's value to double. See Also: GETD()

Parameters:
key key to find
Exceptions:
INIException thrown if key not defined

long dsApprc::getlong const char *    key,
long    defval
[inline]
 

Find a key, convert it's value to long. if key not defined return default value

Parameters:
key key to find
defval default value
Returns:
default value

long dsApprc::getlong const char *    key [inline]
 

Find a key, convert it's value to long. See Also: GETL()

Parameters:
key key to find
Exceptions:
INIException thrown if key not defined

char * dsApprc::getstring const char *    key,
char *    defval
[inline]
 

Find a key, return found value. if key not defined return default value

Parameters:
key key to find
defval default value
Returns:
default value

char * dsApprc::getstring const char *    key,
int    idx
[inline]
 

Find an array key, return found value See Also: GET()

Parameters:
key key to find
idx array index
Exceptions:
INIException thrown if key not defined

char * dsApprc::getstring const char *    key [inline]
 

Find a key, return found value See Also: GET()

Parameters:
key key to find
Exceptions:
INIException thrown if key not defined

void dsApprc::load std::istream &    is
 

Load and parse data from stream already loaded data will be overwritten

Parameters:
is stream to load
Exceptions:
INIException thrown if file contains reference to undefined key

void dsApprc::load const char *    filename
 

Load and parse data from file already loaded data will be overwritten

Parameters:
filename name of file to load
Exceptions:
INIException thrown if file contains reference to undefined key

void dsApprc::pop  
 

Remove topmoust common prefix from stack

Exceptions:
keyException thrown if stack underflow

void dsApprc::push int    array_key
 

Push array index into key stack to refer array item

Parameters:
array_key array index

void dsApprc::push const char *    key
 

Push common prefix into key stack All keys begins from - will refer to stack

Parameters:
key common prefix to push

char * dsApprc::seek const char *    key,
int    idx
 

Find an element of array

Parameters:
key key to find
idx array index
Returns:
pointer to value or NULL if key not defined

char * dsApprc::seek const char *    key
 

Find a key

Parameters:
key key to find
Returns:
pointer to value or NULL if key not defined

void dsApprc::set_delimiter char    delim [inline]
 

Set delemiter of key parts. Default is hiphen '-'

Parameters:
delim delimiter of key parts.

void dsApprc::set_xlat int    table [inline]
 

Set encoding translation, see xlat.h Default is none

Parameters:
xlate_table num of translation table from xlat.h

char * dsApprc::trim char *    src [protected]
 

void dsApprc::undefined_key_exception const char *    key [inline, protected]
 


Friends And Related Function Documentation

friend class dsGetoptMore [friend]
 


Member Data Documentation

dsHashTable* dsApprc::_h [protected]
 

char dsApprc::_key_delim [protected]
 

char* dsApprc::_keyst [protected]
 

int dsApprc::_kslen [protected]
 

int dsApprc::_recursion_cnt [protected]
 

int dsApprc::_xlat_table [protected]
 


The documentation for this class was generated from the following files:
Generated on Mon May 16 18:26:59 2005 for libdms4 by doxygen1.3-rc2