ximol/xml/attributes.hpp File Reference


Detailed Description

attributes declaration.

Author:
Tournois Florent
Version:
1.0
Id
attributes.hpp,v 1.20 2004/02/25 18:59:13 tournois Exp
Log
attributes.hpp,v
Revision 1.20 2004/02/25 18:59:13 tournois imporve the gcc compatibility.

Revision 1.19 2004/02/22 22:36:24 hfp empty log message ***

Revision 1.18 2004/02/22 10:27:34 tournois Add some doc.

Revision 1.17 2004/02/22 09:54:21 tournois Change years on the copyright.

Revision 1.16 2004/02/19 18:59:28 tournois attribute doc

Revision 1.15 2004/01/29 20:52:35 tournois doc and tutorial.

Revision 1.14 2004/01/18 11:40:58 tournois Add the pattern facet.

Revision 1.13 2003/12/10 20:45:51 tournois no message

Revision 1.12 2003/12/09 19:57:28 tournois Fix some bugs about attributes classes.

Revision 1.11 2003/12/05 13:04:41 hfp adapt supplied functions

Revision 1.10 2003/12/04 14:44:10 hfp shortcut/uri-mapping includes default namespace ns_map swaps key with value -> faster find for main use-case throwing error in some cases interface is based on map (insert, fiind) mis-use of special values on return removed (find etc.) size() returns an size_t (unsigned)

Revision 1.9 2003/12/03 12:28:46 hfp swap, copy construction and assignment

Revision 1.8 2003/11/19 20:52:54 tournois Add new manipulator for stag and etag. Correct bugs and add tests.

Revision 1.7 2003/11/18 18:54:52 tournois Add str_cast and drop the transformation.hpp file.

Revision 1.6 2003/11/15 22:52:57 tournois Add somes function arround attributes and tests for attributes.

Revision 1.5 2003/11/14 13:30:20 tournois change the attributes class and fix some bugs.

Revision 1.4 2003/11/02 19:23:01 tournois Go to the boost coding standard. Change all name to lower case.

Revision 1.3 2003/10/25 13:53:40 hfp review and separation

Revision 1.2 2003/09/28 16:46:13 hfp The "uri" default argument of the add()-method has changed the construction of default-value (::str::string() -> xstring()), because of non-existing conversion path from string to xstring.

Revision 1.1 2003/09/24 08:28:18 tournois Create the namespace Encoders, Parser, Xml Change the library organization. add VC7.1 project for this organization.

Definition in file attributes.hpp.

#include <ximol/stop_warnings.hpp>
#include <ximol/export_defs.hpp>
#include <ximol/str_cast.hpp>
#include <ximol/typedefs.hpp>
#include <map>

Include dependency graph for attributes.hpp:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Classes

class  attributes
 A simple class to contain attributes of a tag. More...

struct  extract_attribute
 Deserialize the attribute from the name. More...

struct  extract_attribute< std::string >
 Deserialize the attribute from the name. More...

struct  extract_attribute< std::wstring >
 Deserialize the attribute from the name. More...


Functions

xostreamoperator<< (xostream &xos, attributes const &rhs)
 put to operator for attributes

xistreamoperator>> (xistream &xis, attributes &rhs)
 get from operator for attributes

XIMOL_EXPORT::std::ostream & operator<< (::std::ostream &os, attributes const &x)
 put to operator for attributes on standard stream

template<typename StringT1, typename StringT2, typename T> XIMOL_XML_END_NAMESPACE XIMOL_BEGIN_NAMESPACE
std::pair< xml::attributes::iterator,
bool > 
insert_attribute (xml::attributes &att, StringT1 const &namespace_name, StringT2 const &name, T const &value)
 insert an attribute insert a attribute in the attribute list.

template<typename StringT, typename T> std::pair< xml::attributes::iterator,
bool > 
insert_attribute (xml::attributes &att, StringT const &name, T const &value)
 insert an attribute insert a attribute in the attribute list.

template<typename StringT1, typename StringT2, typename T> void set_attribute (xml::attributes &att, StringT1 const &namespace_name, StringT2 const &name, T const &value)
 set an attribute

template<typename StringT, typename T> void set_attribute (xml::attributes &att, StringT const &name, T const &value)
 set an xml::attributes

template<typename StringT1, typename StringT2, typename T> bool get_attribute (xml::attributes const &att, StringT1 const &namespace_name, StringT2 const &name, T &value)
 Deserialize the attribute value.

template<typename StringT, typename T> bool get_attribute (xml::attributes const &att, StringT const &name, T &value)
 Deserialize the attribute from the name.

template<typename StringT1, typename StringT2> xstring get_raw_attribute (xml::attributes const &att, StringT1 const &namespace_name, StringT2 const &name)
 Deserialize the attribute from the name.

template<typename StringT> xstring get_raw_attribute (xml::attributes const &att, StringT const &name)
 Deserialize the attribute from the name.

