mco_dict_struct_name
原型
MCO_RET mco_dict_struct_name( /*IN*/ mco_metadict_header_t * metadict,
/*IN*/ unsigned short dict_no,
/*IN*/ const char * name,
/*OUT*/ mco_dict_struct_info_t * struct_info );
参数
metadict | 要初始化的 mco_metadict_header_t 结构的地址 |
dict_no | 字典的编号 ( 必须介于 0 和 mco_metadict_count() 之间。 -1 ) |
name | 架构中定义的结构/类的名称 |
struct_info | 用于接收结构/类描述符的变量的地址mco_dict_struct_info_t |
描述
返回 name 引用的结构/类的描述符。
此函数返回数组和类/结构中的索引引用的结构/类的描述符(如 schema 中所定义)。dict_no``metadict->entries[]``name
返回
MCO_S_OK | 已成功返回结构/类描述符 |
MCO_E_UDA_DICT_NOTFOUND | 词典未注册 |
MCO_E_UDA_STRUCT_NOTFOUND | 结构名称无效 |
示例
/* 应用程序代码片段 */
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;
const char * name = "MyClass";
mco_dict_struct_info_t struct_info;
...
header = (mco_metadict_header_t *) malloc(size);
mco_metadict_init(header, size); /* initialize the metadict */
...
rc = mco_dict_struct_name(header, dict_no, name, &struct_info);
}