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/image.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/image.h')
-rw-r--r-- | src/image.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/image.h b/src/image.h index 6eb2c21..cbeea87 100644 --- a/src/image.h +++ b/src/image.h @@ -20,6 +20,7 @@ #define _IMAGE_H #include "types.h" +#include "qcstring.h" /** Class representing a bitmap image generated by doxygen. */ class Image @@ -31,19 +32,19 @@ class Image void setPixel(uint x,uint y,uchar val); uchar getPixel(uint x,uint y) const; void writeChar(uint x,uint y,char c,uchar fg); - void writeString(uint x,uint y,const char *s,uchar fg); + void writeString(uint x,uint y,const QCString &s,uchar fg); void drawHorzLine(uint y,uint xs,uint xe,uchar colIndex,uint mask); void drawHorzArrow(uint y,uint xs,uint xe,uchar colIndex,uint mask); void drawVertLine(uint x,uint ys,uint ye,uchar colIndex,uint mask); void drawVertArrow(uint x,uint ys,uint ye,uchar colIndex,uint mask); void drawRect(uint x,uint y,uint width,uint height,uchar colIndex,uint mask); void fillRect(uint x,uint y,uint width,uint height,uchar colIndex,uint mask); - bool save(const char *fileName,int mode=0); - friend uint stringLength(const char *s); + bool save(const QCString &fileName,int mode=0); + friend uint stringLength(const QCString &s); uint width() const { return m_width; } uint height() const { return m_height; } uchar *data() const { return m_data; } - static uint stringLength(const char *s); + static uint stringLength(const QCString &s); private: uint m_width; @@ -59,7 +60,7 @@ class ColoredImage const uchar *greyLevels,const uchar *alphaLevels, int saturation,int hue,int gamma); ~ColoredImage(); - bool save(const char *fileName); + bool save(const QCString &fileName); static void hsl2rgb(double h,double s,double l, double *pRed,double *pGreen,double *pBlue); private: |