コード例 #1
0
ファイル: TuiManager.cpp プロジェクト: zh0ub1n/Tui-x
void TuiManager::parseScene(Node* pScene ,const char* sceneName,const char* xmlPath){

	loadXml(xmlPath);
	string xmlContent = m_DataMap.at(xmlPath);
	char* buf = new char[ xmlContent.size()+1 ];
	memcpy( buf, xmlContent.c_str(), xmlContent.size()+1 );
	
	xml_document<> doc;
	doc.parse<0>(buf);

	for(xml_node<char> *item = doc.first_node("control");item != NULL;item = item->next_sibling()){
		
		if( strcmp(item->first_attribute("type")->value(),kTuiContainerPanel) == 0){//panel

			if(strcmp(item->first_attribute("name")->value(),sceneName) != 0) continue;//only parse the key panel

			this->parseControl(pScene,item);
		}
	}

	if (m_isAdaptResolution)
		doAdapterResolution(pScene);

	delete[] buf;
}
コード例 #2
0
ファイル: plotsdialog.cpp プロジェクト: oabdelaziz/SorpSim
void plotsDialog::setupPlots(bool init)
{
    if(!init)
        disconnect(tabs,SIGNAL(currentChanged(int)),this,SLOT(resetZoomer(int)));
    if(!loadXml(init))
    {
        globalpara.reportError("Fail to load xml file for plots!",this);
        close();
    }
    showInfo();

    if(!init)
        connect(tabs,SIGNAL(currentChanged(int)),SLOT(resetZoomer(int)));

    int newCurrentIndex = 0;
    if(tabs->count()>0)
        newCurrentIndex = tabs->count()-1;

    if(startPName!="")
    {
        for(int i = 0; i<tabs->count(); i++)
        {
            if(tabs->tabText(i)==startPName)
                newCurrentIndex = i;
        }
    }

    tabs->setCurrentIndex(newCurrentIndex);

    refreshThePlot();
}
コード例 #3
0
void DimmableLight::loadDeviceData(const QString &rootDevicePath)
{
    _deviceDescription = loadXml(rootDevicePath, "Root Device");
    if (_deviceDescription == NULL) {
        fprintf(stderr, "Failed to load device description!");
        return;
    }

    setDeviceProperties(_deviceDescription);
    readDeviceProperties(_deviceDescription);

    QHash<QString, ServiceInfo *> infos;

    QFileInfo rootFileInfo(rootDevicePath);
    QDir rootDirectory = rootFileInfo.dir();

    loadServices(_deviceDescription, infos, rootDirectory);

    QHash<QString, ServiceInfo *>::const_iterator it = infos.constBegin();
    for (; it != infos.constEnd(); it++) {
        QString name = it.key();
        ServiceInfo *info = it.value();
        if (name == DIMMING_SERV_ID) {
            _dimming = new (std::nothrow) DimmingService(info);
        } else if (name == SWITCHPOWER_SERV_ID) {
            _switch = new (std::nothrow) SwitchPowerService(info);
        }
    }
}
コード例 #4
0
ReviewedTest ReviewedTestSerializator::loadTest(const QString &filename)
{
    QDomDocument xml;
    try
    {
        loadXmlSchema(":/xsd/xsd/reviewedtestconfig.xsd");

        xml = loadXml(filename);

        if (!checkXml(xml))
        {
            throw Exception(Exception::BadXMLFile, QString("Bad XML file - " + filename));
        }
    }
    catch (const Exception &err)
    {
        throw;
    }

    QString title = xml.elementsByTagName("title").at(0).toElement().text();
    QString version = xml.elementsByTagName("testVersion").at(0).toElement().text();

    ReviewedTest test(title, version);

    QDomNodeList tasks = xml.elementsByTagName("task");

    for (uint i = 0; i < tasks.length(); i++)
    {
        test.addTask(getTask(tasks.at(i)));
    }

    return test;
}
コード例 #5
0
void Oca::reset(){

    //  Load each place of the deck
    //
    loadXml("Oca/config.xml");

    text.setFromCenter(places[27]->getBoundingBox().x + places[27]->getBoundingBox().width*0.5,
                       places[27]->getBoundingBox().y + places[27]->getBoundingBox().height*0.4,
                       places[27]->getBoundingBox().width*0.7,
                       places[27]->getBoundingBox().height*0.8);
    text.loadSequence("Oca/config.xml");

    //  Setup spacial backgrounds
    //
    forestBackground.set( places[10]->getBoundingBox() );
    forestBackground.setZoom(30);
    forestBackground.clear();
    dragonBackground.set( places[25]->getBoundingBox() );
    dragonBackground.clear();

    //  El amigo del casillero 17 no esta presente.
    //
    obj17.loadImage("Oca/17alt/17-00.png");
    bFriend = false;

    places[27]->turnTo(0);
}
コード例 #6
0
ファイル: ejsXML.c プロジェクト: embedthis/ejscript
/*
    native function XML(value: Object = null)
 */
