pcce::Variant Class Reference

Variant class that can store a single value of many types. More...

#include <Variant.h>

List of all members.

Public Member Functions

 Variant ()
 Default constructor, creates an empty Variant.
 Variant (const tVariant value)
 Constructs a new Variant with the given tVariant value.
 Variant (const int value)
 Constructs a new Variant with the given int value.
 Variant (const unsigned int value)
 Constructs a new Variant with the given unsigned int value.
 Variant (const long int value)
 Constructs a new Variant with the given long int value.
 Variant (const unsigned long int value)
 Constructs a new Variant with the given unsigned long int value.
 Variant (const tReal value)
 Constructs a new Variant with the given tReal value.
 Variant (const char value)
 Constructs a new Variant with the given char value.
 Variant (const unsigned char value)
 Constructs a new Variant with the given unsigned char value.
 Variant (const std::string value)
 Constructs a new Variant with the given string value.
 Variant (const char *value)
 Constructs a new Variant with the given const char* value.
 Variant (const tPropertyBagPtr value)
 Constructs a new Variant with the given tPropertyBagPtr.
bool HasValue () const
 Returns true if the Variant has a value (i.e. is not empty).
void Clear ()
 Clears the Variant's value.
tVariant Get () const
 Returns the Variant's value.
void Set (tVariant value)
 Sets the Variant's value.
int AsInt () const
 Returns the Variant's value as an int.
bool AsBool () const
 Returns the Variant's value as a bool.
unsigned int AsUnsignedInt () const
 Returns the Variant's value as an unsigned int.
long int AsLongInt () const
 Returns the Variant's value as a long int.
unsigned long int AsUnsignedLongInt () const
 Returns the Variant's value as an unsigned long int.
tReal AsReal () const
 Returns the Variant's value as a tReal.
char AsChar () const
 Returns the Variant's value as a char.
unsigned char AsUnsignedChar () const
 Returns the Variant's value as an unsigned char.
std::string AsString () const
 Returns the Variant's value as a string.
tPropertyBagPtr AsPropertyBagPtr () const
 Returns the Variant's value as a tPropertyBagPtr.
bool IsInt () const
 Returns true if tVariant value can be converted to an int.
bool IsBool () const
 Returns true if tVariant value can be converted to a bool.
bool IsUnsignedInt () const
 Returns true if tVariant value can be converted to an unsigned int.
bool IsLongInt () const
 Returns true if tVariant value can be converted to a long int.
bool IsUnsignedLongInt () const
 Returns true if tVariant value can be converted to an unsigned long int.
bool IsReal () const
 Returns true if tVariant value can be converted to a tReal.
bool IsChar () const
 Returns true if tVariant value can be converted to a char.
bool IsUnsignedChar () const
 Returns true if tVariant value can be converted to an unsigned char.
bool IsString () const
 Returns true if tVariant value can be converted to a string.
bool IsPropertyBagPtr () const
 Returns true if tVariant value can be converted to a tPropertyBagPtr.

Private Attributes

bool mHasValue
tVariant mValue


Detailed Description

Variant class that can store a single value of many types.

This variant class allows the user to store a single value from the tVariant and convert freely between them using a string stream. A Variant may also be empty, which can be checked using Variant::HasValue().

Definition at line 64 of file Variant.h.


Constructor & Destructor Documentation

Variant::Variant (  ) 

Default constructor, creates an empty Variant.

Definition at line 103 of file Variant.cpp.

00103                 : mHasValue(false), mValue(0) {
00104 }

Variant::Variant ( const tVariant  value  ) 

Constructs a new Variant with the given tVariant value.

Definition at line 106 of file Variant.cpp.

00106                                     : mHasValue(true), mValue(value) {
00107 }

Variant::Variant ( const int  value  ) 

Constructs a new Variant with the given int value.

Definition at line 109 of file Variant.cpp.

00109                                : mHasValue(true), mValue(value) {
00110 }

Variant::Variant ( const unsigned int  value  ) 

Constructs a new Variant with the given unsigned int value.

Definition at line 112 of file Variant.cpp.

00112                                         : mHasValue(true), mValue(value) {
00113 }

Variant::Variant ( const long int  value  ) 

Constructs a new Variant with the given long int value.

Definition at line 115 of file Variant.cpp.

00115                                     : mHasValue(true), mValue(value) {
00116 }

Variant::Variant ( const unsigned long int  value  ) 

Constructs a new Variant with the given unsigned long int value.

