NaviLibrary::NaviData Class Reference

#include <NaviData.h>

List of all members.

Public Member Functions

 NaviData (const std::string &name, const std::string &queryString="")
bool ensure (const std::string &key, bool throwOnFailure=true) const
bool ensure (const std::vector< std::string > &keys, bool throwOnFailure=true) const
std::string getName () const
bool exists (const std::string &keyName) const
const
NaviUtilities::MultiValue
operator[] (const std::string &keyName) const
NaviUtilities::MultiValueoperator[] (const std::string &keyName)
int size () const
std::map
< std::string,
std::string > 
toStringMap (bool encodeVals) const
std::string toQueryString () const


Detailed Description

A map container that holds pairs of named NaviDataValue's. Used for communication between the page of a Navi and the application.

Constructor & Destructor Documentation

NaviData::NaviData ( const std::string &  name,
const std::string &  queryString = "" 
)

Creates a NaviData object.

Parameters:
name The name of the NaviData to create.
queryString A valid Query String with values encoded using encodeURIComponent.


Member Function Documentation

bool NaviData::ensure ( const std::string &  key,
bool  throwOnFailure = true 
) const

Validates whether or not this NaviData contains a certain key.

Parameters:
key The name of the key to look for.
Note:
To additionally validate that the value of the key is numeric, prefix the key with "#".
Parameters:
throwOnFailure Whether or not to throw a Ogre::Exception::ERR_RT_ASSERTION_FAILED on failed validation.
Returns:
Whether or not the key passed validation.

bool NaviData::ensure ( const std::vector< std::string > &  keys,
bool  throwOnFailure = true 
) const

Validates whether or not this NaviData contains a series of keys.

Parameters:
keys A string vector containing the names of the keys to look for.
Note:
To additionally validate that the value of the key is numeric, prefix the key with "#".

It is extremely useful to use NaviUtilities::Strings with this function.

This check can be invoked alternately via the last parameter of NaviManager::bind

Parameters:
throwOnFailure Whether or not to throw a Ogre::Exception::ERR_RT_ASSERTION_FAILED on failed validation.
Returns:
Whether or not all keys passed validation.

std::string NaviData::getName (  )  const

Returns the name of this NaviData.

bool NaviData::exists ( const std::string &  keyName  )  const

Returns whether or not 'keyName' exists within the NaviData.

const MultiValue & NaviData::operator[] ( const std::string &  keyName  )  const

This subscript operator works just like the subscript operator of a map. Returns a reference to a MultiValue object.

Note:
For example:
        // Assignment:
        myNaviData["newKey"] = "Hello, new value.";
        
        // Value retrieval:
        std::string myMessage = myNaviData["newKey"].str(); // myMessage holds "Hello, new value."

MultiValue & NaviData::operator[] ( const std::string &  keyName  ) 

This subscript operator works just like the subscript operator of a map. Returns a reference to a MultiValue object.

Note:
For example:
        // Assignment:
        myNaviData["newKey"] = "Hello, new value.";
        
        // Value retrieval:
        std::string myMessage = myNaviData["newKey"].str(); // myMessage holds "Hello, new value."

int NaviData::size (  )  const

Returns the number of data pairs in this NaviData.

std::map< std::string, std::string > NaviData::toStringMap ( bool  encodeVals  )  const

Retrieves the contents of this NaviData as a string map.

Parameters:
encodeVals Whether or not to encode the values using 'encodeURIComponent' to preserve unicode characters.
Returns:
A string map representing the contents of this NaviData.

std::string NaviData::toQueryString (  )  const

Retrieves the contents of this NaviData as a Query String.

Note:
All values will be encoded using 'encodeURIComponent'.
Returns:
A query string representing the contents of this NaviData.


The documentation for this class was generated from the following files:
Generated on Tue Jun 10 22:33:20 2008 for NaviLibrary by  doxygen 1.5.3