base_config_file.cc File Reference

Functions for a configuration file based on key/value tuples. More...

#include "base.hh"
#include "base_config_file.hh"

Namespaces

namespace  base

Defines

#define BASE_CONFIG_FILE_CC   1
#define CONFIG_FILE_WRITE(MVAL, ETYPE)
#define CONFIG_FILE_READ(MVAL, TYPE)
 Get tuple from STL map.
#define CONFIG_ACCESS

Functions

bool base::CompareTuples (const ConfigFile::ConfigTuple &t1, const ConfigFile::ConfigTuple &t2)

Variables

static const string base::BASE_CONFIG_FILE_VERSION_STR = "(gfx::ConfigFile v2)"


Detailed Description

Functions for a configuration file based on key/value tuples.

Id
LastChangedDate

Author:
Jim E. Brooks http://www.palomino3d.org
Remarks:
Similar to GNOME's gnome_config*(). Documented at base_config_file.hh.

Define Documentation

#define BASE_CONFIG_FILE_CC   1

#define CONFIG_ACCESS

Value:

{                                                                           \
    if ( acc == ConfigFile::eAccess_WRITE )                                 \
        return Write( key, val );                                           \
    else                                                                    \
        return Read( key, val );                                            \
}

#define CONFIG_FILE_READ ( MVAL,
TYPE   ) 

Value:

{                                                                                       \
    if ( ! mValid )                                                                     \
    {                                                                                   \
        CERROR << "ERROR: ConfigFile::Read(): object invalid" << endl;                  \
        return false;                                                                   \
    }                                                                                   \
    if ( mTupleMap.find( key ) != mTupleMap.end() )                                     \
    {                                                                                   \
        CHECK_TYPESIG(&mTupleMap[key],TYPESIG_CONFIG_TUPLE);                            \
        if ( mTupleMap[key].mType == TYPE )                                             \
        {                                                                               \
            val = mTupleMap[key].MVAL;                                                  \
            return true;                                                                \
        }                                                                               \
        else                                                                            \
        {                                                                               \
            CERROR << "ERROR: ConfigFile::Read(): type mismatch" << endl;               \
            return false;                                                               \
        }                                                                               \
    }                                                                                   \
    else                                                                                \
        return false;                                                                   \
}
Get tuple from STL map.

#define CONFIG_FILE_WRITE ( MVAL,
ETYPE   ) 

Value:

{                                                                                       \
    if ( ! mValid )                                                                     \
    {                                                                                   \
        CERROR << "ERROR: ConfigFile::Write(): object invalid" << endl; \
        return false;                                                                   \
    }                                                                                   \
    if ( mTupleMap.find(key) == mTupleMap.end() )                                       \
        mTupleMap[key] = ConfigTuple();                                                 \
    mTupleMap[key].mType = ETYPE;                                                       \
    mTupleMap[key].mKey  = key;                                                         \
    mTupleMap[key].MVAL  = val;                                                         \
    if ( mAutoflush ) return Flush(); else return true;                                 \
}

Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:13 2007