Definition at line 118 of file Variant.cpp.

00118                                              : mHasValue(true), mValue(value) {
00119 }

Variant::Variant ( const tReal  value  ) 

Constructs a new Variant with the given tReal value.

Definition at line 121 of file Variant.cpp.

00121                                  : mHasValue(true), mValue(value) {
00122 }

Variant::Variant ( const char  value  ) 

Constructs a new Variant with the given char value.

Definition at line 124 of file Variant.cpp.

00124                                 : mHasValue(true), mValue(value) {
00125 }

pcce::Variant::Variant ( const unsigned char  value  ) 

Constructs a new Variant with the given unsigned char value.

Variant::Variant ( const std::string  value  ) 

Constructs a new Variant with the given string value.

Definition at line 127 of file Variant.cpp.

00127                                      : mHasValue(true), mValue(value) {
00128 }

Variant::Variant ( const char *  value  ) 

Constructs a new Variant with the given const char* value.

This constructor takes a const char*, but converts the value to a string. It is provided for convenience.

Definition at line 130 of file Variant.cpp.

00130                                  : mHasValue(true), mValue(string(value)) {
00131 }

Variant::Variant ( const tPropertyBagPtr  value  ) 

Constructs a new Variant with the given tPropertyBagPtr.

Definition at line 133 of file Variant.cpp.

00133                                            : mHasValue(true), mValue(value) {
00134 }


Member Function Documentation

bool Variant::HasValue (  )  const

Returns true if the Variant has a value (i.e. is not empty).

Definition at line 136 of file Variant.cpp.

References mHasValue.

Referenced by pcce::GameObject::GetMaterialName(), pcce::GameObject::GetPhysicsModelName(), and pcce::GameObject::GetRenderModelName().

00136                              {
00137   return mHasValue;
00138 }

void Variant::Clear (  ) 

Clears the Variant's value.

This method clears the Variant's value. That will cause all of the Get*() methods to throw a VariantEmptyException if called, until a value is set again using Set().

Definition at line 140 of file Variant.cpp.

References mHasValue, and mValue.

00140                     {
00141   mHasValue = false;
00142   mValue = 0;
00143 }

tVariant Variant::Get (  )  const

Returns the Variant's value.

This returns the Variant's value as a tVariant. It will throw a VariantEmptyException if the Variant does not have a value.

Definition at line 145 of file Variant.cpp.

References mHasValue, and mValue.

Referenced by AsBool(), AsChar(), AsInt(), AsLongInt(), AsPropertyBagPtr(), AsReal(), AsString(), AsUnsignedChar(), AsUnsignedInt(), AsUnsignedLongInt(), IsBool(), IsChar(), IsInt(), IsLongInt(), IsPropertyBagPtr(), IsReal(), IsString(), IsUnsignedChar(), IsUnsignedInt(), and IsUnsignedLongInt().

00145                             {
00146   check< VariantEmptyException >(mHasValue, "Variant does not have a value", __FILE__, __LINE__);
00147   return mValue;
00148 }

void Variant::Set ( tVariant  value  ) 

Sets the Variant's value.

Definition at line 150 of file Variant.cpp.

References mHasValue, and mValue.

Referenced by pcce::GameObject::GetMaterialName(), pcce::GameObject::GetPhysicsModelName(), and pcce::GameObject::GetRenderModelName().

00150                                 {
00151   mHasValue = true;
00152   mValue = value;
00153 }

int Variant::AsInt (  )  const

Returns the Variant's value as an int.

This method returns the Variant's value as an int. If the variant is empty, it will throw a VariantEmptyException. If the value cannot be converted to an int using std::stringstream, it will throw a VariantConversionException. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

See also:
Variant::Get()

Definition at line 155 of file Variant.cpp.

References Get(), mValue, ConvertResult< T >::success, and ConvertResult< T >::value.

Referenced by pcce::InputSubSystem::Impl::Initialize().

00155                          {
00156   tVariant v = Get();
00157   ConvertResult< int > result = apply_visitor(VariantConverter< int >(mValue), v);
00158   check< VariantConversionException >(result.success, "Could not convert variant to int", __FILE__, __LINE__);
00159   return result.value;
00160 }

bool Variant::AsBool (  )  const

Returns the Variant's value as a bool.

This method returns the Variant's value as a bool. If the variant is empty, it will throw a VariantEmptyException. If the value cannot be converted to a bool using std::stringstream, it will throw a VariantConversionException. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

See also:
Variant::Get()

