port from perforce
This commit is contained in:
63
evoke-64k/ev10/textfilereader.cpp
Normal file
63
evoke-64k/ev10/textfilereader.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
#ifdef EXTRACODE
|
||||
/***********************************************************************************/
|
||||
/** \file TextFileReader.cpp
|
||||
** \brief Implementation zur Klasse TextFileReader
|
||||
*************************************************************************************
|
||||
** Autor: Christian Roesch
|
||||
*************************************************************************************
|
||||
** -tut nichts-
|
||||
**
|
||||
*//*********************************************************************************/
|
||||
|
||||
// includes
|
||||
#include "TextFileReader.h"
|
||||
#include <fstream>
|
||||
|
||||
// Methoden-Definitionen
|
||||
|
||||
namespace FrameWork
|
||||
{
|
||||
|
||||
void TextFileReader::clear()
|
||||
{
|
||||
m_vecLines.clear();
|
||||
}
|
||||
|
||||
bool TextFileReader::read( std::string strFileName )
|
||||
{
|
||||
m_vecLines.clear();
|
||||
return append( strFileName );
|
||||
}
|
||||
|
||||
bool TextFileReader::append( std::string strFileName )
|
||||
{
|
||||
std::ifstream ifsIn( strFileName.c_str() );
|
||||
if( !ifsIn.is_open() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
while( !ifsIn.eof() )
|
||||
{
|
||||
std::string strLine;
|
||||
std::getline( ifsIn, strLine, '\n' );
|
||||
m_vecLines.push_back( strLine );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector <std::string>& TextFileReader::getFileLines()
|
||||
{
|
||||
return m_vecLines;
|
||||
}
|
||||
|
||||
int TextFileReader::getLineCount()
|
||||
{
|
||||
return (int)m_vecLines.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
** Ende der Datei: TextFileReader.cpp
|
||||
************************************************************************************/
|
||||
#endif
|
||||
Reference in New Issue
Block a user