diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2021-04-11 19:22:59 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2021-04-22 17:34:13 (GMT) |
commit | 592aaa4f17d73ec8c475df0f44efaea8cc4d575c (patch) | |
tree | 3cfd68cec756661045ee25c906a8d8f4bddf7a6a /src/configimpl.h | |
parent | 98c67549bc3cd855873e0ef5eeab7c6410699d78 (diff) | |
download | Doxygen-592aaa4f17d73ec8c475df0f44efaea8cc4d575c.zip Doxygen-592aaa4f17d73ec8c475df0f44efaea8cc4d575c.tar.gz Doxygen-592aaa4f17d73ec8c475df0f44efaea8cc4d575c.tar.bz2 |
Refactoring: remove implicit conversion from QCString to const char *
This commit changes the following in relation to string use
- The implicit convert from 'QCString' to 'const char *' is removed
- Strings parameters use 'const QCString &' as much as possible in favor
over 'const char *'
- 'if (s)' where s is a QCString has been replaced by 'if(!s.isEmpty())'
- data() now always returns a valid C-string and not a 0-pointer.
- when passing a string 's' to printf and related functions 'qPrint(s)' is
used instead of 's.data()'
- for empty string arguments 'QCString()' is used instead of '0'
- The copy() operation has been removed
- Where possible 'qstrcmp(a,b)==0' has been replaces by 'a==b' and
'qstrcmp(a,b)<0' has been replaced by 'a<b'
- Parameters of string type that were default initialized with '= 0' are
no initialized with '= QCString()'
Diffstat (limited to 'src/configimpl.h')
-rw-r--r-- | src/configimpl.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/configimpl.h b/src/configimpl.h index 60811d1..d90fe8c 100644 --- a/src/configimpl.h +++ b/src/configimpl.h @@ -161,7 +161,7 @@ class ConfigEnum : public ConfigOption void writeTemplate(TextStream &t,bool sl,bool); void convertStrToVal(); void compareDoxyfile(TextStream &t); - void init() { m_value = m_defValue.copy(); } + void init() { m_value = m_defValue; } private: std::vector<QCString> m_valueRange; @@ -192,7 +192,7 @@ class ConfigString : public ConfigOption void writeTemplate(TextStream &t,bool sl,bool); void compareDoxyfile(TextStream &t); void substEnvVars(); - void init() { m_value = m_defValue.copy(); } + void init() { m_value = m_defValue; } void emptyValueToDefault() { if(m_value.isEmpty()) m_value=m_defValue; }; private: @@ -364,9 +364,9 @@ class ConfigImpl /*! Returns the ConfigOption corresponding with \a name or 0 if * the option is not supported. */ - ConfigOption *get(const char *name) const + ConfigOption *get(const QCString &name) const { - auto it = m_dict.find(name); + auto it = m_dict.find(name.str()); return it!=m_dict.end() ? it->second : nullptr; } /* @} */ @@ -508,14 +508,13 @@ class ConfigImpl * \returns TRUE if successful, or FALSE if the string could not be * parsed. */ - //bool parseString(const char *fn,const char *str); - bool parseString(const char *fn,const char *str,bool upd = FALSE); + bool parseString(const QCString &fn,const QCString &str,bool upd = FALSE); /*! Parse a configuration file with name \a fn. * \returns TRUE if successful, FALSE if the file could not be * opened or read. */ - bool parse(const char *fn,bool upd = FALSE); + bool parse(const QCString &fn,bool upd = FALSE); /*! Called from the constructor, will add doxygen's default options * to the configuration object |