C++ API Library Reference  4.3.2-74-ge1d4cca
Public Functions | List of all members
TypelessStateLock Class Reference

The TypelessStateLock class provides methods to interact with the PureWeb application state, once you have acquired a state lock (see AcquireLock).

When referring to a value in the application state tree, provide the entire path (except for the root element, which should be omitted), dividing each level using a slash, for example: /MainPage/TabX/ControlName. The path can also contain conditional operators:

Public Functions

Typeless Element (String const &path, bool allowCreate=true)
 
Typeless Element (String const &path) const
 
Nullable< String > const & GetValue (String const &path) const
 
template<typename T >
GetValueAs (String const &path) const
 
template<typename T >
GetValueAs (String const &path, T const &defaultValue) const
 
bool IsLocked () const
 
Nullable< String > const & operator[] (String const &path) const
 
Typeless & Root ()
 
Typeless const & Root () const
 
void SetValue (String const &path, Nullable< String > const &value)
 
void SetValue (String const &path, String const &value)
 
template<typename T >
void SetValueAs (String const &path, T const &value)
 
TypelessState & State ()
 
TypelessState const & State () const
 
String ToString (const Xml::TypelessXmlWriterOptions &options=Xml::TypelessXmlWriterOptions::Default()) const
 
Constructors and Destructors
 TypelessStateLock ()
 
 ~TypelessStateLock ()
 
 TypelessStateLock (TypelessStateLock const &other)
 

Usage Description

Typeless Element ( String const &  path,
bool  allowCreate = true 
)
inline

Returns a copy of the application state element at the specified path, or returns Typeless::Empty() if the following two conditions are met:

  • the element does not exist, and
  • the allowCreate flag is set to false.
Typeless Element ( String const &  path) const
inline

Returns the application state element at the specified path, or Typeless::Empty() if the element does not exist.

Nullable<String> const& GetValue ( String const &  path) const
inline

Returns the value of the element at the specified path in the application state tree. Will return null if the element does not exist.

T GetValueAs ( String const &  path) const
inline

Returns the value of the element at the specified path in the application state tree. The value will be returned in the specified data type. Will throw an InvalidCastException if the value does not exist or cannot be converted.

T GetValueAs ( String const &  path,
T const &  defaultValue 
) const
inline

Returns the value of the element at the specified path in the application state tree. The value will be returned in the specified data type. Will throw an InvalidCastException if the value does not exist or cannot be converted.

bool IsLocked ( ) const
inline

Returns a boolean value that indicates whether the lock is actually locked.

Nullable<String> const& operator[] ( String const &  path) const
inline

Returns the value of the element at the specified path in the application state tree. Will return null if the element does not exist.

Typeless& Root ( )
inline

Returns the root element of the application state tree.

Typeless const& Root ( ) const
inline

Returns a constant reference to the root element of the application state tree.

void SetValue ( String const &  path,
Nullable< String > const &  value 
)
inline

Sets the value of the element at the specified path in the application state tree.

void SetValue ( String const &  path,
String const &  value 
)
inline

Sets the value of the element at the specified path in the application state tree.

void SetValueAs ( String const &  path,
T const &  value 
)
inline

Sets the value of the element at the specified path in the application state tree.

TypelessState& State ( )
inline

Returns the entire application state tree.

TypelessState const& State ( ) const
inline

Returns a constant reference to the application state.

String ToString ( const Xml::TypelessXmlWriterOptions &  options = Xml::TypelessXmlWriterOptions::Default()) const

Returns the entire application state tree, expressed as a string.