text_file_loader.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00033 #include "gpucalc/text_file_loader.h"
00034
00035 #include "gpucalc/log_manager.h"
00036
00037 namespace gpucalc
00038 {
00039 namespace auxillary
00040 {
00041 std::string TextFileLoader::load(const std::string & FileName)
00042 {
00043 LogManager::getSingleton().logMessage(Object("TextFileLoader", "TextFileLoader"), "Loading \"" + FileName + "\"", LML_Trivial);
00044 std::ifstream ifile(FileName.c_str());
00045 if (!ifile)
00046 {
00047 Except<ERR_FILE_NOT_FOUND>(Object("TextFileLoader", "TextFileLoader"), "Failed to load \"" + FileName + "\".", "TextFileLoader::Load", __FILE__, __LINE__);
00048 return "";
00049 }
00050 else
00051 {
00052 std::ostringstream result;
00053 result << ifile.rdbuf();
00054 return result.str();
00055 }
00056 }
00057 }
00058 }