Definition at line 162 of file Variant.cpp.

References Get(), mValue, ConvertResult< T >::success, and ConvertResult< T >::value.

00162                            {
00163   tVariant v = Get();
00164   // See the doc string for tVariant for explanation of why bool is excluded
00165   //   from the boost::variant template.
00166   ConvertResult< bool > result = apply_visitor(VariantConverter< bool >(mValue), v);
00167   check< VariantConversionException >(result.success, "Could not convert variant to bool", __FILE__, __LINE__);
00168   return result.value;
00169 }

unsigned int Variant::AsUnsignedInt (  )  const

Returns the Variant's value as an unsigned int.

This method returns the Variant's value as an unsigned int. If the variant is empty, it will throw a VariantEmptyException. If the value cannot be converted to an unsigned int using std::stringstream, it will throw a VariantConversionException. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

See also:
Variant::Get()

Definition at line 171 of file Variant.cpp.

References Get(), mValue, ConvertResult< T >::success, and ConvertResult< T >::value.

00171                                           {
00172   tVariant v = Get();
00173   ConvertResult< unsigned int > result = apply_visitor(VariantConverter< unsigned int >(mValue), v);
00174   check< VariantConversionException >(result.success, "Could not convert variant to unsigned int", __FILE__, __LINE__);
00175   return result.value;
00176 }

long int Variant::AsLongInt (  )  const

Returns the Variant's value as a long int.

This method returns the Variant's value as a long int. If the variant is empty, it will throw a VariantEmptyException. If the value cannot be converted to a long int using std::stringstream, it will throw a VariantConversionException. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

See also:
Variant::Get()

Definition at line 178 of file Variant.cpp.

References Get(), mValue, ConvertResult< T >::success, and ConvertResult< T >::value.

00178                                   {
00179   tVariant v = Get();
00180   ConvertResult< long int > result = apply_visitor(VariantConverter< long int >(mValue), v);
00181   check< VariantConversionException >(result.success, "Could not convert variant to long int", __FILE__, __LINE__);
00182   return result.value;
00183 }

unsigned long int Variant::AsUnsignedLongInt (  )  const

Returns the Variant's value as an unsigned long int.

This method returns the Variant's value as an unsigned long int. If the variant is empty, it will throw a VariantEmptyException. If the value cannot be converted to an unsigned long int using std::stringstream, it will throw a VariantConversionException. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

See also:
Variant::Get()

Definition at line 185 of file Variant.cpp.

References Get(), mValue, ConvertResult< T >::success, and ConvertResult< T >::value.

00185                                                    {
00186   tVariant v = Get();
00187   ConvertResult< unsigned long int > result = apply_visitor(VariantConverter< unsigned long int >(mValue), v);
00188   check< VariantConversionException >(result.success, "Could not convert variant to unsigned long int", __FILE__, __LINE__);
00189   return result.value;
00190 }

tReal Variant::AsReal (  )  const

Returns the Variant's value as a tReal.

This method returns the Variant's value as a tReal. If the variant is empty, it will throw a VariantEmptyException. If the value cannot be converted to a tReal using std::stringstream, it will throw a VariantConversionException. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

See also:
Variant::Get()

Definition at line 192 of file Variant.cpp.

References Get(), mValue, ConvertResult< T >::success, and ConvertResult< T >::value.

00192                             {
00193   tVariant v = Get();
00194   ConvertResult< tReal > result = apply_visitor(VariantConverter< tReal >(mValue), v);
00195   check< VariantConversionException >(result.success, "Could not convert variant to real", __FILE__, __LINE__);
00196   return result.value;
00197 }

char Variant::AsChar (  )  const

Returns the Variant's value as a char.

This method returns the Variant's value as a char. If the variant is empty, it will throw a VariantEmptyException. If the value cannot be converted to a char using std::stringstream, it will throw a VariantConversionException. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

See also:
Variant::Get()

Definition at line 199 of file Variant.cpp.

References Get(), mValue, ConvertResult< T >::success, and ConvertResult< T >::value.

00199                            {
00200   tVariant v = Get();
00201   ConvertResult< char > result = apply_visitor(VariantConverter< char >(mValue), v);
00202   check< VariantConversionException >(result.success, "Could not convert variant to char", __FILE__, __LINE__);
00203   return result.value;
00204 }

unsigned char Variant::AsUnsignedChar (  )  const

Returns the Variant's value as an unsigned char.

