bool Directory::cp(const File& file) { // exe ise direk deep-independet copy al const Executable *temp = dynamic_cast<const Executable *> (&file); if (temp != NULL) { Executable *nExe = new Executable(*temp); nExe->setTime("18/12/15"); // zamanlar temsilidir nExe->updatePath(this->path() + "/" + nExe->getName()); //path guncelle m_inFiles.insert(nExe); // containere sirali olarak ekle } // klasor ise copy constuctor ile o klasorun deep copy sini al const Directory *temp1 = dynamic_cast<const Directory *> (&file); if (temp1 != NULL) { Directory *nDir = new Directory(*temp1); nDir->setTime("19/12/15"); // zamanlar temsilidir nDir->updatePath(this->path() + "/" + nDir->getName()); // path upd. m_inFiles.insert(nDir); } // text dosyasi ise direk copy al const TextFile *temp2 = dynamic_cast<const TextFile *> (&file); if (temp2 != NULL) { TextFile *nText = new TextFile(*temp2); nText->setTime("21/12/15"); // zamanlar temsilidir nText->updatePath(this->path() + "/" + nText->getName()); m_inFiles.insert(nText); } // dangling pointers temp = NULL; temp1 = NULL; temp2 = NULL; return true; }
void MSA::ToFASTAFile(TextFile &File) const { const unsigned uColCount = GetColCount(); assert(uColCount > 0); const unsigned uLinesPerSeq = (GetColCount() - 1)/FASTA_BLOCK + 1; const unsigned uSeqCount = GetSeqCount(); for (unsigned uSeqIndex = 0; uSeqIndex < uSeqCount; ++uSeqIndex) { File.PutString(">"); File.PutString(GetSeqName(uSeqIndex)); File.PutString("\n"); unsigned n = 0; for (unsigned uLine = 0; uLine < uLinesPerSeq; ++uLine) { unsigned uLetters = uColCount - uLine*FASTA_BLOCK; if (uLetters > FASTA_BLOCK) uLetters = FASTA_BLOCK; for (unsigned i = 0; i < uLetters; ++i) { char c = GetChar(uSeqIndex, n); File.PutChar(c); ++n; } File.PutChar('\n'); } } }
void Parser::addEquation(const Token& startToken, const std::wstring& name, const std::wstring& value) { // parse value string TextFile f; f.openMemory(value); FileTokenizer tok; tok.init(&f); TokenizerPosition start = tok.getPosition(); while (tok.atEnd() == false) { const Token& token = tok.nextToken(); if (token.type == TokenType::Identifier && token.getStringValue() == name) { printError(startToken,L"Recursive enum definition for \"%s\" not allowed",name); return; } } // extract tokens TokenizerPosition end = tok.getPosition(); std::vector<Token> tokens = tok.getTokens(start, end); size_t index = Tokenizer::addEquValue(tokens); for (FileEntry& entry : entries) entry.tokenizer->resetLookaheadCheckMarks(); // register equation Global.symbolTable.addEquation(name, Global.FileInfo.FileNum, Global.Section, index); }
bool EncodingTable::load(const std::wstring& fileName, TextFile::Encoding encoding) { unsigned char hexBuffer[MAXHEXLENGTH]; TextFile input; if (input.open(fileName,TextFile::Read,encoding) == false) return false; hexData.clear(); valueData.clear(); entries.clear(); setTerminationEntry((unsigned char*)"\0",1); while (!input.atEnd()) { std::wstring line = input.readLine(); if (line.empty() || line[0] == '*') continue; if (line[0] == '/') { std::wstring hex = line.substr(1); if (hex.empty() || hex.length() > 2*MAXHEXLENGTH) { // error continue; } int length = parseHexString(hex,hexBuffer); if (length == -1) { // error continue; } setTerminationEntry(hexBuffer,length); } else { size_t pos = line.find(L'='); std::wstring hex = line.substr(0,pos); std::wstring value = line.substr(pos+1); if (hex.empty() || value.empty() || hex.length() > 2*MAXHEXLENGTH) { // error continue; } int length = parseHexString(hex,hexBuffer); if (length == -1) { // error continue; } addEntry(hexBuffer,length,value); } } return true; }
void QuantitativeExperimentalDesign::mapFiles2Design_(map<String, StringList> & experiments, TextFile & file) { // get the defined separator from the parameter setting String separator; getSeparator_(separator); // read the header and split according separator StringList header; TextFile::Iterator iter = file.begin(); iter->split(separator, header); ++iter; // define the column of file name and experimental setting UInt expCol = -1; UInt fileCol = -1; analyzeHeader_(expCol, fileCol, header); // read rest of the file, each row is already split according to separator vector<StringList> rows; for (; iter != file.end(); ++iter) { StringList column; iter->split(separator, column); rows.push_back(column); } // map all file names to the respective experimental setting map<String, StringList>::iterator it; for (vector<StringList>::iterator iter = rows.begin(); iter != rows.end(); ++iter) { // get experimental setting and file name String experiment = iter->at(expCol); String fileName = iter->at(fileCol); // search for experimental setting it = experiments.find(experiment); // if experimental setting is already present, add file name if (it != experiments.end()) { StringList & list = it->second; list.push_back(fileName); } // otherwise create new list else { StringList newList; newList.push_back(fileName); experiments.insert(make_pair(experiment, newList)); } } LOG_INFO << "\n Statistics: \n"; for (it = experiments.begin(); it != experiments.end(); ++it) { LOG_INFO << "Experiment: " << it->first << ", number datasets: " << it->second.size() << endl; } }
void EnsureTemplates(void) { // Because creating a new project depends on the existence of the Templates folder, // make sure that we have some (very) basic templates to work with if the folder // has been deleted. DPath templatePath = gAppPath.GetFolder(); templatePath << "Templates"; bool missing = false; BDirectory tempDir; if (!BEntry(templatePath.GetFullPath()).Exists()) { BDirectory appDir(gAppPath.GetFolder()); appDir.CreateDirectory("Templates", &tempDir); missing = true; } else { tempDir.SetTo(templatePath.GetFullPath()); if (tempDir.CountEntries() == 0) missing = true; } if (missing) { BDirectory dir; tempDir.CreateDirectory("Empty Application", &dir); tempDir.CreateDirectory("Kernel Driver", &dir); tempDir.CreateDirectory("Shared Library or Addon", &dir); tempDir.CreateDirectory("Static Library", &dir); DPath filePath; TextFile file; filePath = templatePath; filePath << "Empty Application/TEMPLATEINFO"; file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE); file.WriteString("TYPE=Application\nLIB=B_BEOS_LIB_DIRECTORY/libsupc++.so\n"); filePath = templatePath; filePath << "Kernel Driver/TEMPLATEINFO"; file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE); file.WriteString("TYPE=Driver\n"); filePath = templatePath; filePath << "Shared Library or Addon/TEMPLATEINFO"; file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE); file.WriteString("TYPE=Shared\n"); filePath = templatePath; filePath << "Static Library/TEMPLATEINFO"; file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE); file.WriteString("TYPE=Static\n"); file.Unset(); } }
/** * Parses specified character. * Sets error if parsed character doesnt match. */ void parse(char ch) { char ch2; if(!m_file.readChar(&ch2) || ch2 != ch) { m_err = MapFile::ERROR_PARSE; m_errLine = m_file.line(); } }
/** * Parses specified string. * Sets error if parsed string doesnt match. */ void parse(const char* str) { char buf[256]; m_file.readString(buf, sizeof(buf)); if(strcmp(str, buf)) { m_err = MapFile::ERROR_PARSE; m_errLine = m_file.line(); } }
/** * Returns true if the next line is empty. */ bool nextLineEmpty() { m_file.skipLine(); char ch; while(m_file.peekChar(&ch) && isspace(ch) && ch != '\n') m_file.readChar(&ch); if(m_file.peekChar(&ch) && ch == '\n') return true; return false; }
/** * 合并Units目录下的所有profile */ void MergeProfiles(const char *filePath) { ifstream ifs(filePath); TextFile profiles; string pathBase="D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\", fileName; while (ifs>>fileName) { profiles.load(pathBase+fileName); } profiles.save("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapTools\\output\\FuncAndStrings.txt"); }
/** * 从总Profile中读取每个小酒店的名称和英雄列表 */ void GetHeroList(const char *profilePath) { TextFile profile; string trvernList[] = {"n01B","n01P","n0GK","n0LJ","n01N","n007","n005","n0LI","n008","n0GJ","n01D","n0LH"}; profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapTools\\conf\\FuncAndStrings.txt"); for (int i=0; i<sizeof(trvernList); i++) { ObjectIdentity trvern_id; trvern_id.set_id(trvernList[i].c_str()); } }
Session::Session(const TextFile& tf) { ystdex::ifile_iterator i(*tf.GetPtr()); while(!tf.CheckEOF()) { if(YB_UNLIKELY(is_undereferenceable(i))) throw LoggedEvent("Bad Source!", Critical); llex.ParseByte(*i); ++i; } }
void Seq::ToFASTAFile(TextFile &File) const { File.PutFormat(">%s\n", m_ptrName); unsigned uColCount = Length(); for (unsigned n = 0; n < uColCount; ++n) { if (n > 0 && n%60 == 0) File.PutString("\n"); File.PutChar(at(n)); } File.PutString("\n"); }
void LoadAssemblyFile(const std::wstring& fileName, TextFile::Encoding encoding) { tTextData Text; int num = 0; AddFileName((char*)convertWStringToUtf8(fileName).c_str()); Global.IncludeNestingLevel++; if (Global.IncludeNestingLevel == ASSEMBLER_INCLUDE_NESTING_LEVEL) { Logger::printError(Logger::Error,L"Maximum include nesting level reached"); return; } TextFile input; if (input.open(fileName,TextFile::Read,encoding) == false) { Logger::printError(Logger::Error,L"Could not open file"); return; } while (!input.atEnd()) { Global.FileInfo.LineNumber++; Global.FileInfo.TotalLineCount++; if (GetLine(input,Text.buffer) == false) continue; if (Text.buffer.size() == 0) continue; Text.buffer = Global.symbolTable.insertEquations(Text.buffer,Global.FileInfo.FileNum,Global.Section); if (CheckEquLabel(Text.buffer) == false) { Text.buffer = checkLabel(Text.buffer,false); splitLine(Text.buffer,Text.name,Text.params); if (Text.name.empty()) continue; if (ParseMacro(input,Text.name,Text.params) == true) continue; if (Arch->AssembleDirective(Text.name,Text.params) == false) { Arch->AssembleOpcode(Text.name,Text.params); } } if (Logger::hasFatalError()) return; } Logger::printQueue(); Global.IncludeNestingLevel--; input.close(); }
static PlankResult plonk_TextFileInternal_TextFileQueue_NextFuntion (PlankMulitFileReaderRef p) { if (! p->currentFile) p->currentFile = pl_File_CreateAndInit(); TextFileQueue& queue = *static_cast<TextFileQueue*> (p->source); TextFile textFile = queue.pop(); pl_File_DeInit (p->currentFile); textFile.disownPeer (p->currentFile); return PlankResult_OK; }
void EDTAFile::store(const String& filename, const FeatureMap& map) const { TextFile tf; tf.addLine("RT\tm/z\tintensity\tcharge"); for (Size i = 0; i < map.size(); ++i) { const Feature& f = map[i]; tf.addLine(String(f.getRT()) + "\t" + f.getMZ() + "\t" + f.getIntensity() + "\t" + f.getCharge()); } tf.store(filename); }
TagBox::TagBox(ToolPanel *panel, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, wxString boxname, wxString modpath) : wxComboBox(panel, id, label, wxDefaultPosition, size) { wxString filename, filepath; wxString readline, tag, text; TextFile opfile; bool check; path = modpath; name = boxname; diagbox = NULL; labelset = false; tag = ""; if(panel->mainwin) diagbox = panel->mainwin->diagbox; diagbox->Write("\nTagBox init " + name + "\n"); // tag history load if(name == "") { diagbox->Write("Tag file not set\n"); return; } filename = name + "tags.ini"; check = opfile.Open(path + "/Tags/" + filename); if(!check) { if(diagbox) diagbox->Write("No tag history\n"); return; } diagbox->Write("Reading tag history " + filename + "\n"); readline = opfile.ReadLine(); while(!readline.IsEmpty()) { //diagbox->Write("Readline " + readline + "\n"); readline = readline.AfterFirst(' '); readline.Trim(); tag = readline; Insert(tag, 0); //diagbox->Write("Insert " + tag + "\n"); readline = opfile.ReadLine(); } opfile.Close(); SetLabel(tag); diagbox->Write(name + " " + tag + "\n"); if(tag != "") labelset = true; }
/** * Loads the user entered batchlist file into a private variable for later use * * @param file The batchlist file to load * * @history 2010-03-26 Sharmila Prasad - Remove the restriction of the number of * columns in the batchlist file to 10. * @throws Isis::IException::User - The batchlist does not contain any data */ void UserInterface::LoadBatchList(const QString file) { // Read in the batch list TextFile temp; try { temp.Open(file); } catch (IException &e) { QString msg = "The batchlist file [" + file + "] could not be opened"; throw IException(IException::User, msg, _FILEINFO_); } p_batchList.resize(temp.LineCount()); for(int i = 0; i < temp.LineCount(); i ++) { QString t; temp.GetLine(t); // Convert tabs to spaces but leave tabs inside quotes alone t = IString(t).Replace("\t", " ", true).ToQt(); t = IString(t).Compress().ToQt().trimmed(); // Allow " ," " , " or ", " as a valid single seperator t = IString(t).Replace(" ,", ",", true).ToQt(); t = IString(t).Replace(", ", ",", true).ToQt(); // Convert all spaces to "," the use "," as delimiter t = IString(t).Replace(" ", ",", true).ToQt(); int j = 0; QStringList tokens = t.split(","); foreach(QString token, tokens) { // removes quotes from tokens. NOTE: also removes escaped quotes. token = token.remove(QRegExp("[\"']")); p_batchList[i].push_back(token); j ++ ; } p_batchList[i].resize(j); // Every row in the batchlist must have the same number of columns if(i == 0) continue; if(p_batchList[i - 1].size() != p_batchList[i].size()) { QString msg = "The number of columns must be constant in batchlist"; throw IException(IException::User, msg, _FILEINFO_); } }
void MainFrame::MainLoad() { long numdat; int i, check, boxindex; wxString filename, filepath; wxString readline, numstring; TextFile infile; wxPoint pos; wxSize size; //filepath = GetPath(); filepath = "Init//"; // Box Load filename = "mainbox.ini"; check = infile.Open(filepath + filename); if(!check) return; readline = infile.ReadLine(); //tofp.WriteLine(readline); while(!readline.IsEmpty()) { numstring = readline.BeforeFirst(' '); numstring.ToLong(&numdat); boxindex = numdat; if(boxindex >= toolset->numtools) break; pos.x = ReadNextData(&readline); pos.y = ReadNextData(&readline); size.x = ReadNextData(&readline); size.y = ReadNextData(&readline); if(toolset->box[boxindex]->servant) toolset->box[boxindex]->visible = (bool)ReadNextData(&readline); else toolset->box[boxindex]->visible = true; if(pos.x >= -5000 && pos.x < 5000 && pos.y >= -5000 && pos.y < 5000) toolset->box[boxindex]->mpos = pos; if(size.x >= 50 && size.x < 2000 && size.y >= 50 && size.y < 2000) toolset->box[boxindex]->boxsize = size; readline = infile.ReadLine(); // Read next line //tofp.WriteLine(readline); } infile.Close(); for(i=0; i<toolset->numtools; i++) { toolset->box[i]->ReSize(); toolset->box[i]->Show(toolset->box[i]->visible); } }
bool Geometry::TextWriter::operator()( Geometry const & geometry, TextFile & file ) { bool result{ true }; if ( geometry.getMesh() ) { Logger::logInfo( m_tabs + cuT( "Writing Geometry " ) + geometry.getName() ); result = file.writeText( cuT( "\n" ) + m_tabs + cuT( "object \"" ) + geometry.getName() + cuT( "\"\n" ) ) > 0 && file.writeText( m_tabs + cuT( "{\n" ) ) > 0; castor::TextWriter< Geometry >::checkError( result, "Geometry name" ); if ( result ) { result = MovableObject::TextWriter{ m_tabs + cuT( "\t" ) }( geometry, file ); } if ( result ) { result = RenderedObject::TextWriter{ m_tabs + cuT( "\t" ) }( geometry, file ); } if ( result ) { result = file.writeText( m_tabs + cuT( "\tmesh \"" ) + geometry.getMesh()->getName() + cuT( "\"\n" ) ) > 0; castor::TextWriter< Geometry >::checkError( result, "Geometry mesh" ); } if ( result ) { result = file.writeText( m_tabs + cuT( "\tmaterials\n" ) ) > 0 && file.writeText( m_tabs + cuT( "\t{\n" ) ) > 0; castor::TextWriter< Geometry >::checkError( result, "Geometry materials" ); if ( result ) { uint16_t index{ 0u }; for ( auto submesh : *geometry.getMesh() ) { result &= file.writeText( m_tabs + cuT( "\t\tmaterial " ) + string::toString( index++ ) + cuT( " \"" ) + geometry.getMaterial( *submesh )->getName() + cuT( "\"\n" ) ) > 0; castor::TextWriter< Geometry >::checkError( result, "Geometry material" ); } if ( result ) { result = file.writeText( m_tabs + cuT( "\t}\n" ) ) > 0; } } } if ( result ) { result = file.writeText( m_tabs + cuT( "}\n" ) ) > 0; } } return result; }
/** * Example: * (Preferred) load address is 00400000 */ void parseLoadAddress() { parse("load"); parse("address"); parse("is"); loadAddr = m_file.readHex(); }
Bool TextFile::WriteText(CStr fileName, CStr text, UInt textLength, Exception* out_ex) { ASSERT_PARAMETER(fileName); ASSERT_PARAMETER(text); TextFile *textFile = TextFile::Create(fileName, out_ex); Bool result = false; if(textFile) { result = textFile->Write(text, textLength, out_ex); GALATEA_DELETE_PTR(textFile); } return result; }
void SeqVect::FromFASTAFile(TextFile &File) { Clear(); FILE *f = File.GetStdioFile(); for (;;) { char *Label; unsigned uLength; char *SeqData = GetFastaSeq(f, &uLength, &Label); if (0 == SeqData) return; Seq *ptrSeq = new Seq; for (unsigned i = 0; i < uLength; ++i) { char c = SeqData[i]; ptrSeq->push_back(c); } ptrSeq->SetName(Label); push_back(ptrSeq); delete[] SeqData; delete[] Label; } }
void GraphBase::BaseStore(wxString path, wxString tag) { int i; TextFile outfile; wxString text, filename, filetag; filename = "gbase-" + tag + ".dat"; //outfile.New(initpath + "/Graphs/" + filename); outfile.New(path + "/" + filename); for(i=0; i<numgraphs; i++) { outfile.WriteLine(graphstore[i].StoreDat(GetTag(i))); //outfile.WriteLine(text.Format } outfile.Close(); }
bool UniformBuffer::TextWriter::operator()( UniformBuffer const & object, TextFile & file ) { bool result = file.writeText( m_tabs + cuT( "constants_buffer \"" ) + object.getName() + cuT( "\"\n" ) ) > 0 && file.writeText( m_tabs + cuT( "{\n" ) ) > 0; checkError( result, "Frame variable buffer" ); auto tabs = m_tabs + cuT( "\t" ); if ( result ) { for ( auto & variable : object ) { if ( result ) { result = file.writeText( tabs + cuT( "variable \"" ) + variable->getName() + cuT( "\"\n" ) ) > 0 && file.writeText( tabs + cuT( "{\n" ) ) > 0; checkError( result, "Frame variable buffer variable name" ); } if ( result ) { result = file.writeText( tabs + cuT( "\tcount " ) + string::toString( variable->getOccCount() ) + cuT( "\n" ) ) > 0; checkError( result, "Frame variable buffer variable occurences" ); } if ( result ) { result = file.writeText( tabs + cuT( "\ttype " ) + variable->getFullTypeName() + cuT( "\n" ) ) > 0; checkError( result, "Frame variable buffer variable type name" ); } if ( result ) { result = file.writeText( tabs + cuT( "\tvalue " ) + variable->getStrValue() + cuT( "\n" ) ) > 0; checkError( result, "Frame variable buffer variable value" ); } if ( result ) { result = file.writeText( tabs + cuT( "}\n" ) ) > 0; checkError( result, "Frame variable buffer variable end" ); } } } if ( result ) { result = file.writeText( m_tabs + cuT( "}\n" ) ) > 0; checkError( result, "Frame variable buffer end" ); } return result; }
/* * Операция за конкатенация, извеждане и въвеждане на файл. */ void CommandPrompt::concatenateFiles(string filePaths){ queue<string> paths; string outputFilePath; string temp; for (int i = 0; i <= filePaths.size(); i++) { /* * Ако сме достигнали '>' записва адреса на параметър ако е останал незаписан * и започва четенето на outputFilePath. */ if (filePaths[i] == '>' || i == filePaths.size()) { if(!temp.empty()) paths.push(temp); if (i != filePaths.size()) { i += 2; while (i < filePaths.size()) { outputFilePath += filePaths[i++]; } } } else if(filePaths[i] == ' ') { paths.push(temp); temp = ""; } else { temp += filePaths[i]; } } /* * Конкатенира данните на всички файлове в опашката и извиква * saveConcatenatedFile с параметри данните и outputFilePath. */ string resultData; TextFile* currentFile; while (!paths.empty()) { temp = paths.front(); currentFile = this->determinePathAndGetFile(temp); if (currentFile != NULL) resultData += currentFile->getData(); else cerr << "File not found!" << endl; paths.pop(); if (!paths.empty()) resultData += '\n'; } this->saveConcatenatedFile(outputFilePath, resultData); }
void MSA::ToPhySequentialFile(TextFile &File) const { const unsigned SeqCount = GetSeqCount(); const unsigned ColCount = GetColCount(); File.PutFormat("%d %d\n", SeqCount, ColCount); if (0 == ColCount) return; for (unsigned Seq = 0; Seq < SeqCount; ++Seq) { char Name[11]; const char *ptrName = GetSeqName(Seq); size_t n = strlen(ptrName); if (n > 10) n = 10; memcpy(Name, ptrName, n); Name[n] = 0; FixName(Name); File.PutFormat("%-10.10s", Name); int BlockIndex = 0; unsigned Col = 0; for (;;) { const unsigned MaxCols = (BlockIndex == 0) ? (BLOCKSIZE - 10) : BLOCKSIZE; for (unsigned ColsThisBlock = 0; ColsThisBlock < MaxCols; ++ColsThisBlock) { if (Col == ColCount) break; if (ColsThisBlock%10 == 0 && (BlockIndex == 0 || ColsThisBlock > 0)) File.PutChar(' '); char c = GetChar(Seq, Col); if (isalpha(c)) c = toupper(c); File.PutChar(c); ++Col; } File.PutChar('\n'); if (Col == ColCount) break; ++BlockIndex; } } }
void SynonymMap::load(const string& sFileName) { close(); TextFile tf; tf.open(sFileName.c_str(), "r"); char szLine[512]; if(tf.isFileOpen()) { while(!tf.isEof() && tf.readLine(szLine, 512, true) > 0) { StringTokenizer st(szLine, ":", StringTokenizer::TOKEN_TRIM | StringTokenizer::TOKEN_IGNORE_EMPTY ); if(st.getNumTokens() != 2) continue; addSynonyms(st[0].c_str(), st[1].c_str()); } } }
void operator << ( stringstream & strm, TextFile & file ) { // get buffer long sz = file.size(); TCHAR * buffer = new TCHAR[sz+1]; if ( !buffer ) return; // if read in, put buffer into stream if ( file.read(buffer,sz) ) { buffer[sz] = '\0'; strm << buffer; } // release buffer delete buffer; }
CAssemblerCommand* parseDirectiveInclude(Parser& parser, int flags) { const Token& start = parser.peekToken(); std::vector<Expression> parameters; if (parser.parseExpressionList(parameters,1,2) == false) return nullptr; std::wstring fileName; if (parameters[0].evaluateString(fileName,true) == false) return nullptr; fileName = getFullPathName(fileName); TextFile::Encoding encoding = TextFile::GUESS; if (parameters.size() == 2) { std::wstring encodingName; if (parameters[1].evaluateString(encodingName,true) == false && parameters[1].evaluateIdentifier(encodingName) == false) return nullptr; encoding = getEncodingFromString(encodingName); } // don't include the file if it's inside a false block if (parser.isInsideTrueBlock() == false) return new DummyCommand(); if (fileExists(fileName) == false) { parser.printError(start,L"Included file \"%s\" does not exist",fileName); return nullptr; } TextFile f; if (f.open(fileName,TextFile::Read,encoding) == false) { parser.printError(start,L"Could not open included file \"%s\"",fileName); return nullptr; } return parser.parseFile(f); }