newspeoplefor developersdocumentationdownloads

nPrefServer Class Reference
[Miscellaneous Subsystems]

#include <nprefserver.h>

Inheritance diagram for nPrefServer:

nRoot nObject nNode nReferenced nSignalEmitter nIniPrefServer nWin32PrefServer List of all members.

Detailed Description

The pref server stores key/value pairs in a location where it will persist between application invocations (for instance by using the registry under Win32).

NOTE: the interesting stuff happens in platform-specific subclasses.

NOTE #2: it may be advisory to only open and close the nPrefServer right before/after writing/reading key/value pairs. Some implementations might open/close the registry, or ini files between open/close. To prevent excessively long locks on those resources you should try to keep the prefs server open for as short periods as possible.

(C) 2004 RadonLabs GmbH

Definition at line 26 of file nprefserver.h.


Public Member Functions

 nPrefServer ()
 constructor
virtual ~nPrefServer ()
 destructor
void SetCompanyName (const nString &n)
 set company name
const nStringGetCompanyName () const
 get company name
void SetApplicationName (const nString &n)
 set application name
const nStringGetApplicationName () const
 get application name
virtual bool Open ()
 open the preferences server
virtual void Close ()
 close the preferences server
virtual bool KeyExists (const nString &key)
 check if a key exists
bool IsOpen () const
 return true if server is open
bool WriteString (const nString &key, const nString &value)
 write a string value
bool WriteInt (const nString &key, int value)
 write an integer value
bool WriteFloat (const nString &key, float value)
 write a float value
bool WriteBool (const nString &key, bool value)
 write a bool value
bool WriteVector4 (const nString &key, const vector4 &value)
 write a vector4 value
bool WriteVector3 (const nString &key, const vector3 &value)
 write a vector3 value
nString ReadString (const nString &key)
 read a string value
int ReadInt (const nString &key)
 read an integer value
float ReadFloat (const nString &key)
 read a float value
bool ReadBool (const nString &key)
 read a bool value
vector4 ReadVector4 (const nString &key)
 read a vector4 value
vector3 ReadVector3 (const nString &key)
 read a vector3 value

Static Public Member Functions

static nPrefServerInstance ()
 return singleton instance pointer

Protected Member Functions

virtual bool WriteGeneric (const nString &key, const nString &value)
 write a generic value in string form
virtual nString ReadGeneric (const nString &key)
 read a generic value in string form

Protected Attributes

nString companyName
nString appName
bool isOpen
bool isWriting
bool isReading

Constructor & Destructor Documentation

nPrefServer::nPrefServer  ) 
 

constructor

Definition at line 14 of file nprefserver_main.cc.

nPrefServer::~nPrefServer  )  [virtual]
 

destructor

Definition at line 24 of file nprefserver_main.cc.


Member Function Documentation

nPrefServer * nPrefServer::Instance  )  [inline, static]
 

return singleton instance pointer

Definition at line 97 of file nprefserver.h.

void nPrefServer::SetCompanyName const nString n  )  [inline]
 

set company name

Definition at line 118 of file nprefserver.h.

const nString & nPrefServer::GetCompanyName  )  const [inline]
 

get company name

Definition at line 128 of file nprefserver.h.

void nPrefServer::SetApplicationName const nString n  )  [inline]
 

set application name

Definition at line 138 of file nprefserver.h.

const nString & nPrefServer::GetApplicationName  )  const [inline]
 

get application name

Definition at line 148 of file nprefserver.h.

bool nPrefServer::Open  )  [virtual]
 

open the preferences server

Reimplemented in nIniPrefServer, and nWin32PrefServer.

Definition at line 38 of file nprefserver_main.cc.

void nPrefServer::Close  )  [virtual]
 

close the preferences server

Reimplemented in nIniPrefServer, and nWin32PrefServer.

Definition at line 52 of file nprefserver_main.cc.

bool nPrefServer::KeyExists const nString key  )  [virtual]
 

check if a key exists

Reimplemented in nIniPrefServer, and nWin32PrefServer.

Definition at line 223 of file nprefserver_main.cc.

bool nPrefServer::IsOpen  )  const [inline]
 

return true if server is open

Definition at line 108 of file nprefserver.h.

bool nPrefServer::WriteString const nString key,
const nString value
 

write a string value

Definition at line 62 of file nprefserver_main.cc.

bool nPrefServer::WriteInt const nString key,
int  value
 

write an integer value

Definition at line 71 of file nprefserver_main.cc.

bool nPrefServer::WriteFloat const nString key,
float  value
 

write a float value

Definition at line 82 of file nprefserver_main.cc.

bool nPrefServer::WriteBool const nString key,
bool  value
 

write a bool value

Definition at line 93 of file nprefserver_main.cc.

bool nPrefServer::WriteVector4 const nString key,
const vector4 value
 

write a vector4 value

Definition at line 109 of file nprefserver_main.cc.

bool nPrefServer::WriteVector3 const nString key,
const vector3 value
 

write a vector3 value

Definition at line 120 of file nprefserver_main.cc.

nString nPrefServer::ReadString const nString key  ) 
 

read a string value

Definition at line 131 of file nprefserver_main.cc.

int nPrefServer::ReadInt const nString key  ) 
 

read an integer value

Definition at line 140 of file nprefserver_main.cc.

float nPrefServer::ReadFloat const nString key  ) 
 

read a float value

Definition at line 149 of file nprefserver_main.cc.

bool nPrefServer::ReadBool const nString key  ) 
 

read a bool value

Definition at line 158 of file nprefserver_main.cc.

vector4 nPrefServer::ReadVector4 const nString key  ) 
 

read a vector4 value

Definition at line 167 of file nprefserver_main.cc.

vector3 nPrefServer::ReadVector3 const nString key  ) 
 

read a vector3 value

Definition at line 185 of file nprefserver_main.cc.

bool nPrefServer::WriteGeneric const nString key,
const nString value
[protected, virtual]
 

write a generic value in string form

Reimplemented in nIniPrefServer, and nWin32PrefServer.

Definition at line 202 of file nprefserver_main.cc.

nString nPrefServer::ReadGeneric const nString key  )  [protected, virtual]
 

read a generic value in string form

Reimplemented in nIniPrefServer, and nWin32PrefServer.

Definition at line 212 of file nprefserver_main.cc.


Member Data Documentation

nString nPrefServer::companyName [protected]
 

Definition at line 85 of file nprefserver.h.

nString nPrefServer::appName [protected]
 

Definition at line 86 of file nprefserver.h.

bool nPrefServer::isOpen [protected]
 

Definition at line 87 of file nprefserver.h.

bool nPrefServer::isWriting [protected]
 

Definition at line 88 of file nprefserver.h.

bool nPrefServer::isReading [protected]
 

Definition at line 89 of file nprefserver.h.


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

Copyright © 1999-2005 by the contributing authors. Ideas, requests, problems: Send feedback.