summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2020-01-05 22:43:52 +0100
committerAlbert Astals Cid <tsdgeos@yahoo.es>2020-01-05 22:44:45 +0000
commit6b1ee539705f1ddf8e252f1589866862ad688bc2 (patch)
tree081d997b2b2ccfc0443d314f8c685ddda61408ca
parentcb5bece4f51040cf1d3be5a32af83c989d9c7885 (diff)
No need for HtmlFontAccu::accu to be a pointer at all
-rw-r--r--utils/HtmlFonts.cc12
-rw-r--r--utils/HtmlFonts.h6
2 files changed, 8 insertions, 10 deletions
diff --git a/utils/HtmlFonts.cc b/utils/HtmlFonts.cc
index efd14cd2..964ab018 100644
--- a/utils/HtmlFonts.cc
+++ b/utils/HtmlFonts.cc
@@ -251,32 +251,30 @@ GooString* HtmlFont::HtmlFilter(const Unicode* u, int uLen) {
}
HtmlFontAccu::HtmlFontAccu(){
- accu=new std::vector<HtmlFont>();
}
HtmlFontAccu::~HtmlFontAccu(){
- if (accu) delete accu;
}
int HtmlFontAccu::AddFont(const HtmlFont& font){
std::vector<HtmlFont>::iterator i;
- for (i=accu->begin();i!=accu->end();++i)
+ for (i=accu.begin();i!=accu.end();++i)
{
if (font.isEqual(*i))
{
- return (int)(i-(accu->begin()));
+ return (int)(i-(accu.begin()));
}
}
- accu->push_back(font);
- return (accu->size()-1);
+ accu.push_back(font);
+ return (accu.size()-1);
}
// get CSS font definition for font #i
GooString* HtmlFontAccu::CSStyle(int i, int j){
GooString *tmp=new GooString();
- std::vector<HtmlFont>::iterator g=accu->begin();
+ std::vector<HtmlFont>::iterator g=accu.begin();
g+=i;
HtmlFont font=*g;
GooString *colorStr=font.getColor().toString();
diff --git a/utils/HtmlFonts.h b/utils/HtmlFonts.h
index 88cc1e8e..195f46fa 100644
--- a/utils/HtmlFonts.h
+++ b/utils/HtmlFonts.h
@@ -96,7 +96,7 @@ public:
class HtmlFontAccu{
private:
- std::vector<HtmlFont> *accu;
+ std::vector<HtmlFont> accu;
public:
HtmlFontAccu();
@@ -105,10 +105,10 @@ public:
HtmlFontAccu& operator=(const HtmlFontAccu &) = delete;
int AddFont(const HtmlFont& font);
HtmlFont *Get(int i){
- return &(*accu)[i];
+ return &accu[i];
}
GooString* CSStyle(int i, int j = 0);
- int size() const {return accu->size();}
+ int size() const {return accu.size();}
};
#endif