This method returns the Variant's value as an unsigned char. If the variant is empty, it will throw a VariantEmptyException. If the value cannot be converted to an unsigned char using std::stringstream, it will throw a VariantConversionException. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

See also:
Variant::Get()

Definition at line 206 of file Variant.cpp.

References Get(), mValue, ConvertResult< T >::success, and ConvertResult< T >::value.

00206                                             {
00207   tVariant v = Get();
00208   ConvertResult< unsigned char > result = apply_visitor(VariantConverter< unsigned char >(mValue), v);
00209   check< VariantConversionException >(result.success, "Could not convert variant to unsigned char", __FILE__, __LINE__);
00210   return result.value;
00211 }

string Variant::AsString (  )  const

Returns the Variant's value as a string.

This method returns the Variant's value as a string. If the variant is empty, it will throw a VariantEmptyException. If the value cannot be converted to a string using std::stringstream, it will throw a VariantConversionException. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

See also:
Variant::Get()

Definition at line 213 of file Variant.cpp.

References Get(), mValue, ConvertResult< T >::success, and ConvertResult< T >::value.

Referenced by pcce::GameObject::GetMaterialName(), pcce::GameObject::GetPhysicsModelName(), pcce::GameObject::GetRenderModelName(), pcce::XmlNode::SetAttribute(), and pcce::SoundResourceFactory::vCreateResource().

00213                                {
00214   tVariant v = Get();
00215   ConvertResult< string > result = apply_visitor(VariantConverter< string >(mValue), v);
00216   check< VariantConversionException >(result.success, "Could not convert variant to string", __FILE__, __LINE__);
00217   return result.value;
00218 }

tPropertyBagPtr Variant::AsPropertyBagPtr (  )  const

Returns the Variant's value as a tPropertyBagPtr.

This method returns the Variant's value as a tPropertyBagPtr. If the variant is empty, it will throw a VariantEmptyException. In this case, no conversion is attempted. Only an actual tPropertyBagPtr can be retrieved by this method.

See also:
Variant::Get()

Definition at line 220 of file Variant.cpp.

References Get(), ConvertResult< T >::success, and ConvertResult< T >::value.

Referenced by pcce::Configuration::TryGetConfigSection().

00220                                                 {
00221   tVariant v = Get();
00222   ConvertResult< tPropertyBagPtr > result = apply_visitor(VariantPropBagConverter(), v);
00223   check< VariantConversionException >(result.success, "Variant is not a PropertyBagPtr", __FILE__, __LINE__);
00224   return result.value;
00225 }

bool Variant::IsInt (  )  const

Returns true if tVariant value can be converted to an int.

This method returns true if the tVariant value can be converted to an int. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

Definition at line 227 of file Variant.cpp.

References Get(), mHasValue, mValue, and ConvertResult< T >::success.

Referenced by pcce::InputSubSystem::Impl::Initialize().

00227                           {
00228   if (!mHasValue) {
00229     return false;
00230   } else {
00231     tVariant v = Get();
00232     ConvertResult< int > result = apply_visitor(VariantConverter< int >(mValue), v);
00233     return result.success;
00234   }
00235 }

bool Variant::IsBool (  )  const

Returns true if tVariant value can be converted to a bool.

This method returns true if the tVariant value can be converted to a bool. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

Definition at line 237 of file Variant.cpp.

References Get(), mHasValue, mValue, and ConvertResult< T >::success.

00237                            {
00238   if (!mHasValue) {
00239     return false;
00240   } else {
00241     tVariant v = Get();
00242     // See the doc string for tVariant for explanation of why bool is excluded
00243     //   from the boost::variant template.
00244     ConvertResult< bool > result = apply_visitor(VariantConverter< bool >(mValue), v);
00245     return result.success;
00246   }
00247 }

bool Variant::IsUnsignedInt (  )  const

Returns true if tVariant value can be converted to an unsigned int.

This method returns true if the tVariant value can be converted to an unsigned int. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

Definition at line 249 of file Variant.cpp.

References Get(), mHasValue, mValue, and ConvertResult< T >::success.

00249                                   {
00250   if (!mHasValue) {
00251     return false;
00252   } else {
00253     tVariant v = Get();
00254     ConvertResult< unsigned int > result = apply_visitor(VariantConverter< unsigned int >(mValue), v);
00255     return result.success;
00256   }
00257 }

bool Variant::IsLongInt (  )  const

Returns true if tVariant value can be converted to a long int.

This method returns true if the tVariant value can be converted to a long int. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

