You.i Engine
CYIPersistentStore Class Reference

#include <utility/YiPersistentStore.h>

Inheritance diagram for CYIPersistentStore:

Public Types

enum  STORE_ERROR {
  STORE_ERROR_OK = 0,
  STORE_ERROR_NOT_FOUND,
  STORE_ERROR_CORRUPTED,
  STORE_ERROR_NOT_ENOUGH_SPACE,
  STORE_ERROR_BAD_PARAMETERS,
  STORE_ERROR_UNKNOWN
}
 

Public Member Functions

 CYIPersistentStore (uint64_t uMaxSizeInBytes=0)
 
 CYIPersistentStore (const CYIPersistentStore &rRHS)
 
virtual ~CYIPersistentStore ()
 
CYIPersistentStoreoperator= (const CYIPersistentStore &rRHS)
 
template<typename T >
void Add (const CYIString &Key, const T &value)
 
template<typename T >
bool Find (const CYIString &Key, T *value) const
 
void Remove (const CYIString &key)
 
void Clear ()
 
bool Save (const CYIString &sFile)
 
bool Load (const CYIString &sFile)
 
void RequestSave (const CYIString &sFile)
 
void RequestLoad (const CYIString &sFile)
 
bool Clear (const CYIString &sFile)
 
STORE_ERROR GetLastErrorCode () const
 
- Public Member Functions inherited from CYIScriptableObject
 CYIScriptableObject ()
 
 CYIScriptableObject (const CYIScriptableObject &other)
 
CYIScriptableObjectoperator= (const CYIScriptableObject &other)
 
virtual ~CYIScriptableObject ()
 
CYIBindingImplementationGetBindingImplementation () const
 
void SetBindingImplementation (CYIBindingImplementation *pBindingImplementation)
 
virtual const CYIRuntimeTypeInfoGetRuntimeTypeInfoForScriptObject () const
 

Public Attributes

CYISignal< bool > SaveCompleted
 
CYISignal< bool > LoadCompleted
 

Friends

class IYIPersistentStorePriv
 

Member Enumeration Documentation

Enumerator
STORE_ERROR_OK 
STORE_ERROR_NOT_FOUND 
STORE_ERROR_CORRUPTED 
STORE_ERROR_NOT_ENOUGH_SPACE 
STORE_ERROR_BAD_PARAMETERS 
STORE_ERROR_UNKNOWN 

Constructor & Destructor Documentation

CYIPersistentStore::CYIPersistentStore ( uint64_t  uMaxSizeInBytes = 0)
CYIPersistentStore::CYIPersistentStore ( const CYIPersistentStore rRHS)
virtual CYIPersistentStore::~CYIPersistentStore ( )
virtual

Member Function Documentation

template<typename T >
void CYIPersistentStore::Add ( const CYIString Key,
const T &  value 
)
inline

Add a key-value pair to be saved as application state data. If the provided key already exists in the state data, it is updated with the provided value.

Example: int32_t num = 19; PersistentStore.Add("key", num);

void CYIPersistentStore::Clear ( )

Clear the in-memory state.

bool CYIPersistentStore::Clear ( const CYIString sFile)

Clear the file contents.

template<typename T >
bool CYIPersistentStore::Find ( const CYIString Key,
T *  value 
) const
inline

Retrieve the value for the specified key from the loaded application state. If the key is found, returns true and value is set to the key's corresponding value. Returns false if the key is not found.

 Example:
 int32_t num = 19;
 if(PersistentStore.Find("key", &num))
 {

num will now be set to the key's corresponding value }

STORE_ERROR CYIPersistentStore::GetLastErrorCode ( ) const
bool CYIPersistentStore::Load ( const CYIString sFile)

Synchronous - Load the state data from the specified file.

Note
This method will replace any existing state data with the state data from the file, including any keys in the state data that do not exist in the file.
CYIPersistentStore& CYIPersistentStore::operator= ( const CYIPersistentStore rRHS)
void CYIPersistentStore::Remove ( const CYIString key)

Removes the key-value pair entry associated with the key key.

Example: PersistentStore.Remove("key");

void CYIPersistentStore::RequestLoad ( const CYIString sFile)

Asynchronous - Load the state data from the specified file.

Note
This method will replace any existing state data with the state data from the file, including any keys in the state data that do not exist in the file.
See also
LoadCompleted Signal
void CYIPersistentStore::RequestSave ( const CYIString sFile)

Asynchronous - Save the current state data to the specified file.

See also
SaveCompleted Signal
bool CYIPersistentStore::Save ( const CYIString sFile)

Synchronous - Save the current state data to the specified file.

Friends And Related Function Documentation

friend class IYIPersistentStorePriv
friend

Member Data Documentation

CYISignal<bool> CYIPersistentStore::LoadCompleted

Callback for when the Asynchronous RequestLoad completes

CYISignal<bool> CYIPersistentStore::SaveCompleted

Callback for when the Asynchronous RequestSave Completes


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