The Nebula Device 3: BaseGameFeature::UserProfile Class Reference

The Nebula Device 3

BaseGameFeature::UserProfile Class Reference

#include <userprofile.h>

Inheritance diagram for BaseGameFeature::UserProfile:

Core::RefCounted

Detailed Description

A user profile represents a storage where all user specific data is kept across application restarts. This usually includes save games, options, and other per-user data. Mangalore applications should at least support a default profile, but everything is there to support more then one user profile.

User profiles are stored in "user:[appname]/profiles/[profilename]".

(C) 2007 Radon Labs GmbH

Public Member Functions

 UserProfile ()
 constructor
virtual ~UserProfile ()
 destructor
void SetName (const Util::String &n)
 set the name of the user profile
const Util::StringGetName () const
 get the name of the user profile
virtual void SetToDefault ()
 set the user profile to its default state, override in subclass
virtual bool Load (const Util::String &path="")
 load the profile data
virtual bool Save ()
 save to disk
bool IsLoaded () const
 currently loaded?
Util::String GetProfileDirectory () const
 get the filesystem path to the user profile directory
Util::String GetSaveGameDirectory () const
 get the filesystem path to the savegame directory
Util::String GetDatabasePath () const
 get path to world database
Util::String GetSaveGamePath (const Util::String &saveGameName) const
 get path to a complete savegame
bool HasAttr (const Util::String &name) const
 return true if attribute exists in the profile
void SetString (const Util::String &name, const Util::String &val)
 set a string attribute in the profile
void SetInt (const Util::String &name, int val)
 set an int attribute in the profile
void SetFloat (const Util::String &name, float val)
 set a float attribute in the profile
void SetBool (const Util::String &name, bool val)
 set a bool attribute in the profile
void SetFloat4 (const Util::String &name, const Math::float4 &val)
 set a float4 attribute in the profile
Util::String GetString (const Util::String &name) const
 get string attribute from the profile
int GetInt (const Util::String &name) const
 get int attribute from the profile
float GetFloat (const Util::String &name) const
 get float attribute from the profile
bool GetBool (const Util::String &name) const
 get bool attribute from the profile
Math::float4 GetFloat4 (const Util::String &name) const
 get float4 attribute from the profile
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Static Public Member Functions

static Util::Array< Util::StringEnumProfiles ()
 static method to enumerate all existing user profiles
static void DeleteProfile (const Util::String &name)
 static method to delete an existing user profile by name
static Util::String GetProfileRootDirectory ()
 static method which returns a path to the profile root directory
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

Member Function Documentation

Util::Array< Util::String > BaseGameFeature::UserProfile::EnumProfiles (  )  [static]

static method to enumerate all existing user profiles

This is a static method which returns the names of all user profiles which currently exist on disk.

void BaseGameFeature::UserProfile::DeleteProfile ( const Util::String name  )  [static]

static method to delete an existing user profile by name

This static method deletes an existing user profile on disk.

Util::String BaseGameFeature::UserProfile::GetProfileRootDirectory (  )  [static]

static method which returns a path to the profile root directory

This static method returns the path to the profiles root directory for this application.

void BaseGameFeature::UserProfile::SetToDefault (  )  [virtual]

set the user profile to its default state, override in subclass

Set the user profile to its default state. This is empty in the base class but should be overriden to something meaningful in application specific subclasses.

bool BaseGameFeature::UserProfile::Load ( const Util::String path = ""  )  [virtual]

load the profile data

Load the profile data from disk file.

bool BaseGameFeature::UserProfile::Save (  )  [virtual]

save to disk

Close the profile. This will save the profile back to disc.

Util::String BaseGameFeature::UserProfile::GetProfileDirectory (  )  const

get the filesystem path to the user profile directory

Returns the path to the user's profile directory using the Nebula3 filesystem path conventions.

Util::String BaseGameFeature::UserProfile::GetSaveGameDirectory (  )  const

get the filesystem path to the savegame directory

Returns the path to the user's savegame directory (inside the profile directory) using the Nebula3 filesystem path conventions.

Util::String BaseGameFeature::UserProfile::GetDatabasePath (  )  const

get path to world database

Returns the path to the current world database.

Util::String BaseGameFeature::UserProfile::GetSaveGamePath ( const Util::String saveGameName  )  const

get path to a complete savegame

Get the complete filename to a savegame file.

bool BaseGameFeature::UserProfile::HasAttr ( const Util::String name  )  const

return true if attribute exists in the profile

return true if attribute exists in the profile

int Core::RefCounted::GetRefCount (  )  const [inline, inherited]

get the current refcount

Return the current refcount of the object.

void Core::RefCounted::AddRef (  )  [inline, inherited]

increment refcount by one

Increment the refcount of the object.

void Core::RefCounted::Release (  )  [inline, inherited]

decrement refcount and destroy object if refcount is zero

Decrement the refcount and destroy object if refcount is zero.

const Util::String & Core::RefCounted::GetClassName (  )  const [inline, inherited]

get the class name

Get the class name of the object.

Util::FourCC Core::RefCounted::GetClassFourCC (  )  const [inline, inherited]

get the class FourCC code

Get the class FourCC of the object.

void Core::RefCounted::DumpRefCountingLeaks (  )  [static, inherited]

dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

This method should be called as the very last before an application exits.