template<typename String1, typename String2> bool set_namespace (xml::attributes &att, String1 &short_namespace, const String2 &uri)
 define a short_namespace for an uri.

template<typename String> void set_namespace (xml::attributes &att, const String &uri)
 define the default namespace.

template<typename String> xstring get_namespace (xml::attributes &att, String &short_namespace)
 Get the uri from the short namespace.

xstring get_namespace (xml::attributes &att)
 get the default namespace.

template<typename String> xstring get_short_namespace (xml::attributes &att, String &uri)
 get the uri from the short namespace.


Variables

XIMOL_BEGIN_NAMESPACE class xistream


Function Documentation

template<typename StringT, typename T>
bool get_attribute xml::attributes const &  att,
StringT const &  name,
T &  value
 

Deserialize the attribute from the name.

Definition at line 415 of file attributes.hpp.

Referenced by extract_attribute< T >::get().

template<typename StringT1, typename StringT2, typename T>
bool get_attribute xml::attributes const &  att,
StringT1 const &  namespace_name,
StringT2 const &  name,
T &  value
 

Deserialize the attribute value.

Parameters:
value  Type requirements: copy constructable, serializable. T doesn't need to be default constructable.
Examples:
tutorial_attribute.cpp.

Definition at line 383 of file attributes.hpp.

xstring get_namespace xml::attributes att  )  [inline]
 

get the default namespace.

Parameters:
att the xml::attributes.
Returns:
return the default namespace of the xml::attributes.

Definition at line 553 of file attributes.hpp.

References xstring.

template<typename String>
xstring get_namespace xml::attributes att,
String &  short_namespace
 

Get the uri from the short namespace.

Parameters:
att the xml::attributes.
short_namespace the short namespace.
Returns:
the uri or the short_namespace (in input) if the uri is not found.
Examples:
tutorial_attribute.cpp.

Definition at line 539 of file attributes.hpp.

References xstring.

template<typename StringT>
xstring get_raw_attribute xml::attributes const &  att,
StringT const &  name
 

Deserialize the attribute from the name.

Definition at line 439 of file attributes.hpp.

References xstring.

Referenced by extract_attribute< std::wstring >::get(), and extract_attribute< std::string >::get().

template<typename StringT1, typename StringT2>
xstring get_raw_attribute xml::attributes const &  att,
StringT1 const &  namespace_name,
StringT2 const &  name
 

Deserialize the attribute from the name.

Examples:
tutorial_attribute.cpp.

Definition at line 424 of file attributes.hpp.

References xstring.

template<typename String>
xstring get_short_namespace xml::attributes att,
String &  uri
 

get the uri from the short namespace.

This template version call the internal function of the xml::attributes.

Parameters:
att the xml::attributes.
uri the long version of the namespace.
Returns:
the short namespace or the uri (in input) if the short namespace is not found.
Examples:
tutorial_attribute.cpp.

Definition at line 571 of file attributes.hpp.

References xstring.

XIMOL_EXPORT ::std::ostream& operator<< ::std::ostream &  os,
attributes const &  x
 

put to operator for attributes on standard stream

Definition at line 350 of file attributes.cpp.

References xostringstream::str().

xostream& operator<< xostream xos,
attributes const &  rhs
[inline]
 

put to operator for attributes

Definition at line 282 of file attributes.hpp.

References attributes::write().

xistream& operator>> xistream xis,
attributes rhs
[inline]
 

get from operator for attributes

Definition at line 290 of file attributes.hpp.

References attributes::read().

template<typename StringT, typename T>
void set_attribute xml::attributes att,
StringT const &  name,
T const &  value
 

set an xml::attributes

Definition at line 370 of file attributes.hpp.

template<typename StringT1, typename StringT2, typename T>
void set_attribute xml::attributes att,
StringT1 const &  namespace_name,
StringT2 const &  name,
T const &  value
 

set an attribute

Examples:
tutorial_attribute.cpp.

Definition at line 354 of file attributes.hpp.

template<typename String>
void set_namespace xml::attributes att,
const String &  uri
 

define the default namespace.

Parameters:
att the xml::attributes.
uri the futur default namespace.

Definition at line 526 of file attributes.hpp.

template<typename String1, typename String2>
bool set_namespace xml::attributes att,
String1 &  short_namespace,
const String2 &  uri
 

define a short_namespace for an uri.

Parameters:
att the xml::attributes.
short_namespace the short cut
uri the namespace or uri.
Examples:
tutorial_attribute.cpp.

Definition at line 514 of file attributes.hpp.


Variable Documentation

XIMOL_BEGIN_NAMESPACE class xistream
 

Definition at line 114 of file attributes.hpp.

Referenced by xiostream::operator>>().



Donate to the XiMoL project SourceForge.net Logo If you have any questions about XiMoL, you could write to tournois@users.sourceforge.net.