|
CX Framework
Cross-platform C utility framework
|
Macros | |
| #define | stDestroy(type, pobj, ...) _stDestroy(stFullType(type), stArgPtr(type, pobj), opt_flags(__VA_ARGS__)) |
| #define | stCmp(type, obj1, obj2, ...) _stCmp(stFullType(type), stArg(type, obj1), stArg(type, obj2), opt_flags(__VA_ARGS__)) |
| #define | stCopy(type, pdest, src, ...) _stCopy(stFullType(type), stArgPtr(type, pdest), stArg(type, src), opt_flags(__VA_ARGS__)) |
| #define | stHash(type, obj, ...) _stHash(stFullType(type), stArg(type, obj), opt_flags(__VA_ARGS__)) |
| #define | stConvert(desttype, pdest, srctype, src, ...) |
Type-safe wrappers for common operations on typed values. These macros expand to the appropriate function calls with compile-time type checking.
| #define stCmp | ( | type, | |
| obj1, | |||
| obj2, | |||
| ... | |||
| ) | _stCmp(stFullType(type), stArg(type, obj1), stArg(type, obj2), opt_flags(__VA_ARGS__)) |
intptr stCmp(type, obj1, obj2, [flags])
Compare two typed values for ordering.
| type | Type name |
| obj1 | First value |
| obj2 | Second value |
| ... | (flags) Optional operation flags:
|
Example:
| #define stConvert | ( | desttype, | |
| pdest, | |||
| srctype, | |||
| src, | |||
| ... | |||
| ) |
bool stConvert(desttype, pdest, srctype, src, [flags])
Convert a value from one type to another.
WARNING: Overwrites destination without destroying existing value.
| desttype | Destination type name |
| pdest | Pointer to destination |
| srctype | Source type name |
| src | Source value |
| ... | (flags) Conversion flags:
|
Example:
| #define stCopy | ( | type, | |
| pdest, | |||
| src, | |||
| ... | |||
| ) | _stCopy(stFullType(type), stArgPtr(type, pdest), stArg(type, src), opt_flags(__VA_ARGS__)) |
void stCopy(type, pdest, src, [flags])
Copy a typed value from source to destination.
WARNING: Overwrites destination without destroying existing value. For managed types, the destination must be uninitialized or already destroyed.
| type | Type name |
| pdest | Pointer to destination |
| src | Source value |
| ... | (flags) Optional operation flags |
Example:
| #define stDestroy | ( | type, | |
| pobj, | |||
| ... | |||
| ) | _stDestroy(stFullType(type), stArgPtr(type, pobj), opt_flags(__VA_ARGS__)) |
void stDestroy(type, pobj, [flags])
Destroy a typed value, releasing any resources it owns.
Calls the appropriate destructor based on the type. For reference-counted types, decrements the reference count. For containers, recursively destroys elements. For primitives, this is typically a no-op.
| type | Type name (e.g., string, int32, object) |
| pobj | Pointer to the value to destroy |
| ... | (flags) Optional operation flags |
Example:
| #define stHash | ( | type, | |
| obj, | |||
| ... | |||
| ) | _stHash(stFullType(type), stArg(type, obj), opt_flags(__VA_ARGS__)) |
uint32 stHash(type, obj, [flags])
Compute a hash value for a typed value.
| type | Type name |
| obj | Value to hash |
| ... | (flags) Optional operation flags:
|
Example: