本文整理汇总了C++中Klass::get_symbol方法的典型用法代码示例。如果您正苦于以下问题:C++ Klass::get_symbol方法的具体用法?C++ Klass::get_symbol怎么用?C++ Klass::get_symbol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Klass
的用法示例。
在下文中一共展示了Klass::get_symbol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/*
* .
*/
int main(int argc, char *argv[])
{
PheapIndex* idx;
Klass* klass;
Klass* klass2;
Symbol* symbol;
idx = PheapIndex::instance();
if (ph_isnew()) {
klass = new Klass;
printf("klass=%p\n", klass);
klass2 = new Klass;
printf("klass2=%p\n", klass2);
char* class_name = (char*) ph_malloc(3);
strcpy(class_name, "AB");
klass->set_class_name(class_name);
char* k_n = klass->get_class_name();
printf("class name: %s\n", k_n);
symbol = new Symbol;
char* symbol_name = (char*) ph_malloc(3);
strcpy(symbol_name, "BC");
symbol->set_name(symbol_name);
klass->set_symbol(symbol);
idx->add_klass(class_name, klass);
idx->add_klass(symbol_name, klass2);
// test heap limits
while (1) {
ph_malloc(1024);
}
} else {
klass = idx->get_class((char*)"AB");
if (klass == NULL) printf("Klass not found!");
char* k_n = klass->get_class_name();
printf("class name: %s\n", k_n);
printf("symbol name: %s\n", klass->get_symbol()->get_name());
klass2 = idx->get_class((char*)"BC");
}
ph_close();
}