Public Types | Public Member Functions | Static Public Member Functions

Glib::Variant< std::string > Class Template Reference
[Variant Data Types]

Specialization of Variant containing a std::string (a non-capable UTF-8 string). More...

#include <glibmm/variant.h>

Inheritance diagram for Glib::Variant< std::string >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef char* CType
typedef std::string CppType

Public Member Functions

 Variant ()
 Default constructor.
 Variant (GVariant* castitem, bool take_a_reference=false)
 GVariant constructor.
std::string get () const
 Returns the string value of a Variant instance with an array-of-bytes type.

Static Public Member Functions

static const VariantTypevariant_type ()
 Gets the VariantType.
static Variant< std::stringcreate (const std::string& data)
 Creates a new Variant<std::string>.

Detailed Description

template <>
class Glib::Variant< std::string >

Specialization of Variant containing a std::string (a non-capable UTF-8 string).

Since glibmm 2.28:

Member Typedef Documentation

Reimplemented from Glib::VariantStringBase.

typedef char* Glib::Variant< std::string >::CType

Reimplemented from Glib::VariantStringBase.


Constructor & Destructor Documentation

Glib::Variant< std::string >::Variant (  ) [inline]

Default constructor.

Glib::Variant< std::string >::Variant ( GVariant< std::string > *  castitem,
bool  take_a_reference = false 
) [inline, explicit]

GVariant constructor.

Parameters:
castitemThe GVariant to wrap.
take_a_referenceWhether to take an extra reference of the GVariant or not (not taking one could destroy the GVariant with the wrapper).

Member Function Documentation

static Variant<std::string> Glib::Variant< std::string >::create ( const std::string data ) [static]

Creates a new Variant<std::string>.

Parameters:
dataThe value of the new Variant.
Returns:
The new Variant.
Since glibmm 2.28:
std::string Glib::Variant< std::string >::get (  ) const

Returns the string value of a Variant instance with an array-of-bytes type.

The string has no particular encoding.

If the array does not end with a nul terminator character, the empty string is returned. For this reason, you can always trust that a non-0 nul-terminated string will be returned by this function.

If the array contains a nul terminator character somewhere other than the last byte then the returned string is the string, up to the first such nul character.

It is an error to call this function with a value that is not an array of bytes.

The return value remains valid as long as value exists.

Since glibmm 2.26:
Returns:
The constant string.
static const VariantType& Glib::Variant< std::string >::variant_type (  ) [static]

Gets the VariantType.

Returns:
The VariantType.
Since glibmm 2.28: