void CExtensionConfig::LoadFromXML(const char* filepath) { if (behaviac::CFileManager::GetInstance()->FileExists(filepath)) { XmlNodeRef xml = XmlParser().parse(filepath); LoadFromXML(xml); } }
wxString LanguageStrings::operator[] (const string &key) const { if (Map.count (key) > 0) return wxString (Map.find (key)->second); return wxString (L"?") + StringConverter::ToWide (key) + L"?"; } wstring LanguageStrings::Get (const string &key) const { return wstring (LangString[key]); } void LanguageStrings::Init () { foreach (XmlNode node, XmlParser (Resources::GetLanguageXml()).GetNodes (L"string")) { wxString text = node.InnerText; text.Replace (L"\\n", L"\n"); Map[StringConverter::ToSingle (wstring (node.Attributes[L"key"]))] = text; } foreach (XmlNode node, XmlParser (Resources::GetLanguageXml()).GetNodes (L"control")) { wxString text = node.InnerText; text.Replace (L"\\n", L"\n"); Map[StringConverter::ToSingle (wstring (node.Attributes[L"key"]))] = text; } Map["EXCEPTION_OCCURRED"] = _("Exception occurred"); Map["MOUNT"] = _("Mount");
CompCore::CompCore() { this->parser_ = XmlParser(this); this->memoryManager_.setCompCore(*this); // this->deviceConfVect = cl::vector<device_store*>(0); }
//--------------------------------------------------------------------------------------- XmlParser* Injector::inject_XmlParser(LibraryScope& UNUSED(libraryScope), DocumentScope& documentScope) { return LOMSE_NEW XmlParser(documentScope.default_reporter()); }
Engine::Engine(QFileInfo& fileAlbum) throw(EngineException*) : m_dirty(false), m_fileAlbum(new QFileInfo(fileAlbum)), m_uid(0), m_fileSystemScanner(new FileSystemScanner(this)), m_nextSourceDirId(1), m_sourceDirDict(new QIntDict<Folder>()), m_sourceDirs(new QPtrList<Folder>()), m_nextTagNodeId(1), m_tagNodeDict(new QIntDict<TagNode>()), m_tagForest(new QPtrList<TagNode>()), m_exifTitleTag(0), m_fileDict(new QDict<File>()), m_fileList(new QPtrList<File>()), m_fileList2display(new QPtrList<File>()) { tracer->sinvoked(__func__) << "with file '" << m_fileAlbum->absFilePath() << "'" << endl; // if file does not exist, we have nothing to do //if (!m_fileAlbum->exists()) { QString msg = QString("File '%1' does not exist.").arg(m_fileAlbum->absFilePath()); tracer->serror(__func__) << msg << endl; throw new EngineException(msg, "no detailmessage"); //} QFile file(m_fileAlbum->absFilePath()); // close the file if it is open already if (file.isOpen()) { file.close(); } // open the file for reading if (!file.open( IO_ReadOnly )) { QString msg = QString("Could not open file '%1'.").arg(file.name()); tracer->serror(__func__) << msg << ": " << file.errorString() << endl; throw new EngineException(msg, file.errorString()); } // prepare input source QXmlInputSource xmlInputSource(file); // instantiate the parser XmlParser parser = XmlParser(this); // prepare the xml reader QXmlSimpleReader reader; // set the handler on the reader reader.setContentHandler(&parser); reader.setErrorHandler(&parser); // parse the document bool success = reader.parse(&xmlInputSource, false); // close the file file.close(); if (!success) { tracer->serror(__func__) << "Error occured during parsing the file '" << file.name() << "'" << endl; cleanUp(); if (parser.exception()) { tracer->serror(__func__) << "exception occured: " << parser.exception()->message() << endl; throw parser.exception(); } else { throw new EngineException(i18n("Unknown error while parsing the xml file occured!")); } } // generate a uid if the file does not contain one (for compatibility reason with version 0.0.5) if (!m_uid) { m_uid = generateUid(); } // create the EXIF tagnode if it was not contained in the database (for compatibility reason with version 0.0.6) if (m_exifTitleTag == 0) { createExifTagNode(); } // read the files in all sourcedirectories if (Settings::generalRescanWhileStartup()) { m_fileSystemScanner->rescan(); } // trace a little tracer->sdebug(__func__) << m_fileList->count() << " images added" << endl; }