VLog* VLogFactory::createByURI(const QString& uri) { VLog* res = NULL; VMetaClassList& list = VMetaClassMap::getList((char*)"VLog"); foreach(VMetaClass* metaClass, list) { VLog* metaLog = (VLog*)(metaClass->createInstance()); VLog* log = metaLog->createByURI(uri); delete metaLog; if (log != NULL) { res = log; break; } delete log; }
void VApp::initialize(bool path, bool xml, QString uri) { //--------------------------------------------------------------------------- // set current path //--------------------------------------------------------------------------- if (path) { // VApp::setCurrentPath(VApp::_filePath()); // gilgil temp 2014.12.25 QDir::setCurrent(QCoreApplication::applicationDirPath()); } //--------------------------------------------------------------------------- // load default xml file //--------------------------------------------------------------------------- if (xml) { QString fileName = VXmlDoc::defaultFileName(); if (QFile::exists(fileName)) VXmlDoc::instance().loadFromFile(fileName); } //--------------------------------------------------------------------------- // load default log //--------------------------------------------------------------------------- if (uri != "") { VLogFactory::explicitLink(); VLog* log = VLogFactory::createByDefaultDoc("log"); if (log == NULL) { log = VLogFactory::createByURI(uri); } if (log == NULL) { printf("***********\n"); printf("log is null\n"); printf("***********\n"); return; } log->saveToDefaultDoc("log"); VLog::changeLog(log); } }
void VApp::initialize(bool path, bool xml, QString uri) { //--------------------------------------------------------------------------- // set current path //--------------------------------------------------------------------------- if (path) { VApp::setCurrentPath(QFileInfo(VApp::filePath()).path()); } //--------------------------------------------------------------------------- // load default xml file //--------------------------------------------------------------------------- if (xml) { QString fileName = VXmlDoc::defaultFileName(); // qDebug() << "initialize" << VXmlDoc::instance().toString(); // gilgil temp 2012.05.30 if (QFile::exists(fileName)) VXmlDoc::instance().loadFromFile(fileName); // qDebug() << "initialize" << VXmlDoc::instance().toString(); // gilgil temp 2012.05.30 } //--------------------------------------------------------------------------- // load default log //--------------------------------------------------------------------------- if (uri != "") { VLog* log = VLogFactory::createByDefaultDoc("log"); if (log == NULL) { log = VLogFactory::createByURI(uri); } if (log == NULL) { printf("***********\n"); printf("log is null\n"); printf("***********\n"); return; } log->saveToDefaultDoc("log"); VLog::changeLog(log); } }