本文整理汇总了C++中TextFile类的典型用法代码示例。如果您正苦于以下问题:C++ TextFile类的具体用法?C++ TextFile怎么用?C++ TextFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Executable
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;
}
开发者ID:hmenn,项目名称:GTU-2015-CSE241-OOP-HW,代码行数:35,代码来源:Directory.cpp
示例2: ToFASTAFile
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');
}
}
}
开发者ID:Unode,项目名称:ext_apps,代码行数:29,代码来源:fasta.cpp
示例3: addEquation
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);
}
开发者ID:flame1,项目名称:armips,代码行数:31,代码来源:Parser.cpp
示例4: load
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;
}
开发者ID:StraDaMa,项目名称:armips,代码行数:59,代码来源:EncodingTable.cpp
示例5: getSeparator_
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;
}
}
开发者ID:hroest,项目名称:flaming-archer,代码行数:59,代码来源:QuantitativeExperimentalDesign.C
示例6: EnsureTemplates
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();
}
}
开发者ID:jscipione,项目名称:Paladin,代码行数:58,代码来源:Globals.cpp
示例7: MergeProfiles
/**
* 合并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");
}
开发者ID:Arathi,项目名称:W3Objects,代码行数:14,代码来源:W3OMain.cpp
示例8: GetHeroList
/**
* 从总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());
}
}
开发者ID:Arathi,项目名称:W3Objects,代码行数:14,代码来源:W3OMain.cpp
示例9: i
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;
}
}
开发者ID:kis2009dsh,项目名称:YSLib,代码行数:12,代码来源:SContext.cpp
示例10: ToFASTAFile
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");
}
开发者ID:bigmuscle,项目名称:bigmuscle,代码行数:12,代码来源:seq.cpp
示例11: LoadAssemblyFile
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();
}
开发者ID:kabochi,项目名称:armips,代码行数:52,代码来源:Assembler.cpp
示例12: plonk_TextFileInternal_TextFileQueue_NextFuntion
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;
}
开发者ID:jamiebullock,项目名称:pl-nk,代码行数:13,代码来源:plonk_TextFile.cpp
示例13: store
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);
}
开发者ID:BioinformaticsArchive,项目名称:OpenMS,代码行数:14,代码来源:EDTAFile.cpp
示例14: wxComboBox
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;
}
开发者ID:HypoModel,项目名称:HypoModBase,代码行数:49,代码来源:hypocontrols.cpp
示例15: LoadBatchList
/**
* 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_);
}
}
开发者ID:corburn,项目名称:ISIS,代码行数:57,代码来源:UserInterface.cpp
示例16: MainLoad
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);
}
}
开发者ID:HypoModel,项目名称:HypoModBase,代码行数:48,代码来源:hypobase.cpp
示例17: cuT
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;
}
开发者ID:DragonJoker,项目名称:Castor3D,代码行数:58,代码来源:Geometry.cpp
示例18: ASSERT_PARAMETER
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;
}
开发者ID:Valrandir,项目名称:Galatea,代码行数:16,代码来源:TextFile.cpp
示例19: FromFASTAFile
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;
}
}
开发者ID:cran,项目名称:muscle,代码行数:27,代码来源:seqvect.cpp
示例20: BaseStore
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();
}
开发者ID:hypomod,项目名称:HypoModelBase,代码行数:16,代码来源:hypodat.cpp
注:本文中的TextFile类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论