/home/mupuf/Programmation/CVariant/cvariant.h File Reference
#include <sys/types.h>
Go to the source code of this file.
Detailed Description
- Author:
- MùPùF - Martin Peres (martin<dot>peres<At>ensi-bourges<dot>fr)
- Date:
- 04-08-2009
Enumeration Type Documentation
CVariant Types.
- Enumerator:
-
| cvariant_none |
None. |
| cvariant_string |
String. |
| cvariant_int |
Int. |
| cvariant_float |
Float. |
Function Documentation
Compare two cvariants.
- Parameters:
-
- Returns:
- Returns a non-zero value if a!=b, 0 otherwise.
Compare two cvariants. if a!=b, returns zero, otherwise, return a non-zero value.
Frees the memory allocated by the variant (if any).
- Parameters:
-
| cvariant cvariant_from_float |
( |
double |
value |
) |
|
Create a CVariant from a given.
- Parameters:
-
| value,: | The float to be stored into the cvariant. |
- Returns:
- Returns the corresponding cvariant.
| cvariant cvariant_from_int |
( |
int |
value |
) |
|
Create a CVariant from a given integer.
- Parameters:
-
| value | The integer to be stored into the cvariant. |
- Returns:
- Returns the corresponding cvariant.
| cvariant cvariant_from_string |
( |
const char * |
string |
) |
|
Create a CVariant from a given string. WARNING: Do not free the pointer and still use the cvariant. If you want to do so, use cvariant_from_string_copy.
- Parameters:
-
| string | The string to be stored into the cvariant |
- Returns:
- Returns the corresponding cvariant.
| cvariant cvariant_from_string_copy |
( |
const char * |
string, |
|
|
size_t |
n | |
|
) |
| | |
Create a CVariant from a given string (copy, dynamically allocated).
- Parameters:
-
| string | The string to be copied and stored into the cvariant. |
- Returns:
- Returns the corresponding cvariant.
| double cvariant_get_float |
( |
cvariant |
cv |
) |
|
Get an float from a cvariant.
- Parameters:
-
| cv | The cvariant you want to get the float from. |
- Returns:
- Returns the float or CVARIANT_EMPTY_FLOAT if it is not an integer.
Get a float from a
cvariant. If the
cvariant is not a float, -1.0 is returned.
Get an integer from a cvariant.
- Parameters:
-
| cv | The cvariant you want to get the integer from. |
- Returns:
- Returns the integer or CVARIANT_EMPTY_INTEGER if it is not an integer.
Get an integer from a
cvariant. If the
cvariant is not an integer, -1 is returned.
| const char* cvariant_get_string |
( |
cvariant |
cv |
) |
|
Get a string from a cvariant.
- Parameters:
-
| cv | The cvariant you want to get the string from. |
- Returns:
- Returns a null-terminated string or CVARIANT_EMPTY_STRING if it is not a string.
Get a string from a
cvariant. If the
cvariant is not a string, NULL is returned.
Get the current type of a cvariant.
- Parameters:
-
| cv | The cvariant you want to get the type from. |
- Returns:
- Returns a the type
Test if a cvariant is null.
- Parameters:
-
- Returns:
- Returns a non-zero value if the cvariant is not null, 0 otherwise
Create an empty CVariant.
- Returns:
- Returns a null cvariant