ucommon::keyfile Class Reference

Traditional keypair config file parsing class. More...

#include <keydata.h>

Inheritance diagram for ucommon::keyfile:

Inheritance graph
[legend]
Collaboration diagram for ucommon::keyfile:

Collaboration graph
[legend]

Public Types

typedef linked_pointer< keydata > iterator
 Convenience typedef for iterative pointer.

Public Member Functions

keydata * begin (void)
 Get first keydata object, for iterative examinations.
keydata * end (void)
 Get last keydata object, for iterative examinations.
int err (void)
keydata * get (void)
 Get the non-sectioned defaults if there are any.
keydata * get (char *section)
 Get a keydata section name.
 keyfile (keyfile &copy, size_t pagesize=0)
 keyfile (char *path, size_t pagesize=0)
 Create a key file object from an existing config file.
 keyfile (size_t pagesize=0)
 Create an empty key file ready for loading.
void load (keydata *source)
 Load a single set of keys.
void load (keyfile *source)
 Load from an existing keyfile object.
void load (char *path)
 Load (overlay) another config file over the currently loaded one.
keydata * operator() (char *section)
keydata * operator[] (char *section)
void release (void)
 Release and re-initialize keyfile.
bool save (char *path)
 Save (write) a set of config keys to dist.

Protected Member Functions

keydata * create (char *section)

Friends

class keydata

Detailed Description

Traditional keypair config file parsing class.

This is used to get generic config data either from a /etc/xxx.conf, a windows style xxx.ini file, or a ~/.xxxrc file, and parses [] sections from the entire file at once.

Definition at line 150 of file keydata.h.


Constructor & Destructor Documentation

ucommon::keyfile::keyfile ( size_t  pagesize = 0  ) 

Create an empty key file ready for loading.

Parameters:
pagesize for memory paging.

ucommon::keyfile::keyfile ( char *  path,
size_t  pagesize = 0 
)

Create a key file object from an existing config file.

Parameters:
path to load from.
pagesize for memory paging.


Member Function Documentation

keydata* ucommon::keyfile::begin ( void   )  [inline]

Get first keydata object, for iterative examinations.

Returns:
first key value in chain.

Definition at line 238 of file keydata.h.

keydata* ucommon::keyfile::end ( void   )  [inline]

Get last keydata object, for iterative examinations.

Returns:
first key value in chain.

Definition at line 245 of file keydata.h.

keydata* ucommon::keyfile::get ( void   )  [inline]

Get the non-sectioned defaults if there are any.

Returns:
default key section.

Definition at line 231 of file keydata.h.

keydata* ucommon::keyfile::get ( char *  section  ) 

Get a keydata section name.

Parameters:
section name to look for.
Returns:
keydata section object if found, NULL if not.

void ucommon::keyfile::load ( keydata *  source  ) 

Load a single set of keys.

Parameters:
source of keys to copy.

void ucommon::keyfile::load ( keyfile *  source  ) 

Load from an existing keyfile object.

Parameters:
source to copy from.

void ucommon::keyfile::load ( char *  path  ) 

Load (overlay) another config file over the currently loaded one.

This is used to merge key data, such as getting default values from a global config, and then overlaying a local home config file.

Parameters:
path to load keys from into current object.

bool ucommon::keyfile::save ( char *  path  ) 

Save (write) a set of config keys to dist.

Parameters:
path of file to save keys to.
Returns:
true on success.


The documentation for this class was generated from the following file:
Generated on 14 Aug 2013 for UCommon by  doxygen 1.4.7