zypp::KindOf< _Tp > Class Template Reference

Maintain string values representing different kinds of a type. More...

#include <KindOf.h>

List of all members.

Public Member Functions

 KindOf ()
 DefaultCtor: empty string.
 KindOf (const std::string &value_r)
 Ctor from string.
 ~KindOf ()
 Dtor.
const std::string & asString () const
 Identification string.
int compare (const KindOf &rhs) const
 Order on KindOf (arbitrary).

Private Attributes

std::string _value

Related Functions

(Note that these are not member functions.)

template<class _Tp>
std::ostream & operator<< (std::ostream &str, const KindOf< _Tp > &obj)
 Stream output.
template<class _Tp>
bool operator== (const KindOf< _Tp > &lhs, const KindOf< _Tp > &rhs)
template<class _Tp>
bool operator== (const KindOf< _Tp > &lhs, const std::string &rhs)
template<class _Tp>
bool operator== (const std::string &lhs, const KindOf< _Tp > &rhs)
template<class _Tp>
bool operator!= (const KindOf< _Tp > &lhs, const KindOf< _Tp > &rhs)
template<class _Tp>
bool operator!= (const KindOf< _Tp > &lhs, const std::string &rhs)
template<class _Tp>
bool operator!= (const std::string &lhs, const KindOf< _Tp > &rhs)
template<class _Tp>
bool operator< (const KindOf< _Tp > &lhs, const KindOf< _Tp > &rhs)
 Lexicographical order.


Detailed Description

template<class _Tp>
class zypp::KindOf< _Tp >

Maintain string values representing different kinds of a type.

Example: We have different kinds of Resolvable: Package, Patch, etc. We want some thing to identify these types and have a string value associated. Identification should be constructible from this string. An Enumeration Class could do this, but we would also like to be extensible at runtime.

KindOf stores a lowercased version of a string and uses this as identification.

Todo:
Unify strings and associate numerical value for more efficient comparison and use in switch.
Todo:
Make lowercased/uppercased/etc an option. First of all get rid of the string::toLower calls operator.
Todo:
Maybe collaboration with some sort of Registry.

Definition at line 45 of file KindOf.h.


Constructor & Destructor Documentation

template<class _Tp>
zypp::KindOf< _Tp >::KindOf (  )  [inline]

DefaultCtor: empty string.

Definition at line 49 of file KindOf.h.

template<class _Tp>
zypp::KindOf< _Tp >::KindOf ( const std::string &  value_r  )  [inline, explicit]

Ctor from string.

Lowercase version of value_r is used as identification.

Definition at line 55 of file KindOf.h.

template<class _Tp>
zypp::KindOf< _Tp >::~KindOf (  )  [inline]

Dtor.

Definition at line 59 of file KindOf.h.


Member Function Documentation

template<class _Tp>
const std::string& zypp::KindOf< _Tp >::asString (  )  const [inline]

Identification string.

Definition at line 63 of file KindOf.h.

References zypp::KindOf< _Tp >::_value.

Referenced by zypp::solver::detail::helixXML(), zypp::parser::susetags::makeSharedIdent(), and zypp::KindOf< _Tp >::operator==().

template<class _Tp>
int zypp::KindOf< _Tp >::compare ( const KindOf< _Tp > &  rhs  )  const [inline]

Order on KindOf (arbitrary).

Not necessarily lexicographical.

Todo:
Enable class _Tp to define the order, Fix logical operators below to use compare,

Definition at line 71 of file KindOf.h.

References zypp::KindOf< _Tp >::_value.


Friends And Related Function Documentation

template<class _Tp>
std::ostream & operator<< ( std::ostream &  str,
const KindOf< _Tp > &  obj 
) [related]

Stream output.

Definition at line 83 of file KindOf.h.

References zypp::solver::detail::str.

template<class _Tp>
bool operator== ( const KindOf< _Tp > &  lhs,
const KindOf< _Tp > &  rhs 
) [related]

Definition at line 92 of file KindOf.h.

References zypp::KindOf< _Tp >::asString().

template<class _Tp>
bool operator== ( const KindOf< _Tp > &  lhs,
const std::string &  rhs 
) [related]

Definition at line 97 of file KindOf.h.

References zypp::KindOf< _Tp >::asString(), and zypp::str::toLower().

template<class _Tp>
bool operator== ( const std::string &  lhs,
const KindOf< _Tp > &  rhs 
) [related]

Definition at line 102 of file KindOf.h.

References zypp::KindOf< _Tp >::asString(), and zypp::str::toLower().

template<class _Tp>
bool operator!= ( const KindOf< _Tp > &  lhs,
const KindOf< _Tp > &  rhs 
) [related]

Definition at line 109 of file KindOf.h.

template<class _Tp>
bool operator!= ( const KindOf< _Tp > &  lhs,
const std::string &  rhs 
) [related]

Definition at line 114 of file KindOf.h.

template<class _Tp>
bool operator!= ( const std::string &  lhs,
const KindOf< _Tp > &  rhs 
) [related]

Definition at line 119 of file KindOf.h.

template<class _Tp>
bool operator< ( const KindOf< _Tp > &  lhs,
const KindOf< _Tp > &  rhs 
) [related]

Lexicographical order.

Definition at line 126 of file KindOf.h.


Member Data Documentation

template<class _Tp>
std::string zypp::KindOf< _Tp >::_value [private]

Definition at line 76 of file KindOf.h.

Referenced by zypp::KindOf< _Tp >::asString(), and zypp::KindOf< _Tp >::compare().


The documentation for this class was generated from the following file:
Generated on Tue Sep 25 19:23:14 2007 for libzypp by  doxygen 1.5.3