diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2021-04-27 18:28:28 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2021-04-27 18:28:28 (GMT) |
commit | 524176c4c1c1a3af5ec9152d2b50eaa2b9b7c47b (patch) | |
tree | 8904a4acaa1989f948d6de983474910aa5e50aa4 /src/textstream.h | |
parent | 4910e7500060284d815092d8058bbc3e30b925c8 (diff) | |
download | Doxygen-524176c4c1c1a3af5ec9152d2b50eaa2b9b7c47b.zip Doxygen-524176c4c1c1a3af5ec9152d2b50eaa2b9b7c47b.tar.gz Doxygen-524176c4c1c1a3af5ec9152d2b50eaa2b9b7c47b.tar.bz2 |
Optimize performance by using FILE* instead of ofstream for outputgen
Diffstat (limited to 'src/textstream.h')
-rw-r--r-- | src/textstream.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/textstream.h b/src/textstream.h index cee4cb7..a9c4a31 100644 --- a/src/textstream.h +++ b/src/textstream.h @@ -69,6 +69,12 @@ class TextStream final m_s = s; } + void setFile(FILE *f) + { + flush(); + m_f = f; + } + /** Returns the attached std::ostream object. * @see setStream() */ @@ -77,6 +83,11 @@ class TextStream final return m_s; } + FILE *file() const + { + return m_f; + } + /** Adds a character to the stream */ TextStream &operator<<( char c) { @@ -165,6 +176,10 @@ class TextStream final { m_s->write(m_buffer.c_str(),m_buffer.length()); } + else if (m_f) + { + fwrite(m_buffer.c_str(),1,m_buffer.length(),m_f); + } m_buffer.clear(); } @@ -230,6 +245,7 @@ class TextStream final } std::string m_buffer; std::ostream *m_s = nullptr; + FILE *m_f = nullptr; }; #endif |