void CMapService::onReceiveEvent(TstEventParams pa_stEventParams) { FZRTE_INFO("CMapService::InputEvent [%s]", c_uniqueIdService::getInstance().getUniqueNameFor(pa_stEventParams.m_unEventID).c_str()); stMappingElem *m_mapElem = CDataMapMgr::getMapServiceElements(m_mapInstName.c_str()); if (m_mapElem) { char *m_strConv = new char[STRING_CONV_LEN]; //cm_tagList = m_mapElem->tagsList; for (TagsList::iterator iter = cm_tagList.begin(); iter != cm_tagList.end(); ++iter) { DATA_UID m_unDataID = c_uniqueIdService::getInstance().getUidFor(m_appBlocName, m_mapInstName, iter->first); if (ZERO_VALUE != m_unDataID) { DataVarDeclaration VarDecl = c_dataAggregator::getInstance().getDataVar(m_unDataID); if (!VarDecl.typeClass) { FZRTE_ERROR("IO Block : Tag %s doesn't have any datatype class Instance", c_uniqueIdService::getInstance().getUniqueNameFor(m_unDataID).c_str()); } else { FzrteByte *acDataPtr = VarDecl.typeClass->getDataPtr(); if ((NULL != acDataPtr) && (NULL != pa_stEventParams.m_ptrMemAddr)) { size_t m_size = (pa_stEventParams.m_dataSize > VarDecl.lenInByte) ? VarDecl.lenInByte : pa_stEventParams.m_dataSize; memcpy(acDataPtr, (pa_stEventParams.m_ptrMemAddr + iter->second.offset), m_size); memcpy((cm_memMapAddr + iter->second.offset), (pa_stEventParams.m_ptrMemAddr + iter->second.offset), m_size); VarDecl.typeClass->toString(m_strConv, STRING_CONV_LEN); strcpy((char*)iter->second.tagValue.c_str(), m_strConv); } else { FZRTE_ERROR("CMapService : No Valid Address[Tag-DataPtr : 0x%p, EA-MemAddr : 0x%p] available to update Tag %s", acDataPtr, pa_stEventParams.m_ptrMemAddr, c_uniqueIdService::getInstance().getUniqueNameFor(m_unDataID).c_str()); } } } } ((fzrte::comm_infra::CMapLayer *)m_oMapLayer)->createResponseToSend(createXml().c_str(), (char*)cm_memMapAddr, cm_memSize); delete m_strConv; } }
Result FilterGraph::saveDocument (const File& file) { ScopedPointer<XmlElement> xml (createXml()); if (! xml->writeToFile (file, String::empty)) return Result::fail ("Couldn't write to the file"); return Result::ok(); }
const String FilterGraph::saveDocument (const File& file) { ScopedPointer<XmlElement> xml (createXml()); if (! xml->writeToFile (file, String::empty)) return "Couldn't write to the file"; return String::empty; }
JucerDocument* ButtonDocument::createCopy() { ButtonDocument* newOne = new ButtonDocument (cpp); newOne->resources = resources; ScopedPointer<XmlElement> xml (createXml()); newOne->loadFromXml (*xml); return newOne; }
JucerDocument* ComponentDocument::createCopy() { ComponentDocument* newOne = new ComponentDocument (cpp); newOne->resources = resources; std::unique_ptr<XmlElement> xml (createXml()); newOne->loadFromXml (*xml); return newOne; }
JucerDocument* ComponentDocument::createCopy() { ComponentDocument* newOne = new ComponentDocument(); newOne->resources = resources; newOne->setFile (getFile()); ScopedPointer<XmlElement> xml (createXml()); newOne->loadFromXml (*xml); return newOne; }
void CMapService::deleteTags(TagsList tagList) { for (TagsList::iterator newTagIter = tagList.begin(); newTagIter != tagList.end(); ++newTagIter) { TagsList::iterator oldTagIter = cm_tagList.find(newTagIter->first); if (oldTagIter != cm_tagList.end()) { cm_tagList.erase(oldTagIter); } } ((fzrte::comm_infra::CMapLayer *)m_oMapLayer)->createResponseToSend(createXml().c_str(), NULL, NULL); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); // 必须在创建数据库之前使用,不然无法在数据库中使用中文 QTextCodec::setCodecForTr(QTextCodec::codecForLocale()); QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale()); if(!createConnection() || !createXml()) return 0; Widget w; w.show(); return a.exec(); }
void CMapService::createTags(TagsList tagList) { for (TagsList::iterator newTagIter = tagList.begin(); newTagIter != tagList.end(); ++newTagIter) { TagsList::iterator oldTagIter = cm_tagList.find(newTagIter->first); if (oldTagIter == cm_tagList.end()) { cm_tagList.insert(make_pair(newTagIter->first, newTagIter->second)); CDataMapMgr::createData(m_appBlocName.c_str(), m_mapInstName.c_str(), cm_tagList); } } ((fzrte::comm_infra::CMapLayer *)m_oMapLayer)->createResponseToSend(createXml().c_str(),NULL, NULL); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); // 必须在创建数据库之前使用,不然无法在数据库中使用中文 QTextCodec::setCodecForTr(QTextCodec::codecForLocale()); QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale()); if(!createConnection() || !createXml()) return 0; Widget w; LoginDialog dlg; if (dlg.exec() == QDialog::Accepted) { w.show(); return a.exec(); } else { return 0; } }
int main(int argc, char *argv[]) { QApplication a(argc, argv); //设置中文字符编码 // QTextCodec::setCodecForTr(QTextCodec::setCodecForLocale()); // QTextCodec::setCodecForCString(QTextCodec::codecForLocale()); if (!createConnection()||!createXml()) { return 0; } Widget w; LoginDialog dlg; if(dlg.exec()==QDialog::Accepted) { w.show(); return a.exec(); } else { return 0; } }
//============================================================================== void JucerDocument::fillInGeneratedCode (GeneratedCode& code) const { code.className = className; code.componentName = componentName; code.parentClasses = parentClasses; code.constructorParams = constructorParams; code.initialisers.addLines (variableInitialisers); if (! componentName.isEmpty()) code.constructorCode << "setName (" + quotedString (componentName, false) + ");\n"; // call these now, just to make sure they're the first two methods in the list. code.getCallbackCode (String::empty, "void", "paint (Graphics& g)", false) << "//[UserPrePaint] Add your own custom painting code here..\n//[/UserPrePaint]\n\n"; code.getCallbackCode (String::empty, "void", "resized()", false) << "//[UserPreResize] Add your own custom resize code here..\n//[/UserPreResize]\n\n"; if (ComponentLayout* l = getComponentLayout()) l->fillInGeneratedCode (code); fillInPaintCode (code); ScopedPointer<XmlElement> e (createXml()); jassert (e != nullptr); code.jucerMetadata = e->createDocument ("", false, false); resources.fillInGeneratedCode (code); code.constructorCode << "\n//[UserPreSize]\n" "//[/UserPreSize]\n"; if (initialWidth > 0 || initialHeight > 0) code.constructorCode << "\nsetSize (" << initialWidth << ", " << initialHeight << ");\n"; code.getCallbackCode (String::empty, "void", "paint (Graphics& g)", false) << "//[UserPaint] Add your own custom painting code here..\n//[/UserPaint]"; code.getCallbackCode (String::empty, "void", "resized()", false) << "//[UserResized] Add your own custom resize handling here..\n//[/UserResized]"; // add optional methods StringArray baseClasses, returnValues, methods, initialContents; getOptionalMethods (baseClasses, returnValues, methods, initialContents); for (int i = 0; i < methods.size(); ++i) { if (isOptionalMethodEnabled (methods[i])) { String baseClassToAdd (baseClasses[i]); if (baseClassToAdd == "Component" || baseClassToAdd == "Button") baseClassToAdd.clear(); String& s = code.getCallbackCode (baseClassToAdd, returnValues[i], methods[i], false); if (! s.contains ("//[")) { String userCommentTag ("UserCode_"); userCommentTag += methods[i].upToFirstOccurrenceOf ("(", false, false).trim(); s << "\n//[" << userCommentTag << "] -- Add your code here...\n" << initialContents[i]; if (initialContents[i].isNotEmpty() && ! initialContents[i].endsWithChar ('\n')) s << '\n'; s << "//[/" << userCommentTag << "]\n"; } } } }
void tst_QXmppMixIq::testBase_data() { QByteArray joinC2sSetXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]\" " "from=\"[email protected]/UUID-a1j/7533\" " "type=\"set\">" "<client-join xmlns=\"urn:xmpp:mix:pam:1\" channel=\"[email protected]\">" "<join xmlns=\"urn:xmpp:mix:core:1\">" "<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>" "<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>" "<subscribe node=\"urn:xmpp:mix:nodes:participants\"/>" "<subscribe node=\"urn:xmpp:mix:nodes:info\"/>" "<nick>third witch</nick>" "</join>" "</client-join>" "</iq>" ); QByteArray joinS2sSetXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]\" " "from=\"[email protected]\" " "type=\"set\">" "<join xmlns=\"urn:xmpp:mix:core:1\">" "<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>" "<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>" "<subscribe node=\"urn:xmpp:mix:nodes:participants\"/>" "<subscribe node=\"urn:xmpp:mix:nodes:info\"/>" "<nick>stpeter</nick>" "</join>" "</iq>" ); QByteArray joinS2sResultXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]\" " "from=\"[email protected]\" " "type=\"result\">" "<join xmlns=\"urn:xmpp:mix:core:1\" jid=\"123456#[email protected]\">" "<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>" "<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>" "<subscribe node=\"urn:xmpp:mix:nodes:participants\"/>" "<subscribe node=\"urn:xmpp:mix:nodes:info\"/>" "<nick>third witch</nick>" "</join>" "</iq>" ); QByteArray joinC2sResultXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]/UUID-a1j/7533\" " "from=\"[email protected]\" " "type=\"result\">" "<client-join xmlns=\"urn:xmpp:mix:pam:1\">" "<join xmlns=\"urn:xmpp:mix:core:1\" " "jid=\"123456#[email protected]\">" "<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>" "<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>" "<subscribe node=\"urn:xmpp:mix:nodes:participants\"/>" "<subscribe node=\"urn:xmpp:mix:nodes:info\"/>" "</join>" "</client-join>" "</iq>" ); QByteArray leaveC2sSetXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]\" " "from=\"[email protected]/UUID-a1j/7533\" " "type=\"set\">" "<client-leave xmlns=\"urn:xmpp:mix:pam:1\" channel=\"[email protected]\">" "<leave xmlns=\"urn:xmpp:mix:core:1\"/>" "</client-leave>" "</iq>" ); QByteArray leaveS2sSetXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]\" " "from=\"[email protected]\" " "type=\"set\">" "<leave xmlns=\"urn:xmpp:mix:core:1\"/>" "</iq>" ); QByteArray leaveS2sResultXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]\" " "from=\"[email protected]\" " "type=\"result\">" "<leave xmlns=\"urn:xmpp:mix:core:1\"/>" "</iq>" ); QByteArray leaveC2sResultXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]/UUID-a1j/7533\" " "from=\"[email protected]\" " "type=\"result\">" "<client-leave xmlns=\"urn:xmpp:mix:pam:1\">" "<leave xmlns=\"urn:xmpp:mix:core:1\"/>" "</client-leave>" "</iq>" ); QByteArray updateSubscriptionSetXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]\" " "from=\"[email protected]/UUID-a1j/7533\" " "type=\"set\">" "<update-subscription xmlns=\"urn:xmpp:mix:core:1\">" "<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>" "</update-subscription>" "</iq>" ); QByteArray updateSubscriptionResultXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]/UUID-a1j/7533\" " "from=\"[email protected]\" " "type=\"result\">" "<update-subscription xmlns=\"urn:xmpp:mix:core:1\" jid=\"[email protected]\">" "<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>" "</update-subscription>" "</iq>" ); QByteArray setNickSetXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]\" " "from=\"[email protected]/UUID-a1j/7533\" " "type=\"set\">" "<setnick xmlns=\"urn:xmpp:mix:core:1\">" "<nick>thirdwitch</nick>" "</setnick>" "</iq>" ); QByteArray setNickResultXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]/UUID-a1j/7533\" " "from=\"[email protected]\" " "type=\"result\">" "<setnick xmlns=\"urn:xmpp:mix:core:1\">" "<nick>thirdwitch</nick>" "</setnick>" "</iq>" ); QByteArray createXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]\" " "from=\"[email protected]/UUID-a1j/7533\" " "type=\"set\">" "<create xmlns=\"urn:xmpp:mix:core:1\" channel=\"coven\"/>" "</iq>" ); QByteArray createWithoutNameXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]\" " "from=\"[email protected]/UUID-a1j/7533\" " "type=\"set\">" "<create xmlns=\"urn:xmpp:mix:core:1\"/>" "</iq>" ); QByteArray destroyXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]\" " "from=\"[email protected]/UUID-a1j/7533\" " "type=\"set\">" "<destroy xmlns=\"urn:xmpp:mix:core:1\" channel=\"coven\"/>" "</iq>" ); QByteArray emptyXml( "<iq id=\"E6E10350-76CF-40C6-B91B-1EA08C332FC7\" " "to=\"[email protected]\" " "from=\"[email protected]/UUID-a1j/7533\" " "type=\"set\"/>" ); QStringList emptyNodes; QStringList defaultNodes; defaultNodes << "urn:xmpp:mix:nodes:messages" << "urn:xmpp:mix:nodes:presence" << "urn:xmpp:mix:nodes:participants" << "urn:xmpp:mix:nodes:info"; QTest::addColumn<QByteArray>("xml"); QTest::addColumn<QXmppIq::Type>("type"); QTest::addColumn<QXmppMixIq::Type>("actionType"); QTest::addColumn<QString>("jid"); QTest::addColumn<QString>("channelName"); QTest::addColumn<QStringList>("nodes"); QTest::addColumn<QString>("nick"); QTest::newRow("join-c2s-set") << joinC2sSetXml << QXmppIq::Set << QXmppMixIq::ClientJoin << "*****@*****.**" << "" << defaultNodes << "third witch"; QTest::newRow("join-s2s-set") << joinS2sSetXml << QXmppIq::Set << QXmppMixIq::Join << "" << "" << defaultNodes << "stpeter"; QTest::newRow("join-s2s-result") << joinS2sResultXml << QXmppIq::Result << QXmppMixIq::Join << "123456#[email protected]" << "" << defaultNodes << "third witch"; QTest::newRow("join-c2s-result") << joinC2sResultXml << QXmppIq::Result << QXmppMixIq::ClientJoin << "123456#[email protected]" << "" << defaultNodes << ""; QTest::newRow("leave-c2s-set") << leaveC2sSetXml << QXmppIq::Set << QXmppMixIq::ClientLeave << "*****@*****.**" << "" << emptyNodes << ""; QTest::newRow("leave-s2s-set") << leaveS2sSetXml << QXmppIq::Set << QXmppMixIq::Leave << "" << "" << emptyNodes << ""; QTest::newRow("leave-s2s-result") << leaveS2sResultXml << QXmppIq::Result << QXmppMixIq::Leave << "" << "" << emptyNodes << ""; QTest::newRow("leave-c2s-result") << leaveC2sResultXml << QXmppIq::Result << QXmppMixIq::ClientLeave << "" << "" << emptyNodes << ""; QTest::newRow("update-subscription-set") << updateSubscriptionSetXml << QXmppIq::Set << QXmppMixIq::UpdateSubscription << "" << "" << (QStringList() << "urn:xmpp:mix:nodes:messages") << ""; QTest::newRow("update-subscription-result") << updateSubscriptionResultXml << QXmppIq::Result << QXmppMixIq::UpdateSubscription << "*****@*****.**" << "" << (QStringList() << "urn:xmpp:mix:nodes:messages") << ""; QTest::newRow("setnick-set") << setNickSetXml << QXmppIq::Set << QXmppMixIq::SetNick << "" << "" << emptyNodes << "thirdwitch"; QTest::newRow("setnick-result") << setNickResultXml << QXmppIq::Result << QXmppMixIq::SetNick << "" << "" << emptyNodes << "thirdwitch"; QTest::newRow("create") << createXml << QXmppIq::Set << QXmppMixIq::Create << "" << "coven" << emptyNodes << ""; QTest::newRow("create-without-name") << createWithoutNameXml << QXmppIq::Set << QXmppMixIq::Create << "" << "" << emptyNodes << ""; QTest::newRow("destroy") << destroyXml << QXmppIq::Set << QXmppMixIq::Destroy << "" << "coven" << emptyNodes << ""; QTest::newRow("empty") << emptyXml << QXmppIq::Set << QXmppMixIq::None << "" << "" << emptyNodes << ""; }
//static LLAlertDialog* LLAlertDialog::createXml( const LLString& xml_desc, alert_callback_t callback, void *user_data) { LLString::format_map_t args; return createXml(xml_desc, args, callback, user_data); }
//static LLAlertDialog* LLAlertDialog::showXml( const LLString& xml_desc, const LLString::format_map_t& args, alert_callback_t callback, void *user_data) { LLAlertDialog* dialog = createXml(xml_desc, args, callback, user_data); return dialog && dialog->show() ? dialog : NULL; }