Dv Namespace Reference

Namespaces

namespace  Util
namespace  String

Classes

class  Any
 An Any object can hold any kind of value. More...
struct  basetype
 Retrieve the base component of a type. More...
struct  basetype< T & >
 Retrieve the base component of a type. More...
struct  basetype< const T & >
 Retrieve the base component of a type. More...
struct  basetype< const T >
 Retrieve the base component of a type. More...
struct  Convert
struct  Convert< T, T >
struct  Convert< std::string, std::string >
struct  Convert< std::string, const char * >
struct  Convert< Target, std::string >
struct  Convert< std::string, Source >
class  Date
 A simple Date class. More...
class  ostream_ptr
 The following functions support writing to a std::ostream* If the pointer is 0 (null), nothing is written. More...
class  Debugable
 An abstract class that provides debugging services. More...
class  DebugSlave
 A DebugSlave uses a link to another master Debugable to provide its log and bug services. More...
class  ObservableDebugSlave
 An ObservableDebugSlave keeps an eye on its collection of slaves. More...
class  Debug
 A Debug object is typically a master. More...
class  DebugObserver
 A Dv::DebugObserver is a Dv::DebugSlave that implements the link to its master through the observer-observable link. More...
struct  iomanip
 Convert typical member functions to iomanip objects that can be put on a stream using the conventional operator<<. More...
struct  iomanip_c
 As above, but makes a copy of the BT object. More...
struct  iomanip_m
 Convert typical member functions to iomanip objects that can be put on a stream using the conventional operator<<. More...
class  Observable
 Base class for all Observable classes. More...
class  Observer
class  Duration
 Class representing a duration. More...
class  Period
 A Period is simply a Date with a Duration. More...
class  Props
 Storing elements in a Props object:. More...
class  shared_ptr
 A simple shared_ptr class. More...
class  StringMap
 A utility class wrapper around std::map<std::string,std::string>. More...

Typedefs

typedef std::pair< const char
*, size_t > 
Buffer
 Convenience type that allows to make iomanip objects from buffers.
typedef iomanip_c< BufferBufferDump
 Iomanipulator type corresponding to buffers.
typedef StringMap< std::string > StringStringMap

Functions

template<typename T >
any_cast (const Any &any)
 Convert an Any object to its underlying value type.
template<typename Target , typename Source >
bool convert (Target &target, const Source &source)
template<typename Target , typename Source >
Target convert (const Source &source, const Target &default_value)
template<typename Source >
std::string tostring (const Source &source, const std::string &default_value="")
template<typename Target >
Target fromstring (const std::string &source, const Target &default_value)
template<typename Target >
Target fromstring (const std::string &source)
std::istream & operator>> (std::istream &is, Date &date)
 Read a date from an input stream.
std::ostream & operator<< (std::ostream &os, const Date &date)
 Write a date to an output stream.
std::ostream & debug_write (std::ostream &os, const char *buf, size_t n)
 Write a character buffer to a stream using only printable characters.
std::ostream & debug_write (std::ostream &os, const Buffer &buf)
 Write a character buffer to a stream using only printable characters.
BufferDump debug_dump (const char *buf, size_t size)
 Create an iomanip from a buffer with a size.
template<typename T >
BufferDump debug_dump_t (const T &t, size_t size=sizeof(T))
 Create an iomanip from an arbitrary object and a size.
template<typename T >
std::ostream & operator<< (std::ostream &os, const Dv::iomanip< T > &io)
template<typename T >
std::ostream & operator<< (std::ostream &os, const Dv::iomanip_c< T > &io)
template<typename T >
std::ostream & operator<< (std::ostream &os, const Dv::iomanip_m< T > &io)
bool operator== (const Duration &u1, const Duration &u2)
 Simply compares years, months, seconds separately.
Date operator+ (const Date &date, const Duration &duration)
 Compute Date just after period of size u, starting at d.
Propsenv2props (Props &props)

Typedef Documentation

typedef std::pair<const char*, size_t> Dv::Buffer

Convenience type that allows to make iomanip objects from buffers.

Definition at line 21 of file debug_dump.h.

Iomanipulator type corresponding to buffers.

Definition at line 35 of file debug_dump.h.

typedef StringMap<std::string> Dv::StringStringMap

Definition at line 127 of file stringmap.h.


Function Documentation

template<typename T >
T Dv::any_cast ( const Any &  any  )  [inline]

Convert an Any object to its underlying value type.

