void Loader::onImport( const location& loc, const std::string& importTypeName ) { // Notice: the type is not loaded now in order to avoid cyclic dependencies. if( _typeBuilder.isValid() ) { pushError( loc, "all import clauses must come before the type specification" ); return; } size_t lastDotPos = importTypeName.rfind( '.' ); if( lastDotPos == std::string::npos ) { pushError( loc, "type is in the same namespace and does not require importing" ); return; } std::string localTypeName = importTypeName.substr( lastDotPos + 1 ); // checks whether a type with the same local name was already imported ImportTypeMap::iterator it = _importedTypes.find( localTypeName ); if( it != _importedTypes.end() ) { PUSH_ERROR( loc, "import '" << importTypeName << "' conflicts with a " "previous import at line " << it->second.loc.begin.line ); return; } _importedTypes.insert( ImportTypeMap::value_type( localTypeName, ImportInfo( importTypeName, loc ) ) ); }
void Gopher::on_actionImport_triggered() { QString inFile; QFile file; QString filename = QFileDialog::getOpenFileName(this, "Open file", "" ,""); file.setFileName(filename); file.open(QIODevice::ReadWrite | QIODevice::Text); inFile = file.readAll(); file.close(); QJsonDocument input = QJsonDocument::fromJson(inFile.toUtf8()); list = input.object(); //Info { ImportInfo(); } //TEM 2D { ImportTEM2D(); } //TEM Tomo { ImportTEMTomo(); } //Cryo-Tem 2D { //Cryo-Tem Tab { ImportCryoTEM(); } //Vitrobot Settings Tab { ImportCryoTEMVitrobotSettings(); } } //Cryo-Tem Tomo { //Cryo-Tem Tomo Tab { ImportCryoTEMTomo(); } //Vitrobot Settings Tab { ImportCryoTEMTomoVitrobotSettings(); } } //Stem 2D { ImportStem2D(); } //Stem Tomo { ImportStemTomo(); } //SEM { ImportSEM(); } //Cryo-SEM { //Cryo-SEM Tab { ImportCryoSEM(); } //vitrobot Tab { ImportCryoSEMVitrobotSettings(); } } //Confocal { ImportConfocal(); } }