Return a structure/class descriptor.
MCO_RET mco_dict_struct(
/*IN*/ mco_metadict_header_t * metadict,
/*IN*/ unsigned short dict_no,
/*IN*/ unsigned short struct_no,
/*OUT*/ mco_dict_struct_info_t * struct_info
);
metadict
dict_no
mco_metadict_count() - 1).struct_no
mco_dict_struct_count() - 1).struct_info
mco_dict_struct_info_t variable to receive the structure/class descriptor.This function returns the structure/class descriptor referred to by the index
dict_noin the arraymetadict->entries[]and class/structure numberstruct_no.
MCO_S_OK
MCO_E_UDA_STRUCT_NOTFOUND
struct_no.
Application snippet:
const char * dbname = "SimpleDb";
int main(int argc, char* argv[])
{
MCO_RET rc;
unsigned int dict_no = 0;
unsigned int count;
mco_metadict_header_t *header;
...
header = (mco_metadict_header_t *) malloc(size);
mco_metadict_init(header, size); /* initialize the metadict */
...
mco_dict_struct_count(header, dict_no, &count);
for (i = 0; i < count; ++i)
{
mco_dict_struct_info_t struct_info;
/* get structure descriptor */
rc = mco_dict_struct(header, dict_no, i, &struct_info);
if (struct_info.flags & MCO_DICT_SI_CLASS) {
printf("Class %d : %s\n", i, struct_info.name);
} else {
printf("Structure %d : %s\n", i, struct_info.name);
}
}
...
}