添加一些基本类
This commit is contained in:
32
interface/interface.cpp
Normal file
32
interface/interface.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
#include "interface.h"
|
||||
#include "string.h"
|
||||
#include "QDebug"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
InterFace *interface;
|
||||
const char *name;
|
||||
} self_table_def;
|
||||
|
||||
static self_table_def g_self_table[] =
|
||||
{
|
||||
{.interface = 0, .name = "default"},
|
||||
};
|
||||
|
||||
InterFace *interFaceFind(const char *name)
|
||||
{
|
||||
int num = sizeof(g_self_table) / sizeof(g_self_table[0]);
|
||||
self_table_def *item = 0;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
item = &g_self_table[i];
|
||||
if (item != nullptr)
|
||||
{
|
||||
if (strcmp(name, item->name) == 0)
|
||||
return item->interface;
|
||||
}
|
||||
}
|
||||
qWarning("can not find interface named '%s'", name);
|
||||
return nullptr;
|
||||
}
|
Reference in New Issue
Block a user