X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftexstream.cpp;h=ec8158d8fd2295d97d906ac7d349e4fb3c11772c;hb=0c7bd9a57f2a308bb9659200eda3b7e45f8d5d3c;hp=16f8dfbe68dee11acfa0a76fbf5e829d2f15ab6e;hpb=b917c4e40f9f5cd3d101444600eddafcca54d6e3;p=lyx.git diff --git a/src/texstream.cpp b/src/texstream.cpp index 16f8dfbe68..ec8158d8fd 100644 --- a/src/texstream.cpp +++ b/src/texstream.cpp @@ -11,6 +11,9 @@ #include #include "texstream.h" + +#include "TexRow.h" + #include "support/lstrings.h" #include "support/unicode.h" @@ -30,10 +33,26 @@ using lyx::support::split; namespace lyx { -void otexrowstream::append(docstring const & str, TexRow const & texrow) +otexrowstream::otexrowstream(odocstream & os, bool enable) + : os_(os), texrow_(make_unique(enable)) +{} + + +otexrowstream::~otexrowstream() = default; + + +unique_ptr otexrowstream::releaseTexRow() +{ + auto p = make_unique(); + swap(texrow_, p); + return p; +} + + +void otexrowstream::append(docstring const & str, TexRow texrow) { os_ << str; - texrow_.append(texrow); + texrow_->append(move(texrow)); } @@ -41,7 +60,7 @@ void otexrowstream::put(char_type const & c) { os_.put(c); if (c == '\n') - texrow_.newline(); + texrow_->newline(); }