UCommon
|
Traditional keypair config file parsing class. More...
#include <keydata.h>
Public Types | |
typedef linked_pointer< keydata > | pointer |
Convenience typedef for iterative pointer. |
Public Member Functions | |
void | assign (keyfile &source) |
Assign foreign pager to us. | |
keydata * | begin (void) const |
Get first keydata object, for iterative examinations. | |
keydata * | end (void) const |
Get last keydata object, for iterative examinations. | |
int | err (void) const |
keydata * | get (const char *section) const |
Get a keydata section name. | |
keydata * | get (void) const |
Get the non-sectioned defaults if there are any. | |
keyfile (const char *path, size_t pagesize=0) | |
Create a key file object from an existing config file. | |
keyfile (const keyfile ©, size_t pagesize=0) | |
keyfile (size_t pagesize=0) | |
Create an empty key file ready for loading. | |
void | load (const char *path) |
Load (overlay) another config file over the currently loaded one. | |
void | load (const keydata *source) |
Load a single set of keys. | |
void | load (const keyfile *source) |
Load from an existing keyfile object. | |
keydata * | operator() (const char *section) const |
keyfile & | operator= (keyfile &source) |
keydata * | operator[] (const char *section) const |
void | release (void) |
Release and re-initialize keyfile. | |
bool | save (const char *path) |
Save (write) a set of config keys to dist. | |
Public Member Functions inherited from ucommon::memalloc | |
void | assign (memalloc &source) |
Assign foreign pager to us. | |
unsigned | max (void) const |
Get the maximum number of pages that are permitted. | |
memalloc (const memalloc ©) | |
memalloc (size_t page=0) | |
Construct a memory pager. | |
unsigned | pages (void) const |
Get the number of pages that have been allocated from the real heap. | |
void | purge (void) |
Purge all allocated memory and heap pages immediately. | |
size_t | size (void) const |
Get the size of a memory page. | |
unsigned | utilization (void) const |
Determine fragmentation level of acquired heap pages. | |
virtual | ~memalloc () |
Destroy a memory pager. |
Protected Member Functions | |
keydata * | create (const char *section) |
Protected Member Functions inherited from ucommon::memalloc | |
virtual void * | _alloc (size_t size) |
Allocate memory from the pager heap. | |
page_t * | pager (void) |
Acquire a new page from the heap. |
Friends | |
class | keydata |
Additional Inherited Members | |
Protected Attributes inherited from ucommon::memalloc | |
unsigned | limit |
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.
ucommon::keyfile::keyfile | ( | size_t | pagesize = 0 | ) |
Create an empty key file ready for loading.
pagesize | for memory paging. |
ucommon::keyfile::keyfile | ( | const char * | path, |
size_t | pagesize = 0 ) |
Create a key file object from an existing config file.
path | to load from. |
pagesize | for memory paging. |
void ucommon::keyfile::assign | ( | keyfile & | source | ) |
Assign foreign pager to us.
This relocates the heap references to our object, clears the other object.
|
inline |
|
inline |
keydata * ucommon::keyfile::get | ( | const char * | section | ) | const |
Get a keydata section name.
section | name to look for. |
|
inline |
void ucommon::keyfile::load | ( | const 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.
path | to load keys from into current object. |
void ucommon::keyfile::load | ( | const keydata * | source | ) |
Load a single set of keys.
source | of keys to copy. |
void ucommon::keyfile::load | ( | const keyfile * | source | ) |
Load from an existing keyfile object.
source | to copy from. |
|
inline |
|
inline |
bool ucommon::keyfile::save | ( | const char * | path | ) |
Save (write) a set of config keys to dist.
path | of file to save keys to. |