本文整理汇总了C++中QPluginLoader::staticInstances方法的典型用法代码示例。如果您正苦于以下问题:C++ QPluginLoader::staticInstances方法的具体用法?C++ QPluginLoader::staticInstances怎么用?C++ QPluginLoader::staticInstances使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPluginLoader
的用法示例。
在下文中一共展示了QPluginLoader::staticInstances方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadCore
/**
* @brief Avr_Core_Builder::loadCore Loads the core described by the configuration file at the path mmcu
* @param mmcu The path for the configuration file
* @return
*/
Avr_Core* Avr_Core_Builder::loadCore(QString mmcu){
//Loader to open plugins
QPluginLoader loader;
core = new Avr_Core();
//Setup the Basics
core->setMemory(new Avr_Memory);
core->setRegisters(new Avr_Registers);
//Load Configuration File
string line;string id;string setting;
QString path = PLUGIN_PATH + mmcu;
ifstream configFile;
configFile.open(path.toStdString().c_str());
if (configFile.is_open()){
//Process config file, there might be a problem
//with the loop termination here
while (!configFile.eof()){
configFile >> line;
if (line == "END"){
break;
}
if (line[0]==';'){
//Line is a comment skip
continue;
}
int i = line.find(':');
id = line.substr(0,i);
setting = line.substr(i + 1, line.size() - i - 1);
if (id == "RAMSIZE"){
qDebug() << "Load Ram\n";
core->mem->initRam(sizeToInt(setting) + 0xff);
core->reg->setRam(core->mem->getRam());
core->reg->setRamEnd(core->mem->getRamEnd());
}else if (id == "FLASHSIZE"){
qDebug() << "Load Flash\n";
core->setFlash(new Avr_Flash(sizeToInt(setting)));
}else if (id == "EPROMSIZE"){
qDebug() << "Load Eprom\n";
core->mem->initEprom(sizeToInt(setting));
}else if (id == "SPL"){
qDebug() << "Set SPL\n";
core->reg->setStackPL(getRegPtr(setting));
}else if (id == "SPH"){
qDebug() << "Set SPH\n";
core->reg->setStackPH(getRegPtr(setting));
}else if (id == "SREG"){
core->reg->setSREGP(getRegPtr(setting));
}else if (id == "PLUGINLIB"){
qDebug() << "Load Plugin " << QString(setting.c_str()) << "\n";
loader.setFileName(PLUGIN_PATH + QString(setting.c_str()));
loader.load();
QObject *plugin = loader.instance();
Avr_Hardware_Interface *h = qobject_cast<Avr_Hardware_Interface*>(plugin);
//Attach all registers
h->attachRegister(core->reg);
//Load Registers for the plugin
//this loads specific registers for specific roles
for (int j = 0; j < h->getRegisterCount();j++){
configFile >> line;
if (line[0]==';'){
j -= 1;
continue;
}
i = line.find(':');
id = line.substr(0,i);
setting = line.substr(i + 1, line.size() - i - 1);
qDebug() << "Setting " << QString(setting.c_str()) << "\n";
h->bindRegister(QString(id.c_str()),getRegPtr(setting));
//h->bindRegister(QString(id.c_str()),getRegLoc(setting));
}
//Load Interrupts
core->hardware.push_back(h);
}else if (id == "INTERFACE"){
loader.setFileName(QString(setting.c_str()));
loader.load();
QList <QObject*> objects = loader.staticInstances();
if (loader.isLoaded()){
std::cout << "Loaded\n";
}else{
std::cout << "Object Count " << objects.size() <<"\n";
}
//.........这里部分代码省略.........