This member is never set to NULL and the Para class is not involved in any
inheritance hierarchy. So there is no need to heap-allocate it or pass it around
by pointer.
}
return new Text(
- new Para(
+ Para(
horzAlign),
new Char(
span->font->size,
span->str));
}
- Text::Text(Para* para, Char* chars, Run* run):
+ Text::Text(const Para ¶, Char* chars, Run* run):
_para(para),
_chars(chars),
_run(run)
Text::~Text()
{
- if (_para)
- delete _para;
if (_chars)
delete _chars;
if (_run)
void Text::Print(GVJ_t* job) const
{
- if (_para)
- _para->Print(job);
+ _para.Print(job);
if (_chars)
_chars->Print(job);
}
void PrintRun(GVJ_t* job, unsigned int index) const;
private:
- Text(Para* para, Char* chars, Run* run);
+ Text(const Para ¶, Char* chars, Run* run);
- Para* _para;
+ Para _para;
Char* _chars;
Run* _run;
};