本文整理汇总了C++中Func::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ Func::GetName方法的具体用法?C++ Func::GetName怎么用?C++ Func::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func::GetName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Output
void Dynamic::Output(Lex& lex, FILE *h, FILE *cpp, const char *class_name)
{
static int count = 0;
Param *next;
Func *func;
count++;
fprintf(cpp,
"struct __func%d_t {\n"
"\tmolib::mo_name_t f_name;\n"
"\tvoid (%s::*f_func)(", count, class_name);
if(f_timed) {
fprintf(cpp, "time_t __time");
}
next = f_params;
while(next != 0) {
if(next != f_params || f_timed) {
fprintf(cpp, ", ");
}
fprintf(cpp, "%s", next->f_type);
next = next->f_next;
}
fprintf(cpp, ");\n"
"};\n"
"static molib::moBase::compare_t __compare_func%d(const void *a, const void *b)\n"
"{\n"
"\treturn molib::moBase::CompareInt("
"reinterpret_cast<const __func%d_t *>(a)->f_name, "
"reinterpret_cast<const __func%d_t *>(b)->f_name);\n"
"}\n"
, count, count, count);
fprintf(h, "\tvirtual void %s(const molib::moName& __name", f_name);
fprintf(cpp, "void %s::%s(const molib::moName& __name", class_name, f_name);
if(f_timed) {
fprintf(h, ", time_t __time");
fprintf(cpp, ", time_t __time");
}
next = f_params;
while(next != 0) {
fprintf(h, ", %s", next->f_type);
fprintf(cpp, ", %s", next->f_type);
if(next->f_default_value != 0) {
fprintf(h, " = %s", next->f_default_value);
}
next = next->f_next;
}
fprintf(h, ");\n");
fprintf(cpp,
")\n"
"{\n"
"\tmolib::moSortedArray __array(sizeof(__func%d_t), &__compare_func%d);\n"
"\t__func%d_t __f;\n"
"\tif(__array.Count() == 0) {\n"
"\t\tconst molib::moNamePool& __pool = molib::moNamePool::GetNamePool();\n",
count, count, count);
// We first insert all the '*::<name>' because
// they will always be in front of all the other
// entries! (the name of an interface has to
// start with [A-Za-z_])
func = f_funcs;
while(func != 0) {
fprintf(cpp,
"\t\t__f.f_name = __pool.Get(\"*::%s\");\n"
"\t\t__f.f_func = &%s::%s;\n"
"\t\t__array.Insert(&__f);\n",
func->GetName(),
class_name, func->GetName());
func = func->Next();
}
func = f_funcs;
while(func != 0) {
fprintf(cpp,
"\t\t__f.f_name = __pool.Get(\"%s::%s\");\n"
"\t\t__f.f_func = &%s::%s;\n"
"\t\t__array.Insert(&__f);\n",
class_name, func->GetName(),
class_name, func->GetName());
func = func->Next();
}
fprintf(cpp,
"\t}\n"
"\t__f.f_name = __name;\n"
"\tmolib::moArray::position_t __pos = __array.Find(&__f);\n"
"\tif(__pos != molib::moArray::NO_POSITION) {\n"
"\t\t(this->*reinterpret_cast<const __func%d_t *>(__array.Get(__pos))->f_func)(", count);
if(f_timed) {
fprintf(cpp, "__time");
}
//.........这里部分代码省略.........