diff options
Diffstat (limited to 'textblob.cpp')
-rw-r--r-- | textblob.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/textblob.cpp b/textblob.cpp index 65fa1b0..b66f8fa 100644 --- a/textblob.cpp +++ b/textblob.cpp @@ -50,19 +50,25 @@ void TextBlob::clear(){ lines.clear(); } -void TextBlob::read(istream &is){ +i64 TextBlob::read(istream &is){ lines.clear(); string ln; + i64 count=0; while(getline(is,ln)){ + count+=ln.size()+1; lines.push_back(move(ln)); } + return count; } -void TextBlob::write(ostream &os) const { +i64 TextBlob::write(ostream &os) const { + i64 count=0; for(const string &line : lines){ os<<line<<'\n'; + count+=line.size()+1; } os<<flush; + return count; } void TextBlob::setText(const string &text){ |