ZEDA
1.6.18
|
common named class. More...
#include <zeda/zeda_misc.h>
Go to the source code of this file.
Macros | |
#define | Z_NAMED_CLASS char *name; |
an inheritance of named class. More... | |
#define | ZNONAME "noname" |
the default name for no-name. More... | |
#define | zNamePtr(c) (c)->name |
#define | zNameSetPtr(c, p) ( (c)->name = (p) ) |
#define | zName(c) ( (c) && zNamePtr(c) ? zNamePtr(c) : ZNONAME ) |
#define | zNameSet(c, n) zNameSetPtr( c, zStrClone(n) ) |
#define | zNameFree(c) zFree( zNamePtr(c) ) |
#define | zNameFind(array, n, name, ptr) |
common named class.
#define Z_NAMED_CLASS char *name; |
an inheritance of named class.
Z_NAMED_CLASS macro works as a keyword to inherit a named class, namely, a class which can be identified by a string.
The inheritance can have a string to represent its name, which is referred by zName(). Use zNameSet() to set the name. Use zNameFree() to free the name string.
When searching an instance with a name name from an array of the class, call zNameFind( array, n, name, ptr ); where array is the pointer to array, n is the size of the array, name is a string to be referred, and ptr is a pointer to the element found. If it fails to find a corresponding element, the null pointer set for ptr.
#define ZNONAME "noname" |
the default name for no-name.
#define zNamePtr | ( | c | ) | (c)->name |
#define zNameSetPtr | ( | c, | |
p | |||
) | ( (c)->name = (p) ) |
#define zNameSet | ( | c, | |
n | |||
) | zNameSetPtr( c, zStrClone(n) ) |
#define zNameFind | ( | array, | |
n, | |||
name, | |||
ptr | |||
) |