freesecs::secstwo::string_data_item_t< _type > Class Template Reference

String data item family implementation For JIS-8 and UNICODE data items, the contents is converted from WCHAR to UTF-8 on deverialization and back from UTF-8 to WCHAR on serialization. Internally, contents is operated in UTF-8 format. To make format conversion, libiconv is used. At least two encodings must it be installed with - UTF-8 and WCHAR. More...

#include <secstwo_internal.hpp>

Inheritance diagram for freesecs::secstwo::string_data_item_t< _type >:

Inheritance graph
[legend]
Collaboration diagram for freesecs::secstwo::string_data_item_t< _type >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef type_selector< _type >
::data_type 
data_t
typedef type_selector< _type >
::print_type 
print_t
typedef type_selector< _type >
::container_type 
container_t

Public Member Functions

 string_data_item_t (const char *name)
 string_data_item_t (const char *name, uint8_t *data)
 string_data_item_t (const char *name, uint8_t *data, size_t data_len)
 string_data_item_t (const char *name, const wchar_t *data)
virtual data_type_t type () const
 Returns data item type.
virtual operator std::string () const
 String type cast operator. Casts a data item to the given primary type. Any numeric data item can be casted to any numeric type. String data items and list data items return 0 (zero) if to attempt to cast to a numeric type Numeric and list types return an empty string if to attempt to cast to a string.
virtual data_item_toperator= (const char *data)
 String type assignment operator It is possible to assign any numeric type to any numeric type. Assignment of a numeric type to a string or list type takes no effect. Old data is overwritten by this operator, i.e. if there were an array of data, operator cleans it up and pushes back the new value.
virtual data_item_toperator= (const std::string &data)
 String type assignment operator It is possible to assign any numeric type to any numeric type. Assignment of a numeric type to a string or list type takes no effect. Old data is overwritten by this operator, i.e. if there were an array of data, operator cleans it up and pushes back the new value.
virtual data_item_toperator+= (const char *data)
virtual data_item_toperator+= (const std::string &data)
virtual bool operator== (const std::string &o) const
 String comparison operator.
virtual bool match (const data_item_t &other, match_t match=ALL) const
 Function to match a given data item to another data item.
virtual pdata_item_t clone () const
 Creates a copy of the message. Calls data item copy constructor and puts newly returned data item into a shared ptr. Contrary to cloning shared ptrs with ref count on a message is incremented, cloned message is a separate one and it's data can be edited with no impact to the nacestor data item.
virtual void clear_data ()
 Clears all data in a data item.
virtual int copy_data (const data_item_t &o)
 Copies all data from the given item. Data copy is made if data items have same type. For list item copy data is made reqursively and does not stop upon unsuccesful data copy.
virtual size_t size () const
 Returns number of elements.
virtual size_t raw_size () const
 Returns number of bytes the item occupies in binary format.
virtual void print (std::ostream &os, const char *prefix=NULL) const
 Prints the item in human-readable format.

Public Attributes

container_t _data


Detailed Description

template<data_type_t _type>
class freesecs::secstwo::string_data_item_t< _type >

String data item family implementation For JIS-8 and UNICODE data items, the contents is converted from WCHAR to UTF-8 on deverialization and back from UTF-8 to WCHAR on serialization. Internally, contents is operated in UTF-8 format. To make format conversion, libiconv is used. At least two encodings must it be installed with - UTF-8 and WCHAR.

Definition at line 848 of file secstwo_internal.hpp.


Member Function Documentation

template<data_type_t _type>
virtual data_type_t freesecs::secstwo::string_data_item_t< _type >::type (  )  const [inline, virtual]

Returns data item type.

See also:
data_type_t

Reimplemented from freesecs::secstwo::data_item_t.

Definition at line 904 of file secstwo_internal.hpp.

template<data_type_t _type>
virtual data_item_t& freesecs::secstwo::string_data_item_t< _type >::operator= ( const char *   )  [inline, virtual]

String type assignment operator It is possible to assign any numeric type to any numeric type. Assignment of a numeric type to a string or list type takes no effect. Old data is overwritten by this operator, i.e. if there were an array of data, operator cleans it up and pushes back the new value.

Returns:
Reference to self

Reimplemented from freesecs::secstwo::data_item_t.

Definition at line 912 of file secstwo_internal.hpp.

template<data_type_t _type>
virtual data_item_t& freesecs::secstwo::string_data_item_t< _type >::operator= ( const std::string &   )  [inline, virtual]

String type assignment operator It is possible to assign any numeric type to any numeric type. Assignment of a numeric type to a string or list type takes no effect. Old data is overwritten by this operator, i.e. if there were an array of data, operator cleans it up and pushes back the new value.

Returns:
Reference to self

Reimplemented from freesecs::secstwo::data_item_t.

Definition at line 918 of file secstwo_internal.hpp.

template<data_type_t _type>
virtual bool freesecs::secstwo::string_data_item_t< _type >::operator== ( const std::string &   )  const [inline, virtual]

String comparison operator.

Returns:
Result of comparison operation
Return values:
true Comparison successful
false Comparison unsuccessful - either data or structure (for lists) or type do not match

Reimplemented from freesecs::secstwo::data_item_t.

Definition at line 934 of file secstwo_internal.hpp.

template<data_type_t _type>
virtual bool freesecs::secstwo::string_data_item_t< _type >::match ( const data_item_t it,
match_t  match = ALL 
) const [inline, virtual]

Function to match a given data item to another data item.

Parameters:
it Item to match.
match Token of kind of match.
See also:
match_t

Reimplemented from freesecs::secstwo::data_item_t.

Definition at line 939 of file secstwo_internal.hpp.

References freesecs::secstwo::string_data_item_t< _type >::_data, and freesecs::secstwo::data_item_t::type().

Here is the call graph for this function:

template<data_type_t _type>
virtual int freesecs::secstwo::string_data_item_t< _type >::copy_data ( const data_item_t  )  [inline, virtual]

Copies all data from the given item. Data copy is made if data items have same type. For list item copy data is made reqursively and does not stop upon unsuccesful data copy.

Returns:
Data copy result.
Return values:
0 Data copy successful
< 0 Data copy performed with errors

Reimplemented from freesecs::secstwo::data_item_t.

Definition at line 971 of file secstwo_internal.hpp.

References freesecs::secstwo::string_data_item_t< _type >::_data, and freesecs::secstwo::data_item_t::type().

Here is the call graph for this function:


The documentation for this class was generated from the following file:

Generated on Sun Jun 20 08:10:07 2010 for FREESECS secstwo by  doxygen 1.5.6