static EjsObj *xmlConstructor(Ejs *ejs, EjsXML *thisObj, int argc, EjsObj **argv)
{
    EjsObj      *arg, *vp;
    wchar       *str;

    //  TODO - should be also able to handle a File object

    if (thisObj == 0) {
        /*
            Called as a function - cast the arg
         */
        if (argc > 0) {
            if ((arg = ejsCast(ejs, argv[0], String)) == 0) {
                return 0;
            }
        }
        thisObj = ejsCreateXML(ejs, 0, N(NULL, NULL), NULL, NULL);
    }
    if (argc == 0) {
        return (EjsObj*) thisObj;
    }

    arg = argv[0];
    assert(arg);

    if (!ejsIsDefined(ejs, arg)) {
        return (EjsObj*) thisObj;
    }
    arg = ejsCast(ejs, argv[0], String);
    if (arg && ejsIs(ejs, arg, String)) {
        str = ((EjsString*) arg)->value;
        if (str == 0) {
            return 0;
        }
        while (isspace((uchar) *str)) str++;
        if (*str == '<') {
            /* XML Literal */
            ejsLoadXMLString(ejs, thisObj, (EjsString*) arg);

        } else {
            /* Load from file */
            loadXml(ejs, thisObj, argc, argv);
        }
    } else if (arg && ejsIsXML(ejs, arg)) {
        if ((vp = xmlToString(ejs, argv[0], 0, NULL)) != 0) {
            ejsLoadXMLString(ejs, thisObj, (EjsString*) vp);
        }

    } else {
        ejsThrowArgError(ejs, "Bad type passed to XML constructor");
        return 0;
    }
    return (EjsObj*) thisObj;
}
コード例 #7
0
ファイル: commands.cpp プロジェクト: ChubNtuck/avesta74
bool Commands::reload()
{
	loaded = false;
	for(CommandMap::iterator it = commandMap.begin(); it != commandMap.end(); ++it){
		it->second->accesslevel = 1;
		it->second->loaded = false;
	}
	g_game.resetCommandTag();
	
	loadXml(datadir);
	return true;
}
コード例 #8
0
ファイル: main.cpp プロジェクト: berak/vst2.0
void parseMessages()
{
	PROFILE;

	// parse set messages:
    int n = tuio.numMessages();
	for ( int i=0; i<n; i++ )
    {
        const Tuio::Object & o = tuio.getMessage(i);
		int fid = ( o.fi == -1 ? 0 : o.fi );
		Item * it = matchItem( o, matchRadius );
        if ( ! it )
        {
			it = loadXml( fid );
			if ( ! it ) 
				it = createSynItem( fid );
			if ( ! it ) 
				continue;
		}
		setItem( it, o );
    }

	// update alive list:
	int a = tuio.numAlive();
	if ( a < numItems() )
	{
		for ( int i=0; i<numItems(); i++ )
		{
			Item * it = getItem(i);
			if ( ! tuio.isAlive( it->id ) )
			{
				it->autoDisconnect(0);

				if ( it->type == Item::IT_CURSOR )
				{
					it->a = 0; // say goodbye, reset trigger
				}
				it->lostCycles ++;			
				if ( it->lostCycles >= TTL )
				{
					printf( "--(%4d) lost(%d): %s \n", frame, it->id, it->typeName() );
					it->release();
					break;
				}
			}
			else
			{
				it->lostCycles = 0;			
			}
		}
	}
}
コード例 #9
0
bool OPimContactAccessBackend_XML::load ()
{
    if ( m_fileName.isEmpty() )
        return false;

    m_contactList.clear();
    m_uidToContact.clear();

    /* Load XML-File if it exists */
    XMLElement *root = XMLElement::load( m_fileName );
    if(root) {
        bool res = loadXml( root, false );
        delete root;
        if ( !res )
            return false;
    }
    else
        return false;

    /* We use the time of the last read to check if the file was
     * changed externally.
     */
    QFileInfo fi( m_fileName );
    m_readtime = fi.lastModified ();

    /* The returncode of the journalfile is ignored due to the
     * fact that it does not exist when this class is instantiated !
     * But there may such a file exist, if the application crashed.
     * Therefore we try to load it to get the changes before the #
     * crash happened...
     */
    root = XMLElement::load( m_journalName );
    if(root) {
        loadXml( root, true );
        delete root;
    }

    return true;
}
コード例 #10
0
ファイル: main.cpp プロジェクト: Mr-Kumar-Abhishek/qt
int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);

    QSqlDatabase db = createDataBase(":memory:");

    if (argc < 2) {

        // Try stdin
        QFile in;
        in.open(stdin, QIODevice::ReadOnly);
        QByteArray xml = in.readAll();

        if (xml.isEmpty()) {
            qDebug() << "Usage: chart xml-file [xml-file2 xml-file3 ...]";
            qDebug() << "See also QTestLib's \"-chart\" option";
            return 0;
        } else {
            loadXml(xml, QString());
        }
    }

    QStringList files;
    for (int i = 1; i < argc; i++) {
        QString file = QString::fromLocal8Bit(argv[i]);
        files += file;
    }

    if (files.isEmpty() == false)
        loadXml(files);

    ReportGenerator reportGenerator;
    reportGenerator.writeReports();

    db.close();
}
コード例 #11
0
void
SkFontData::loadFont()
{
    SkTDArray<FontInitRec> info;
    SkTypeface * firstInFamily = NULL;
    loadXml( info );

    for( int i = 0 ; i < info.count() ; i++ )
    {
        const char * const * names = info[i].fNames;

        if( names != NULL )
            firstInFamily = NULL;

        bool isFixedWidth;
        SkString name;
        SkTypeface::Style style;
        bool isExpected = ( names != gFBNames );

        SkString fullpath;
        getFullPathDownloadFont( &fullpath, info[i].fFileName );

        if( !getNameAndStyleDlFont( fullpath.c_str(), &name, &style, &isFixedWidth, isExpected ) )
            continue;

        SkTypeface * tf = SkNEW_ARGS( FileTypeface, ( style, true, fullpath.c_str(), isFixedWidth ) );
        addTypefaceLocked( tf, firstInFamily );

        if( names != NULL )
        {
            firstInFamily = tf;
            FamilyRec * family = findFamilyLocked( tf );

            if( isDefaultSansFont( names ) )
            {
                FileTypeface * ftf = ( FileTypeface * )tf;
                setFamilyAndTypeface( family, ftf );
                setWebFaceName( names[0] );
            }

            while( *names )
            {
                addNameLocked( *names, family );
                names += 1;
            }
        }
    }
}
コード例 #12
0
void GameProfile::loadProfile()
{
    loadXml();

    // if no profile found, create default player
    if (m_players.count() == 0)
        setCurrentPlayer(tr("Player"));

    if (m_current >= 0 && m_current < m_players.count()) {
        sndEngine->setChannelVolume(currentPlayer()->soundVolume);
        sndEngine->setMusicVolume(currentPlayer()->musicVolume);
        sndEngine->enableMusic(currentPlayer()->musicEnabled);
    }

//    loadTopTen();
}
コード例 #13
0
 void sm::BoostPropertyTree::load(const boost::filesystem::path& fileName) {
   switch(getFileFormatAndThrowIfUnknown(fileName)){
     case XML:
       loadXml(fileName);
       break;
     case INI:
       loadIni(fileName);
       break;
     case JSON:
       loadJson(fileName);
       break;
     case INFO:
       loadInfo(fileName);
       break;
   }
 }
