Integer type code.
TypeCode is a single integer value containing a code which identifies a plain old data type. Its main purpose is to standardize the way binary data is tagged in files using integer or string code tags.
|
| TypeCode () |
| create undefined code object
|
|
| TypeCode (int v) |
| create a defined object
|
|
bool | operator== (const TypeCode &c) const |
| equivalence
|
|
bool | operator!= (const TypeCode &c) const |
| equivalence
|
|
const char * | toString () const |
| string representation of current code value
|
|
int | value () const |
| access value
|
|
int | width () const |
| width of the type in bytes
|
|
bool | isReal () const |
| type is real-valued, but not complex
|
|
bool | isComplex () const |
| type is complex-valued
|
|
bool | isInt () const |
| type is integer
|
|
bool | isString () const |
| type is string
|
|
bool | compatible (TypeCode a) const |
| tests if value conversion will succeed
|
|
template<typename ValueType > |
bool | extract (const char *raw, ValueType &x) const |
| convert from memory location to value
|
|
template<typename ValueType > |
bool | extract (size_t nval, const char *raw, ValueType dst[]) const |
| copy with value conversion, assuming dst has enough space
|
|
template<typename IndexType , typename ValueType > |
bool | extract (size_t nidx, const IndexType idx[], const char *raw, ValueType dst[]) const |
| copy with value conversion, assuming dst has enough space
|
|
template<typename ValueType > |
bool | inject (size_t nval, const ValueType a[], char *dst) const |
| copy with value conversion, assuming dst has enough space
|
|
bool | toXmlBlock (XmlElement &xe, size_t nval, const char *ptr, bool share) const |
| create a data block in XML element
|
|
bool | fromXmlBlock (const XmlElement &xe, size_t nval, char *ptr) |
| retrieve a data block from XML element
|
|
|
static int | width (int code) |
| width of the type in bytes
|
|
static TypeCode | fromString (const std::string &s) |
| create type code from string
|
|
template<typename PodType > |
static TypeCode | of () |
| generate type code at compile time
|
|
template<typename SrcType , typename DstType > |
static DstType | recast (const char *raw, size_t i) |
| type conversion, general form
|
|
template<typename SrcType , typename DstType > |
static void | copy (const char *raw, size_t nval, DstType *dst) |
| type conversion, general form
|
|
static bool | fromString (const char *s, char **tail, int &value) |
| utility overload
|
|
static bool | fromString (const char *s, char **tail, uint &value) |
| utility overload
|
|
static bool | fromString (const char *s, char **tail, int8_t &value) |
| utility overload
|
|
static bool | fromString (const char *s, char **tail, uint8_t &value) |
| utility overload
|
|
static bool | fromString (const char *s, char **tail, int16_t &value) |
| utility overload
|
|
static bool | fromString (const char *s, char **tail, uint16_t &value) |
| utility overload
|
|
static bool | fromString (const char *s, char **tail, int64_t &value) |
| utility overload
|
|
static bool | fromString (const char *s, char **tail, uint64_t &value) |
| utility overload
|
|
static bool | fromString (const char *s, char **tail, double &value) |
| utility overload
|
|
static bool | fromString (const char *s, char **tail, float &value) |
| utility overload
|
|
static int | nkeys () |
| number of keys defined
|
|