Definition at line 259 of file Variant.cpp.

References Get(), mHasValue, mValue, and ConvertResult< T >::success.

00259                               {
00260   if (!mHasValue) {
00261     return false;
00262   } else {
00263     tVariant v = Get();
00264     ConvertResult< long int > result = apply_visitor(VariantConverter< long int >(mValue), v);
00265     return result.success;
00266   }
00267 }

bool Variant::IsUnsignedLongInt (  )  const

Returns true if tVariant value can be converted to an unsigned long int.

This method returns true if the tVariant value can be converted to an unsigned long int. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

Definition at line 269 of file Variant.cpp.

References Get(), mHasValue, mValue, and ConvertResult< T >::success.

00269                                       {
00270   if (!mHasValue) {
00271     return false;
00272   } else {
00273     tVariant v = Get();
00274     ConvertResult< unsigned long int > result = apply_visitor(VariantConverter< unsigned long int >(mValue), v);
00275     return result.success;
00276   }
00277 }

bool Variant::IsReal (  )  const

Returns true if tVariant value can be converted to a tReal.

This method returns true if the tVariant value can be converted to a tReal. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

Definition at line 279 of file Variant.cpp.

References Get(), mHasValue, mValue, and ConvertResult< T >::success.

00279                            {
00280   if (!mHasValue) {
00281     return false;
00282   } else {
00283     tVariant v = Get();
00284     ConvertResult< tReal > result = apply_visitor(VariantConverter< tReal >(mValue), v);
00285     return result.success;
00286   }
00287 }

bool Variant::IsChar (  )  const

Returns true if tVariant value can be converted to a char.

This method returns true if the tVariant value can be converted to a char. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

Definition at line 289 of file Variant.cpp.

References Get(), mHasValue, mValue, and ConvertResult< T >::success.

00289                            {
00290   if (!mHasValue) {
00291     return false;
00292   } else {
00293     tVariant v = Get();
00294     ConvertResult< char > result = apply_visitor(VariantConverter< char >(mValue), v);
00295     return result.success;
00296   }
00297 }

bool Variant::IsUnsignedChar (  )  const

Returns true if tVariant value can be converted to an unsigned char.

This method returns true if the tVariant value can be converted to an unsigned char. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

Definition at line 299 of file Variant.cpp.

References Get(), mHasValue, mValue, and ConvertResult< T >::success.

00299                                    {
00300   if (!mHasValue) {
00301     return false;
00302   } else {
00303     tVariant v = Get();
00304     ConvertResult< unsigned char > result = apply_visitor(VariantConverter< unsigned char >(mValue), v);
00305     return result.success;
00306   }
00307 }

bool Variant::IsString (  )  const

Returns true if tVariant value can be converted to a string.

This method returns true if the tVariant value can be converted to a string. Note: This method actually does the conversion and changes the tVariant value to the type specified. That way, if you write something like "Variant v("123"); if (v.IsInt()) { cout << v.AsInt(); }", you will only do one conversion. However, if you alternate between say "AsInt()" and "AsString()", the conversion will happen every time.

Definition at line 309 of file Variant.cpp.

References Get(), mHasValue, mValue, and ConvertResult< T >::success.

00309                              {
00310   if (!mHasValue) {
00311     return false;
00312   } else {
00313     tVariant v = Get();
00314     ConvertResult< string > result = apply_visitor(VariantConverter< string >(mValue), v);
00315     return result.success;
00316   }
00317 }

bool Variant::IsPropertyBagPtr (  )  const

Returns true if tVariant value can be converted to a tPropertyBagPtr.

This method returns true if the tVariant value can be converted to a tPropertyBagPtr. This method will only return true if the tVariant value actually is a tPropertyBagPtr, since conversion to/from othe types is not possible in this case.

Definition at line 319 of file Variant.cpp.

References Get(), mHasValue, and ConvertResult< T >::success.

Referenced by pcce::Configuration::TryGetConfigSection().

00319                                      {
00320   if (!mHasValue) {
00321     return false;
00322   } else {
00323     tVariant v = Get();
00324     ConvertResult< tPropertyBagPtr > result = apply_visitor(VariantPropBagConverter(), v);
00325     return result.success;
00326   }
00327 }


Member Data Documentation

bool pcce::Variant::mHasValue [private]

tVariant pcce::Variant::mValue [mutable, private]


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

Generated on Thu Mar 6 11:39:28 2008 for Protocce by  doxygen 1.5.5