1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-09-28 19:30:23 +03:00

Pass file name as std::string to readFileAsString

For consistency, use C++ strings as much as possible in interfaces.
This commit is contained in:
Maarten ter Huurne 2014-08-18 14:22:18 +02:00
parent 07eefb219f
commit 956a9b6429
3 changed files with 3 additions and 3 deletions

View File

@ -523,7 +523,7 @@ void LinkApp::showManual() {
// Txt manuals
if (manual.substr(manual.size()-8,8)==".man.txt") {
string text(readFileAsString(manual.c_str()));
string text(readFileAsString(manual));
TextManualDialog tmd(gmenu2x, getTitle(), getIconPath(), text);
tmd.exec();
return;

View File

@ -58,7 +58,7 @@ string rtrim(const string& s) {
// See this article for a performance comparison of different approaches:
// http://insanecoding.blogspot.com/2011/11/how-to-read-in-file-in-c.html
string readFileAsString(const char *filename) {
string readFileAsString(string const& filename) {
ifstream in(filename, ios::in | ios::binary);
if (!in) {
return "<error opening " + string(filename) + ">";

View File

@ -47,7 +47,7 @@ std::string ltrim(const std::string& s);
std::string rtrim(const std::string& s);
/** Returns the contents of the given file as a string. */
std::string readFileAsString(const char *filename);
std::string readFileAsString(std::string const& filename);
std::string strreplace(std::string orig, const std::string &search, const std::string &replace);
std::string cmdclean(std::string cmdline);