mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-25 15:56:15 +02: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:
parent
07eefb219f
commit
956a9b6429
@ -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;
|
||||
|
@ -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) + ">";
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user