#i105939# Decided returning by const ref was a bad idea, coupling-

and in terms of unwanted side effects (think vector re-allocating the
mem). Fixed iterator-to-ptr conversion for obvious oversights.
This commit is contained in:
thb
2009-10-16 22:58:23 +02:00
parent d3356548cf
commit 42c0c069b7
6 changed files with 55 additions and 19 deletions

View File

@@ -83,7 +83,7 @@ namespace basegfx
sal_uInt32 count() const;
/// Coordinate interface
const basegfx::B2DPoint& getB2DPoint(sal_uInt32 nIndex) const;
basegfx::B2DPoint getB2DPoint(sal_uInt32 nIndex) const;
void setB2DPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue);
/// Coordinate insert/append
@@ -201,7 +201,7 @@ namespace basegfx
@return
The outer range of the bezier curve/polygon
*/
const B2DRange& getB2DRange() const;
B2DRange getB2DRange() const;
/** insert other 2D polygons
@@ -262,7 +262,7 @@ namespace basegfx
/// apply transformation given in matrix form
void transform(const basegfx::B2DHomMatrix& rMatrix);
// point iterators
// point iterators (same iterator validity conditions as for vector)
const B2DPoint* begin() const;
const B2DPoint* end() const;
B2DPoint* begin();

View File

@@ -129,7 +129,7 @@ namespace basegfx
// apply transformation given in matrix form to the polygon
void transform(const basegfx::B2DHomMatrix& rMatrix);
// polygon iterators
// polygon iterators (same iterator validity conditions as for vector)
const B2DPolygon* begin() const;
const B2DPolygon* end() const;
B2DPolygon* begin();

View File

@@ -131,7 +131,7 @@ namespace basegfx
*/
B2DPolyPolygon solveCrossovers() const;
// element iterators
// element iterators (same iterator validity conditions as for vector)
const B2DRange* begin() const;
const B2DRange* end() const;
B2DRange* begin();

View File

@@ -210,22 +210,34 @@ public:
const basegfx::B2DPoint* begin() const
{
return &maVector.front();
if(maVector.empty())
return 0;
else
return &maVector.front();
}
const basegfx::B2DPoint* end() const
{
return &maVector[maVector.size()];
if(maVector.empty())
return 0;
else
return (&maVector.back())+1;
}
basegfx::B2DPoint* begin()
{
return &maVector.front();
if(maVector.empty())
return 0;
else
return &maVector.front();
}
basegfx::B2DPoint* end()
{
return &maVector[maVector.size()];
if(maVector.empty())
return 0;
else
return (&maVector.back())+1;
}
};
@@ -1201,7 +1213,7 @@ namespace basegfx
return mpPolygon->count();
}
const B2DPoint& B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const
B2DPoint B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const
{
OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)");
@@ -1460,7 +1472,7 @@ namespace basegfx
return mpPolygon->getDefaultAdaptiveSubdivision(*this);
}
const B2DRange& B2DPolygon::getB2DRange() const
B2DRange B2DPolygon::getB2DRange() const
{
return mpPolygon->getB2DRange(*this);
}

View File

@@ -169,22 +169,34 @@ public:
const basegfx::B2DPolygon* begin() const
{
return &maPolygons.front();
if(maPolygons.empty())
return 0;
else
return &maPolygons.front();
}
const basegfx::B2DPolygon* end() const
{
return &maPolygons[maPolygons.size()];
if(maPolygons.empty())
return 0;
else
return (&maPolygons.back())+1;
}
basegfx::B2DPolygon* begin()
{
return &maPolygons.front();
if(maPolygons.empty())
return 0;
else
return &maPolygons.front();
}
basegfx::B2DPolygon* end()
{
return &maPolygons[maPolygons.size()];
if(maPolygons.empty())
return 0;
else
return &(maPolygons.back())+1;
}
};

View File

@@ -229,22 +229,34 @@ namespace basegfx
const B2DRange* begin() const
{
return &maRanges.front();
if(maRanges.empty())
return 0;
else
return &maRanges.front();
}
const B2DRange* end() const
{
return &maRanges[maRanges.size()];
if(maRanges.empty())
return 0;
else
return (&maRanges.back())+1;
}
B2DRange* begin()
{
return &maRanges.front();
if(maRanges.empty())
return 0;
else
return &maRanges.front();
}
B2DRange* end()
{
return &maRanges[maRanges.size()];
if(maRanges.empty())
return 0;
else
return (&maRanges.back())+1;
}
private: