diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2021-03-28 11:58:30 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2021-03-28 12:25:48 (GMT) |
commit | c48639744a6fa118b9851b307107994ba93ce4c8 (patch) | |
tree | 8917c567f8f00560fba4554ade2b7e79bbe3ff45 /src/configimpl.h | |
parent | cef71dc4fcfca9e3580214c39f20dc538ed6b2d9 (diff) | |
download | Doxygen-c48639744a6fa118b9851b307107994ba93ce4c8.zip Doxygen-c48639744a6fa118b9851b307107994ba93ce4c8.tar.gz Doxygen-c48639744a6fa118b9851b307107994ba93ce4c8.tar.bz2 |
Refactoring: Add TextStream buffer to improve output writing performance
- direct use of std::stringstream and std::ostream gave a 30%
drop in performance.
Diffstat (limited to 'src/configimpl.h')
-rw-r--r-- | src/configimpl.h | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/src/configimpl.h b/src/configimpl.h index 2a124f8..60811d1 100644 --- a/src/configimpl.h +++ b/src/configimpl.h @@ -28,6 +28,7 @@ #include "containers.h" #include "qcstring.h" +class TextStream; /** Abstract base class for any configuration option. */ @@ -75,17 +76,17 @@ class ConfigOption void setUserComment(const QCString &u) { m_userComment += u; } protected: - virtual void writeTemplate(std::ostream &t,bool sl,bool upd) = 0; - virtual void compareDoxyfile(std::ostream &t) = 0; + virtual void writeTemplate(TextStream &t,bool sl,bool upd) = 0; + virtual void compareDoxyfile(TextStream &t) = 0; virtual void convertStrToVal() {} virtual void emptyValueToDefault() {} virtual void substEnvVars() = 0; virtual void init() {} - void writeBoolValue(std::ostream &t,bool v); - void writeIntValue(std::ostream &t,int i); - void writeStringValue(std::ostream &t,const QCString &s); - void writeStringList(std::ostream &t,const StringVector &l); + void writeBoolValue(TextStream &t,bool v); + void writeIntValue(TextStream &t,int i); + void writeStringValue(TextStream &t,const QCString &s); + void writeStringList(TextStream &t,const StringVector &l); QCString m_spaces; QCString m_name; @@ -107,8 +108,8 @@ class ConfigInfo : public ConfigOption m_name = name; m_doc = doc; } - void writeTemplate(std::ostream &t, bool sl,bool); - void compareDoxyfile(std::ostream &){}; + void writeTemplate(TextStream &t, bool sl,bool); + void compareDoxyfile(TextStream &){}; void substEnvVars() {} }; @@ -130,8 +131,8 @@ class ConfigList : public ConfigOption WidgetType widgetType() const { return m_widgetType; } StringVector *valueRef() { return &m_value; } StringVector getDefault() { return m_defaultValue; } - void writeTemplate(std::ostream &t,bool sl,bool); - void compareDoxyfile(std::ostream &t); + void writeTemplate(TextStream &t,bool sl,bool); + void compareDoxyfile(TextStream &t); void substEnvVars(); void init() { m_value = m_defaultValue; } private: @@ -157,9 +158,9 @@ class ConfigEnum : public ConfigOption const std::vector<QCString> &values() const { return m_valueRange; } QCString *valueRef() { return &m_value; } void substEnvVars(); - void writeTemplate(std::ostream &t,bool sl,bool); + void writeTemplate(TextStream &t,bool sl,bool); void convertStrToVal(); - void compareDoxyfile(std::ostream &t); + void compareDoxyfile(TextStream &t); void init() { m_value = m_defValue.copy(); } private: @@ -188,8 +189,8 @@ class ConfigString : public ConfigOption WidgetType widgetType() const { return m_widgetType; } void setDefaultValue(const char *v) { m_defValue = v; } QCString *valueRef() { return &m_value; } - void writeTemplate(std::ostream &t,bool sl,bool); - void compareDoxyfile(std::ostream &t); + void writeTemplate(TextStream &t,bool sl,bool); + void compareDoxyfile(TextStream &t); void substEnvVars(); void init() { m_value = m_defValue.copy(); } void emptyValueToDefault() { if(m_value.isEmpty()) m_value=m_defValue; }; @@ -221,8 +222,8 @@ class ConfigInt : public ConfigOption int maxVal() const { return m_maxVal; } void convertStrToVal(); void substEnvVars(); - void writeTemplate(std::ostream &t,bool sl,bool upd); - void compareDoxyfile(std::ostream &t); + void writeTemplate(TextStream &t,bool sl,bool upd); + void compareDoxyfile(TextStream &t); void init() { m_value = m_defValue; } private: int m_value; @@ -250,8 +251,8 @@ class ConfigBool : public ConfigOption void convertStrToVal(); void substEnvVars(); void setValueString(const QCString &v) { m_valueString = v; } - void writeTemplate(std::ostream &t,bool sl,bool upd); - void compareDoxyfile(std::ostream &t); + void writeTemplate(TextStream &t,bool sl,bool upd); + void compareDoxyfile(TextStream &t); void init() { m_value = m_defValue; } private: bool m_value; @@ -266,8 +267,8 @@ class ConfigObsolete : public ConfigOption public: ConfigObsolete(const char *name) : ConfigOption(O_Obsolete) { m_name = name; } - void writeTemplate(std::ostream &,bool,bool); - void compareDoxyfile(std::ostream &) {} + void writeTemplate(TextStream &,bool,bool); + void compareDoxyfile(TextStream &) {} void substEnvVars() {} }; @@ -278,8 +279,8 @@ class ConfigDisabled : public ConfigOption public: ConfigDisabled(const char *name) : ConfigOption(O_Disabled) { m_name = name; } - void writeTemplate(std::ostream &,bool,bool); - void compareDoxyfile(std::ostream &) {} + void writeTemplate(TextStream &,bool,bool); + void compareDoxyfile(TextStream &) {} void substEnvVars() {} }; @@ -473,12 +474,12 @@ class ConfigImpl * is \c TRUE the description of each configuration option will * be omitted. */ - void writeTemplate(std::ostream &t,bool shortIndex,bool updateOnly); + void writeTemplate(TextStream &t,bool shortIndex,bool updateOnly); /*! Writes a the differences between the current configuration and the * template configuration to stream \a t. */ - void compareDoxyfile(std::ostream &t); + void compareDoxyfile(TextStream &t); void setHeader(const char *header) { m_header = header; } |