Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

Dv::Util::Props::ConstValue Class Reference

A class representing a reference to a key-value pair in a Props object. More...

#include <props.h>

Collaboration diagram for Dv::Util::Props::ConstValue:

Collaboration graph
[legend]
List of all members.

Public Member Functions

const Propsoperator>> (std::string &) const throw (PropsException)
 Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.
const Propsoperator>> (int &) const throw (PropsException)
 Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.
const Propsoperator>> (long &) const throw (PropsException)
 Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.
const Propsoperator>> (short &) const throw (PropsException)
 Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.
const Propsoperator>> (unsigned int &) const throw (PropsException)
 Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.
const Propsoperator>> (unsigned long &) const throw (PropsException)
 Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.
const Propsoperator>> (unsigned short &) const throw (PropsException)
 Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.
const Propsoperator>> (double &) const throw (PropsException)
 Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.
 operator int () const throw (PropsException)
 The conversion operators have a similar functionality as the Props::Value::operator>>() function members.
 operator long () const throw (PropsException)
 The conversion operators have a similar functionality as the Props::Value::operator>>() function members.
 operator short () const throw (PropsException)
 The conversion operators have a similar functionality as the Props::Value::operator>>() function members.
 operator unsigned int () const throw (PropsException)
 The conversion operators have a similar functionality as the Props::Value::operator>>() function members.
 operator unsigned long () const throw (PropsException)
 The conversion operators have a similar functionality as the Props::Value::operator>>() function members.
 operator unsigned short () const throw (PropsException)
 The conversion operators have a similar functionality as the Props::Value::operator>>() function members.
 operator double () const throw (PropsException)
 The conversion operators have a similar functionality as the Props::Value::operator>>() function members.
 operator const std::string & () const throw (PropsException)
 The conversion operators have a similar functionality as the Props::Value::operator>>() function members.
const std::string & str () const throw (PropsException)
 Explicit "conversion" to std::string.

Private Member Functions

 ConstValue (const Props &props, const std::string &key, const std::string *value)
 ConstValue (const ConstValue &)
ConstValueoperator= (const ConstValue &)

Private Attributes

const Propsprops_
const std::string key_
const std::string * value_

Friends

std::ostream & operator<< (std::ostream &, const Props::ConstValue &)
 Output operator needed to avoid ambiguity E.g.

Detailed Description

A class representing a reference to a key-value pair in a Props object.

The difference with Props::Value is that there are no assignment operators (because the underlying Props object is constant.

Definition at line 198 of file props.h.


Constructor & Destructor Documentation

Dv::Util::Props::ConstValue::ConstValue const Props props,
const std::string &  key,
const std::string *  value
[inline, private]
 

Definition at line 269 of file props.h.

References key_, props_, and value_.

Dv::Util::Props::ConstValue::ConstValue const ConstValue  )  [private]
 


Member Function Documentation

const Props& Dv::Util::Props::ConstValue::operator>> std::string &   )  const throw (PropsException)
 

Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.

It will throw an exception, if there is no such value.

const Props& Dv::Util::Props::ConstValue::operator>> int &   )  const throw (PropsException)
 

Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.

It will throw an exception, if there is no such value.

const Props& Dv::Util::Props::ConstValue::operator>> long &   )  const throw (PropsException)
 

Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.

It will throw an exception, if there is no such value.

const Props& Dv::Util::Props::ConstValue::operator>> short &   )  const throw (PropsException)
 

Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.

It will throw an exception, if there is no such value.

const Props& Dv::Util::Props::ConstValue::operator>> unsigned int &   )  const throw (PropsException)
 

Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.

It will throw an exception, if there is no such value.

const Props& Dv::Util::Props::ConstValue::operator>> unsigned long &   )  const throw (PropsException)
 

Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.

It will throw an exception, if there is no such value.

const Props& Dv::Util::Props::ConstValue::operator>> unsigned short &   )  const throw (PropsException)
 

Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.

It will throw an exception, if there is no such value.

const Props& Dv::Util::Props::ConstValue::operator>> double &   )  const throw (PropsException)
 

