33 lines
624 B
C++
33 lines
624 B
C++
|
|
#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;
|
|
}
|