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

Dv::Util::Props::Value 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::Value:

Collaboration graph
[legend]
List of all members.

Public Member Functions

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.
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.
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.
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.
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.
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.
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.
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 std::string & () throw (PropsException)
 The conversion operators have a similar functionality as the Props::Value::operator>>() function members.
std::string & str () throw (PropsException)
 Explicit "conversion" to std::string.
Propsoperator= (int)
 Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.
Propsoperator= (long)
 Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.
Propsoperator= (short)
 Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.
Propsoperator= (unsigned int)
 Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.
Propsoperator= (unsigned long)
 Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.
Propsoperator= (unsigned short)
 Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.
Propsoperator= (const double &)
 Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.
Propsoperator= (const std::string &)
 Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.

Private Member Functions

 Value (Props &props, const std::string &key, std::string *value)
 Value (const Value &)
Valueoperator= (const Value &)

Private Attributes

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

Friends

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

Detailed Description

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

A non-const access with Props::operator[] returns an object of this type. It supports several convertors and assignment operations to support code like

 props["abc"] = 32;
which will use Props::Value::operator=(int) do perform the assignment.

Definition at line 94 of file props.h.


Constructor & Destructor Documentation

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

Definition at line 182 of file props.h.

References key_, props_, and value_.

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


Member Function Documentation

Props& Dv::Util::Props::Value::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.

Props& Dv::Util::Props::Value::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.

Props& Dv::Util::Props::Value::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.

Props& Dv::Util::Props::Value::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.

Props& Dv::Util::Props::Value::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.

Props& Dv::Util::Props::Value::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.

Props& Dv::Util::Props::Value::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.

Props& Dv::Util::Props::Value::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::Value::operator int  )  const throw (PropsException)
 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

std::string& Dv::Util::Props::Value::str  )  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:
reference to static_cast<std::string&>(*this)
See also:
Dv::Util::Props::ConstValue::str
Definition at line 162 of file props.h.

Props& Dv::Util::Props::Value::operator= int   ) 
 

Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.

Non-string arguments are first converted to strings.

Props& Dv::Util::Props::Value::operator= long   ) 
 

Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.

Non-string arguments are first converted to strings.

Props& Dv::Util::Props::Value::operator= short   ) 
 

Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.

Non-string arguments are first converted to strings.

Props& Dv::Util::Props::Value::operator= unsigned  int  ) 
 

Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.

Non-string arguments are first converted to strings.

Props& Dv::Util::Props::Value::operator= unsigned  long  ) 
 

Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.

Non-string arguments are first converted to strings.

Props& Dv::Util::Props::Value::operator= unsigned  short  ) 
 

Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.

Non-string arguments are first converted to strings.

Props& Dv::Util::Props::Value::operator= const double &   ) 
 

Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.

Non-string arguments are first converted to strings.

Props& Dv::Util::Props::Value::operator= const std::string &   ) 
 

Props::Value::operator=() sets the value associated with the key corresponding to Props::Value.

Non-string arguments are first converted to strings.

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


Friends And Related Function Documentation

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

Output operator needed to avoid ambiguity E.g.

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


Member Data Documentation

Props& Dv::Util::Props::Value::props_ [private]
 

Definition at line 187 of file props.h.

Referenced by Value().

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

Definition at line 188 of file props.h.

Referenced by Value().

std::string* Dv::Util::Props::Value::value_ [private]
 

Definition at line 189 of file props.h.

Referenced by Value().


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