зеркало из https://github.com/mozilla/gecko-dev.git
added size_t LineReader::readLine(String& wstr) for convenience.
This commit is contained in:
Родитель
d8def353a3
Коммит
70fd8a8a97
|
@ -1970,7 +1970,7 @@ JS::AsciiFileFormatter JS::stdErr(stderr);
|
|||
// Return the total number of characters read, which is str's length.
|
||||
// Translate <CR> and <CR><LF> sequences to <LF> characters; a <CR><LF> sequence
|
||||
// only counts as one character.
|
||||
size_t JS::LineReader::readLine(string &str)
|
||||
size_t JS::LineReader::readLine(string& str)
|
||||
{
|
||||
int ch;
|
||||
bool oldCRWasLast = crWasLast;
|
||||
|
@ -1995,6 +1995,14 @@ size_t JS::LineReader::readLine(string &str)
|
|||
return str.size();
|
||||
}
|
||||
|
||||
size_t JS::LineReader::readLine(String& wstr)
|
||||
{
|
||||
string str;
|
||||
size_t n = readLine(str);
|
||||
wstr.resize(n);
|
||||
std::transform(str.begin(), str.end(), wstr.begin(), widen);
|
||||
return n;
|
||||
}
|
||||
|
||||
//
|
||||
// Exceptions
|
||||
|
|
|
@ -824,7 +824,8 @@ namespace JavaScript {
|
|||
public:
|
||||
explicit LineReader(FILE *in): in(in), crWasLast(false) {}
|
||||
|
||||
size_t readLine(string &str);
|
||||
size_t readLine(string& str);
|
||||
size_t readLine(String& wstr);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1970,7 +1970,7 @@ JS::AsciiFileFormatter JS::stdErr(stderr);
|
|||
// Return the total number of characters read, which is str's length.
|
||||
// Translate <CR> and <CR><LF> sequences to <LF> characters; a <CR><LF> sequence
|
||||
// only counts as one character.
|
||||
size_t JS::LineReader::readLine(string &str)
|
||||
size_t JS::LineReader::readLine(string& str)
|
||||
{
|
||||
int ch;
|
||||
bool oldCRWasLast = crWasLast;
|
||||
|
@ -1995,6 +1995,14 @@ size_t JS::LineReader::readLine(string &str)
|
|||
return str.size();
|
||||
}
|
||||
|
||||
size_t JS::LineReader::readLine(String& wstr)
|
||||
{
|
||||
string str;
|
||||
size_t n = readLine(str);
|
||||
wstr.resize(n);
|
||||
std::transform(str.begin(), str.end(), wstr.begin(), widen);
|
||||
return n;
|
||||
}
|
||||
|
||||
//
|
||||
// Exceptions
|
||||
|
|
|
@ -824,7 +824,8 @@ namespace JavaScript {
|
|||
public:
|
||||
explicit LineReader(FILE *in): in(in), crWasLast(false) {}
|
||||
|
||||
size_t readLine(string &str);
|
||||
size_t readLine(string& str);
|
||||
size_t readLine(String& wstr);
|
||||
};
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче