Represent an instance of the ultimate base object.
◆ XTD_OBJECT
#define XTD_OBJECT |
( |
|
object | ) |
(XTD_TYPE_CAST(object, XTD_OBJECT_TYPE, xtd_object)) |
Convert an xtd object to ultimate base object.
- Library
- xtd_c.core
◆ xtd_object_create()
Create a new instance of the ultimate base object.
- Returns
- New object created.
- Library
- xtd_c.core
- Examples
- This example shows how to use xtd_object_create and xtd_object_destroy to create and destroy an xtd_object.
int main(int argc, char* argv[]) {
}
◆ xtd_object_destroy()
Destroy the instance of the specfied object.
- Parameters
-
value | The object to delete. |
- Library
- xtd_c.core
- Examples
- This example shows how to use xtd_object_create and xtd_object_destroy to create and destroy an xtd_object.
int main(int argc, char* argv[]) {
}
This example shows how to use xtd_object_destroy to destroy an xtd_version object by using the XTD_OBJECT method to convert xtd_version to xtd_object. int main(int argc, char* argv[]) {
xtd_version* version = xtd_create_version(1, 2, 3);
}
◆ xtd_object_to_string()
const char* xtd_object_to_string |
( |
const xtd_object * |
value | ) |
|
Returns a string that represents the specified object.
- Parameters
-
value | The object to retrieve the string. |
- Returns
- pointer to the string that will contain the representation of the specified object.
- Library
- xtd_c.core
◆ xtd_object_to_string_s()
size_t xtd_object_to_string_s |
( |
const xtd_object * |
value, |
|
|
char * |
string, |
|
|
size_t |
size |
|
) |
| |
Returns a string that represents the specified object.
- Parameters
-
value | The object to retrieve the string. |
string | A pointer to the string that will contain the representation of the specified object. |
size | The size og the specified string. |
- Returns
- The size in characters of the representation of the specified object.
- Library
- xtd_c.core
- Examples
- This example shows how to use xtd_object_to_string with an xtd_version object.
int main(int argc, char* argv[]) {
xtd_version* version = xtd_create_version(1, 2, 3);
char version_string[256];
console::write_line("%s", version_string);
xtd_version_destroy(version);
}
- Examples
- This example shows how to use xtd_object_to_string with the xtd_version object by using the possibility to get the size before allocating the string.
xtd_version* version = xtd_create_version(1, 2, 3);
char* version_string = (char*)malloc(size);
console_write_line("%s", version_string);
free(version_string);
xtd_version_destroy(version);
}