62 lines
1.4 KiB
C++
62 lines
1.4 KiB
C++
/***********************************************************************************/
|
|
/** \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
|
|
************************************************************************************/
|