Another SimpleVector
nuked.
This commit is contained in:
@ -233,7 +233,6 @@ Textblock::Textblock (bool limitTextWidth, bool treatAsInline)
|
||||
lines = new misc::SimpleVector <Line> (1);
|
||||
nonTemporaryLines = 0;
|
||||
words = new misc::NotSoSimpleVector <Word> (1);
|
||||
anchors = new misc::SimpleVector <Anchor> (1);
|
||||
|
||||
wrapRefLines = wrapRefParagraphs = -1;
|
||||
wrapRefLinesFCX = wrapRefLinesFCY = -1;
|
||||
@ -280,16 +279,15 @@ Textblock::~Textblock ()
|
||||
for (int i = 0; i < words->size(); i++)
|
||||
cleanupWord (i);
|
||||
|
||||
for (int i = 0; i < anchors->size(); i++) {
|
||||
Anchor *anchor = anchors->getRef (i);
|
||||
for( const Anchor &anchor: anchors )
|
||||
{
|
||||
/* This also frees the names (see removeAnchor() and related). */
|
||||
removeAnchor(anchor->name);
|
||||
removeAnchor(anchor.name);
|
||||
}
|
||||
|
||||
delete paragraphs;
|
||||
delete lines;
|
||||
delete words;
|
||||
delete anchors;
|
||||
|
||||
/* Make sure we don't own widgets anymore. Necessary before call of
|
||||
parent class destructor. (???) */
|
||||
@ -710,8 +708,8 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation)
|
||||
|
||||
sizeAllocateEnd ();
|
||||
|
||||
for (int i = 0; i < anchors->size(); i++) {
|
||||
Anchor *anchor = anchors->getRef(i);
|
||||
for (int i = 0; i < anchors.size(); i++) {
|
||||
Anchor *anchor = &anchors.at(i);
|
||||
int y;
|
||||
|
||||
if (anchor->wordIndex >= words->size() ||
|
||||
@ -2583,12 +2581,11 @@ bool Textblock::addAnchor (const char *name, core::style::Style *style)
|
||||
*/
|
||||
result = false;
|
||||
else {
|
||||
Anchor *anchor;
|
||||
anchors.emplace_back();
|
||||
Anchor &anchor= anchors.back();
|
||||
|
||||
anchors->increase();
|
||||
anchor = anchors->getRef(anchors->size() - 1);
|
||||
anchor->name = copy;
|
||||
anchor->wordIndex = words->size();
|
||||
anchor.name = copy;
|
||||
anchor.wordIndex = words->size();
|
||||
result = true;
|
||||
}
|
||||
|
||||
|
@ -613,7 +613,7 @@ protected:
|
||||
lout::misc::SimpleVector <Paragraph> *paragraphs;
|
||||
int nonTemporaryLines;
|
||||
lout::misc::NotSoSimpleVector <Word> *words;
|
||||
lout::misc::SimpleVector <Anchor> *anchors;
|
||||
std::vector< Anchor > anchors;
|
||||
|
||||
struct { int index, nChar; }
|
||||
hlStart[core::HIGHLIGHT_NUM_LAYERS], hlEnd[core::HIGHLIGHT_NUM_LAYERS];
|
||||
|
@ -1440,8 +1440,8 @@ int Textblock::hyphenateWord (int wordIndex, int *addIndex1)
|
||||
moveWordIndices (wordIndex, numBreaks, addIndex1);
|
||||
|
||||
// Adjust anchor indexes.
|
||||
for (int i = 0; i < anchors->size (); i++) {
|
||||
Anchor *anchor = anchors->getRef (i);
|
||||
for (int i = 0; i < anchors.size (); i++) {
|
||||
Anchor *anchor = &anchors.at (i);
|
||||
if (anchor->wordIndex > wordIndex)
|
||||
anchor->wordIndex += numBreaks;
|
||||
}
|
||||
|
Reference in New Issue
Block a user