/** * 从字符串中初始化 */ bool tixmlCode::initFromString(const char *content) { TiXmlDocument doc; doc.Parse(content); static std::string CODE="code"; static std::string READ="read"; TiXmlHandle hDoc(&doc); TiXmlElement* pElem = NULL; pElem=hDoc.FirstChildElement().Element(); for(; pElem; pElem=pElem->NextSiblingElement()) { const char *pKey=pElem->Value(); tixmlCodeNode *node = new tixmlCodeNode(); node->init(pElem); if (node->nodeName == CODE) { parseCode(node); } else if (node->nodeName == READ) { std::string fileName = node->getAttr("file"); init(fileName.c_str()); // 加载其他文本进入当前执行环境 } else { takeNode(node); // 调用使用者的方法 } } return true; }
void Q3CList::take(Q3CacheItem *ci) { if (ci) { #if defined(QT_DEBUG) Q_ASSERT(ci->node != 0); #endif takeNode(ci->node); ci->node = 0; } }
void QCList::take( QCacheItem *ci ) { if ( ci ) { #if defined(DEBUG) ASSERT( ci->node != 0 ); #endif takeNode( ci->node ); ci->node = 0; } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), logic(this), connectDialog(new ZeroconfConnectDialog(this)), ipConnectDialog(new IPConnectDialog(this)) { ui->setupUi(this); ui->centralwidget->setClientLogic(&logic); /* connect(connectDialog, SIGNAL(connectedTo(QHostAddress,quint16)), this, SLOT(newServerConnection(QHostAddress,quint16))); */ connect(ipConnectDialog, SIGNAL(setLocalAddress(QHostAddress)), &logic, SLOT(setLocalAddress(QHostAddress))); connect(ipConnectDialog, SIGNAL(connectedTo(QHostAddress,quint16)), this, SLOT(newServerConnection(QHostAddress,quint16))); connect(ui->centralwidget, SIGNAL(take(QString)), this, SLOT(takeNode(QString))); connect(ui->centralwidget, SIGNAL(give(QString)), this, SLOT(giveNode(QString))); connect(&logic, SIGNAL(serverPoolChanged()), ui->centralwidget, SLOT(updateServerPool())); connect(&logic, SIGNAL(localPoolChanged()), ui->centralwidget, SLOT(updateLocalPool())); connect(&logic, SIGNAL(sendLog(QString)), ui->centralwidget, SLOT(addLog(QString))); }