Props::Value::operator>>() can be used to set its reference parameter with the value associated with the Props::Value object.

It will throw an exception, if there is no such value.

Dv::Util::Props::ConstValue::operator int  )  const throw (PropsException)
 

The conversion operators have a similar functionality as the Props::Value::operator>>() function members.

Note how the std::string& conversion returns a reference, making examples such as the following efficient.

 int i(props["f"]);
 const std::string& huge_string(props["text"]);

Dv::Util::Props::ConstValue::operator long  )  const throw (PropsException)
 

The conversion operators have a similar functionality as the Props::Value::operator>>() function members.

Note how the std::string& conversion returns a reference, making examples such as the following efficient.

 int i(props["f"]);
 const std::string& huge_string(props["text"]);

Dv::Util::Props::ConstValue::operator short  )  const throw (PropsException)
 

The conversion operators have a similar functionality as the Props::Value::operator>>() function members.

Note how the std::string& conversion returns a reference, making examples such as the following efficient.

 int i(props["f"]);
 const std::string& huge_string(props["text"]);

Dv::Util::Props::ConstValue::operator unsigned int  )  const throw (PropsException)
 

The conversion operators have a similar functionality as the Props::Value::operator>>() function members.

Note how the std::string& conversion returns a reference, making examples such as the following efficient.

 int i(props["f"]);
 const std::string& huge_string(props["text"]);

Dv::Util::Props::ConstValue::operator unsigned long  )  const throw (PropsException)
 

The conversion operators have a similar functionality as the Props::Value::operator>>() function members.

Note how the std::string& conversion returns a reference, making examples such as the following efficient.

 int i(props["f"]);
 const std::string& huge_string(props["text"]);

Dv::Util::Props::ConstValue::operator unsigned short  )  const throw (PropsException)
 

The conversion operators have a similar functionality as the Props::Value::operator>>() function members.

Note how the std::string& conversion returns a reference, making examples such as the following efficient.

 int i(props["f"]);
 const std::string& huge_string(props["text"]);

Dv::Util::Props::ConstValue::operator double  )  const throw (PropsException)
 

The conversion operators have a similar functionality as the Props::Value::operator>>() function members.

Note how the std::string& conversion returns a reference, making examples such as the following efficient.

 int i(props["f"]);
 const std::string& huge_string(props["text"]);

Dv::Util::Props::ConstValue::operator const std::string &  )  const throw (PropsException)
 

The conversion operators have a similar functionality as the Props::Value::operator>>() function members.

Note how the std::string& conversion returns a reference, making examples such as the following efficient.

 int i(props["f"]);
 const std::string& huge_string(props["text"]);

const std::string& Dv::Util::Props::ConstValue::str  )  const throw (PropsException) [inline]
 

Explicit "conversion" to std::string.

This function is handy in cases such as the following:

 std::string s;
 s = props[key]; 
which, under gcc-3.3.1 yields a compiler error due to an ambiguity between
 std::string::operator=(const char); 
 std::string::operator=(const std::string); 
and note that the conversion of Value to int provides also a conversion to char (apparently of the same "quality").
Returns:
static_cast<const std::string&>(*this)
See also:
Dv::Util::Props::Value::str
Definition at line 256 of file props.h.

ConstValue& Dv::Util::Props::ConstValue::operator= const ConstValue  )  [private]
 


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  ,
const Props::ConstValue
[friend]
 

Output operator needed to avoid ambiguity E.g.

 cout << props["key"];
leaves too many conversions for the compiler.


Member Data Documentation

const Props& Dv::Util::Props::ConstValue::props_ [private]
 

Definition at line 274 of file props.h.

Referenced by ConstValue().

const std::string Dv::Util::Props::ConstValue::key_ [private]
 

Definition at line 275 of file props.h.

Referenced by ConstValue().

const std::string* Dv::Util::Props::ConstValue::value_ [private]
 

Definition at line 276 of file props.h.

Referenced by ConstValue().


The documentation for this class was generated from the following file:
dvutil-0.13.15 [30 December, 2004]