XB Library: xb::type

The XB nodes may store type information regarding the value stored. The xb::type is template that is specialized for every instrinsic type as stated in format specification.


Interface:

namespace xb {
    template <typename T>
    struct type {
        static const xb::element info;
    };
};

Following data types are defined by specification:

The specialization is provided for following data types:

User type information:

When it is neccessary to provide type information for another or user-defined type, all you need to do is write a specialization of the xb::type template for that type.

Examples:

// ...

struct myType {
    int a;
    int b;
    int c;
};

namespace xb {
    template <> struct type <myType>
        { static const element info; };

    const element type <myType> ::info ("myType"); // this line would go into .cpp
};

// ...

myType val;
xb::node n (name, val);

n.serialize (...);

// ...

Remarks:

None.


[index]