Parameters:
any object to convert to type T
Returns:
T-value of Any object

Definition at line 82 of file any.h.

template<typename Target , typename Source >
bool Dv::convert ( Target &  target,
const Source &  source 
) [inline]

Definition at line 80 of file convert.h.

Referenced by convert(), fromstring(), and tostring().

template<typename Target , typename Source >
Target Dv::convert ( const Source &  source,
const Target &  default_value 
) [inline]

Definition at line 86 of file convert.h.

References convert().

template<typename Source >
std::string Dv::tostring ( const Source &  source,
const std::string &  default_value = "" 
) [inline]
template<typename Target >
Target Dv::fromstring ( const std::string &  source,
const Target &  default_value 
) [inline]

Definition at line 106 of file convert.h.

References convert().

template<typename Target >
Target Dv::fromstring ( const std::string &  source  )  [inline]

Definition at line 116 of file convert.h.

References convert().

std::istream& Dv::operator>> ( std::istream &  is,
Date &  date 
)

Read a date from an input stream.

Warning:
a whole line is read and nothing is put back. In other words, this function assumes that the date representation occupies the rest of the current line.
Parameters:
is input stream
date Dv::Util::Date object that will contain the read date
Returns:
is
std::ostream& Dv::operator<< ( std::ostream &  os,
const Date &  date 
)

Write a date to an output stream.

The format used is "%F %T", i.e. YYY-MM-DD (ISO 8601), followed by HH:MM:SS.

Parameters:
os output stream
date to write
Returns:
os
See also:
Dv::Util::Date::str
std::ostream& Dv::debug_write ( std::ostream &  os,
const char *  buf,
size_t  n 
)

Write a character buffer to a stream using only printable characters.

Non-printable chars are represented by a string of the form \NNN where NNN is the decimal code of the char.

Parameters:
os stream to print to
buf pointer to first char to print
n number of chars to print

Referenced by debug_dump(), and debug_write().

std::ostream& Dv::debug_write ( std::ostream &  os,
const Buffer &  buf 
) [inline]

Write a character buffer to a stream using only printable characters.

Non-printable chars are represented by a string of the form \NNN where NNN is the decimal code of the char.

Parameters:
os stream to print to
buf pair of buffer pointer and size
See also:
Dv::debug_write(std::ostream&,const char*,size_t)

Definition at line 30 of file debug_dump.h.

References debug_write().

BufferDump Dv::debug_dump ( const char *  buf,
size_t  size 
) [inline]

Create an iomanip from a buffer with a size.

This supports code such as the following:

 const char* buf;
 std::cout << "buf[1..20] = " << debug_dump(buf, 20) << std::endl;
Parameters:
buf pointer to first char to print
size number of chars to print
Returns:
iomanip

Definition at line 47 of file debug_dump.h.

References debug_write().

Referenced by debug_dump_t(), and Dv::StringMap< std::string >::print_summary().

template<typename T >
BufferDump Dv::debug_dump_t ( const T &  t,
size_t  size = sizeof(T) 
) [inline]

Create an iomanip from an arbitrary object and a size.

This supports code such as the following:

 T object;
 std::cout << "dump of t: " << debug_dump(object) << std::endl;
Parameters:
t object to dump
size only the first size bytes will be dumped.
Returns:
iomanip

Definition at line 62 of file debug_dump.h.

References debug_dump().

template<typename T >
std::ostream& Dv::operator<< ( std::ostream &  os,
const Dv::iomanip< T > &  io 
) [inline]

Definition at line 59 of file iomanip.h.

template<typename T >
std::ostream& Dv::operator<< ( std::ostream &  os,
const Dv::iomanip_c< T > &  io 
) [inline]

Definition at line 74 of file iomanip.h.

template<typename T >
std::ostream& Dv::operator<< ( std::ostream &  os,
const Dv::iomanip_m< T > &  io 
) [inline]

Definition at line 114 of file iomanip.h.

bool Dv::operator== ( const Duration &  u1,
const Duration &  u2 
)

Simply compares years, months, seconds separately.

Date Dv::operator+ ( const Date &  date,
const Duration &  duration 
)

Compute Date just after period of size u, starting at d.

Sometimes give strange (but probably unavoidably so) results: e.g.

 2000-01-31 + 1 month = 2000-03-2.
Parameters:
date to add to
duration to add
Props& Dv::env2props ( Props &  props  ) 

dvutil-1.0.10 [ 5 December, 2009]