![]() |
das2C
das core C utilities (v3)
|
Individual properties of a descriptor. More...
#include <das3/property.h>
Public Member Functions | |
| DasErrCode | DasProp_init (ubyte *pBuf, size_t uBufSz, const char *sType, ubyte uType, const char *sName, const char *sValue, char cSep, das_units units, int nStandard) |
| Flexible das1, das2 and das3 compatible property memory initializer. | |
| size_t | DasProp_size (const DasProp *pProp) |
| Return the memory footprint of a property. | |
| #define | DasProp_name(P) ((P)->buffer) |
| Get name of a property. | |
| const char * | DasProp_value (const DasProp *pProp) |
| Get the string value for a property. | |
| size_t | DasProp_escapeSize (const DasProp *pProp) |
| Get the size of needed escape buffer if property contains illegal XML chars. | |
| const char * | DasProp_xmlValue (const DasProp *pProp, char *sBuf, size_t uLen) |
| Get the string value for a property with illegal XML characters escaped. | |
| char | DasProp_sep (const DasProp *pProp) |
| Get the value separator character for array-style properties. | |
| bool | DasProp_equal (const DasProp *pOne, const DasProp *pTwo) |
| Determine if two properties contain equal content. | |
| const char * | DasProp_typeStr2 (const DasProp *pProp) |
| Get a das2 type string for this property | |
| const char * | DasProp_typeStr3 (const DasProp *pProp) |
| Get a das3 type string for this property. | |
| int | DasProp_convertInt (const DasProp *pProp, int64_t *pBuf, size_t uBufLen) |
| Convert integer property values to 64-bit ints. | |
| int | DasProp_convertReal (const DasProp *pProp, double *pBuf, size_t uBufLen) |
| Convert real-value properties to double. | |
| int | DasProp_convertBool (const DasProp *pProp, uint8_t *pBuf, size_t uBufLen) |
| Convert boolean property values to bytes. | |
| int | DasProp_convertTt2k (const DasProp *pProp, int64_t *pBuf, size_t uBufLen) |
| Convert datatime properties TT2K long integers. | |
| int | DasProp_convertTime (const DasProp *pProp, uint64_t *pBuf, size_t uBufLen) |
| Convert datatime properties to a double based value of units. | |
| int | DasProp_extractItems (const DasProp *pProp, char **psBuf, size_t uNumStrs, size_t uLenEa) |
| Just extract the property strings, don't convert anything. | |
| ubyte | DasProp_type (const DasProp *pProp) |
| Get a property type code. | |
| void | DasProp_invalidate (DasProp *pProp) |
| Mark this property as invalid, this erases the type information and is thus a non-reversible operation. | |
| bool | DasProp_isValid (const DasProp *pProp) |
| Determine if this property has a valid type definition. | |
| int | DasProp_items (const DasProp *pProp) |
| Determine the number of items in a multi valued property. | |
| #define | DasProp_isType(P, T) ((P->flags & DASPROP_TYPE_MASK) == T) |
| Ask if a property values are a particular type. | |
| #define | DasProp_isRange(P) ((P->flags & DASPROP_RANGE)==DASPROP_RANGE) |
| Returns true if this property has range multiplicity (aka 2 items) | |
| #define | DasProp_isSet(P) ((P->flags & DASPROP_SET)==DASPROP_SET) |
| Returns true if this property has more then one element (aka a set) but the set isn't a bounding range. | |
Individual properties of a descriptor.
DasProp objects assume that some other object, such as a DasAry the storage buffer and that these functions configure and read that storage. Thus there are no "new_" or "del_" function for properties.
Each property has:
| DasErrCode DasProp_init | ( | ubyte * | pBuf, |
| size_t | uBufSz, | ||
| const char * | sType, | ||
| ubyte | uType, | ||
| const char * | sName, | ||
| const char * | sValue, | ||
| char | cSep, | ||
| das_units | units, | ||
| int | nStandard | ||
| ) |
Flexible das1, das2 and das3 compatible property memory initializer.
| pBuf | A byte buffer that is at least dasprop_memsz() bytes long |
| sType | The data type of the property, can be one of:
|
| uType | An alternate and more efficient method of specifying the property type. If sType is NULL, this is read instead. To set uType or together one constant from each set below. |
Item type: DASPROP_STRING, DASPROP_BOOL, DASPROP_INT, DASPROP_REAL, DASPROP_DATETIME
Multiplicity: DASPROP_SINGLE, DASPROP_RANGE, DASPROP_SET
| sName | The name of the property, can be no longer then 127 bytes. This is a looser restriction then associated XSDs. |
| sValue | The data value, can be no longer then 130,943 bytes. |
| cSep | For array values, this (in addition to possible whitespace) is the separator between values. Ignored if Multiplicity is not DASPROP_SET. |
| units | The units for this value. If the type is Datum or DatumRange this value will be ignored, otherwise if this value is NULL then UNIT_DIMENSIONLESS will be assigned. |
| nStandard. | One of 1, 2 or 3 for das1, das2, or das3. For das2 & 3, property names may only consist of the characters [a-z][A-Z][0-9] and '_'. |
| size_t DasProp_escapeSize | ( | const DasProp * | pProp | ) |
Get the size of needed escape buffer if property contains illegal XML chars.
| const char * DasProp_xmlValue | ( | const DasProp * | pProp, |
| char * | sBuf, | ||
| size_t | uLen | ||
| ) |
Get the string value for a property with illegal XML characters escaped.
| pProp | pointer to the property in question |
| sBuf | pointer to a buffer to hold the translated property |
| uLen | length of the buffer which holds the translated property |
If XML escape codes are needed and the given buffer is too small das_error is called, which may (depending on the error disposition) halt the program.
| int DasProp_convertInt | ( | const DasProp * | pProp, |
| int64_t * | pBuf, | ||
| size_t | uBufLen | ||
| ) |
Convert integer property values to 64-bit ints.
Returns the number of conversions, or a negative error value
| int DasProp_convertReal | ( | const DasProp * | pProp, |
| double * | pBuf, | ||
| size_t | uBufLen | ||
| ) |
Convert real-value properties to double.
| int DasProp_convertBool | ( | const DasProp * | pProp, |
| uint8_t * | pBuf, | ||
| size_t | uBufLen | ||
| ) |
Convert boolean property values to bytes.
| int DasProp_convertTt2k | ( | const DasProp * | pProp, |
| int64_t * | pBuf, | ||
| size_t | uBufLen | ||
| ) |
Convert datatime properties TT2K long integers.
| int DasProp_extractItems | ( | const DasProp * | pProp, |
| char ** | psBuf, | ||
| size_t | uNumStrs, | ||
| size_t | uLenEa | ||
| ) |
Just extract the property strings, don't convert anything.
| ubyte DasProp_type | ( | const DasProp * | pProp | ) |
Get a property type code.
Use the values: DASPROP_MULTI_MASK & DASPROP_TYPE_MASK to extract sections