コード例 #14
0
ファイル: fluxbb.cpp プロジェクト: Harak/irc-mind
void		FluxBB::checkNewTopic()
{ 
  std::vector<newpost *>::iterator it;

  _topicurl = _baseUrl + "/irc.php";
  _topicurl += "?cmd=newtopic&key=";
  _topicurl += Utils::md5(Utils::md5(_key) + "newtopic");
  _topicurl += "&last=" + _lasttopic;

  getData(newTopic);
  loadXml(newTopic);
  for (it = _topic.begin(); it != _topic.end(); ++it)
    {
      newpost *n = *it;
      _irc->privmsg(_channel, "[" + n->forum + "] Nouveau sujet créé par " + n->poster + " : " + n->subject + " " + _baseUrl + "/viewtopic.php?id=" + n->id + "&action=new");
      if (Utils::stringToInt(_lasttopic) < Utils::stringToInt(n->posted))
	_lasttopic = std::string(n->posted);
      delete n;
    }
  _topic.clear();
}
コード例 #15
0
void loadServices( QDomDocument *deviceDescription
                 , QHash<QString, ServiceInfo *> &externalInfos
                 , const QDir &rootDirectory
                 )
{
    QHash<QString, ServiceInfo> infos;
    findServiceInformation(deviceDescription, infos);

    QHash<QString, ServiceInfo>::const_iterator it = infos.constBegin();
    for (; it != infos.constEnd(); it++) {
        QString name = it.key();
        ServiceInfo info = it.value();

        QString path = rootDirectory.path() + info.scdpPath;

        QDomDocument *desc = loadXml(path, name);
        info.description = desc;
        info.variables = fetchVariableNames(desc, true);

        externalInfos[name] = new (std::nothrow) ServiceInfo(info);
    }
}
コード例 #16
0
ファイル: rasterinfo.cpp プロジェクト: dmm/cegis
bool RasterInfo::load( QString imgFileName )
{
   defaults();
   fileName = imgFileName;
   parseFileName();

   if( QFile::exists( fileName + ".xml" ) )
   {
      return loadXml();
   }
   else if( QFile::exists( fileName + ".img.info" ) )
   {
      loadInfo();
      save();
      QFile::remove( fileName + ".img.info" );
   }
   else
   {
      return false;
   }

   return true;
}
コード例 #17
0
ファイル: main.cpp プロジェクト: docben/visibleSim2Collada
int main(int argc,char **argv) {
    std::string titleSrc,titleDest,titleModel;
    CatomType catomType;

    if (argc>3) {
        titleSrc = std::string(argv[1]);
        titleDest = std::string(argv[2]);
        std::string str(argv[3]);
        if (str=="C3D") {
            catomType=C3D;
            titleModel=std::string("catom3Dgeometry.xml");
        } else
        if (str=="C2D") {
            catomType=C2D;
            titleModel=std::string("blinkyBlockgeometry.xml");
        } else
        if (str=="BB") catomType=BB; else
        if (str=="SM") {
            catomType=SB;
            titleModel=std::string("smartBlockgeometry.xml");
        }
        if (argc>5 && strcmp(argv[4],"-g")==0) {
            titleModel = std::string(argv[5]);
        }
    } else {
        std::cerr << "usage convertXml2Collada src dest catomType [-g geometry.xml]" << std::endl;
        return -1;
    }

    Modules *modules = loadXml(titleSrc,catomType);

    modules->createDae(titleDest,titleModel);


    delete modules;
    return 0;
}
コード例 #18
0
ファイル: main.cpp プロジェクト: Holybang/HBQtTestLib
int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);

    if (argc < 2) {
        qDebug() << "Usage: generatereport xml-file [xml-file2 xml-file3 ...]";
        return 0;
    }

    QStringList files;
    for (int i = 1; i < argc; i++) {
        QString file = QString::fromLocal8Bit(argv[i]);
        files += file;
        qDebug() << "Reading xml from" << file;
    }

    QSqlDatabase db = createDataBase(":memory:");

    loadXml(files);

    ReportGenerator reportGenerator;
    reportGenerator.writeReports();
    db.close();
}
コード例 #19
0
ファイル: ImageManager.cpp プロジェクト: BastienCramillet/SGC
ImageManager::ImageManager() {
    loadXml();
}
コード例 #20
0
ファイル: ofxBoxObj.cpp プロジェクト: Diex/BCRA_of007
ofxBoxObj & ofxBoxObj::restart(){
	box->destroy();
	loadXml();
	init(x,y);
	return * this;
}
コード例 #21
0
ファイル: ofxBoxObj.cpp プロジェクト: Diex/BCRA_of007
ofxBoxObj::ofxBoxObj(string _objectName){
	objectName = _objectName;//"box"; 
	loadXml();
	loadExtraXml("config.xml");
}
コード例 #22
0
ファイル: ofxBoxObj.cpp プロジェクト: Diex/BCRA_of007
ofxBoxObj::ofxBoxObj(){
	objectName = "box"; 
	loadXml();
	loadExtraXml("config.xml");
}
コード例 #23
0
ファイル: ofApp.cpp プロジェクト: Kj1/OF_COURCE_ICON
void ofApp::setup(){
	ofSetCircleResolution(50);
	loadXml();
	ofSetFrameRate(60);
}
コード例 #24
0
ファイル: Point.cpp プロジェクト: wvulej/engauge6
Point::Point (QXmlStreamReader &reader)
{
  loadXml(reader);
}
コード例 #25
0
ファイル: portingrules.cpp プロジェクト: maxxant/qt
/*
    Loads rule xml file given by fileName, and sets up data structures.
    The rules can generally be divided into to types, replacement rules and
    info rules.

    Replacement rules has the form Qt3Symobl -> Qt4Symbol
    Info rules includes the NeedHeader, Qt3Header, Qt4Header, InhertitsQt
    rule types.
*/
void PortingRules::parseXml(QString fileName)
{
    QtSimpleXml *xmlPointer = loadXml(fileName);
    QtSimpleXml &xml = *xmlPointer;

    int ruleCount = xml[QLatin1String("Rules")].numChildren();
    ++ruleCount;

    for(int rule=0; rule<ruleCount; ++rule) {
        QtSimpleXml &currentRule = xml[QLatin1String("Rules")][rule];
        QString ruleType = currentRule.attribute(QLatin1String("Type"));

        if(isReplacementRule(ruleType)) {
            QString qt3Symbol = currentRule[QLatin1String("Qt3")].text();
            QString qt4Symbol = currentRule[QLatin1String("Qt4")].text();

            QString disable = currentRule.attribute(QLatin1String("Disable"));
            if(disable == QLatin1String("True") || disable == QLatin1String("true")) {
                disableRule(currentRule);
                continue;
            }

            if (isRuleDisabled(currentRule))
                continue;

            if(ruleType == QLatin1String("RenamedHeader")) {
              headerReplacements.insert(qt3Symbol.toLatin1(), qt4Symbol.toLatin1());
            } else if(ruleType == QLatin1String("RenamedClass") || ruleType == QLatin1String("RenamedToken") ) {
                tokenRules.append(new ClassNameReplacement(
                        qt3Symbol.toLatin1(), qt4Symbol.toLatin1()));
            } else if(ruleType == QLatin1String("RenamedEnumvalue") || ruleType == QLatin1String("RenamedType") ||
                    ruleType == QLatin1String("RenamedQtSymbol") ) {
                checkScopeAddRule(currentRule);
            }
        } else if(ruleType == QLatin1String("NeedHeader")) {
            const QByteArray className = currentRule[QLatin1String("Class")].text().toLatin1();
            const QByteArray headerName = currentRule[QLatin1String("Header")].text().toLatin1();
            neededHeaders.insert(className, headerName);
        }
        else if(ruleType == QLatin1String("qt3Header")) {
            qt3Headers += currentRule.text();
        }
        else if(ruleType == QLatin1String("qt4Header")) {
            qt4Headers += currentRule.text();
        }
        else if(ruleType == QLatin1String("InheritsQt")) {
            inheritsQtClass += currentRule.text();
        }
        else if(ruleType == QLatin1String("Qt4Class")) {
            // Get library name, make it lowercase and chop of the "Qt" prefix.
            const QByteArray libraryName = currentRule[QLatin1String("Library")].text().toLatin1().toLower().mid(2);
            classLibraryList.insert(currentRule[QLatin1String("Name")].text().toLatin1(), libraryName);
        }
    }

    QString includeFile = xml[QLatin1String("Rules")][QLatin1String("Include")].text();

    if(!includeFile.isNull()) {
        QString resolvedIncludeFile = resolveFileName(fileName, includeFile);
        if (!resolvedIncludeFile.isEmpty())
            parseXml(resolvedIncludeFile);
    }

    delete xmlPointer;
}