Revert "STANDARD ==> remove vector type and replace with std::vector" ==> bad Idea

This reverts commit f15fc7bbad.
This commit is contained in:
Edouard DUPIN 2012-08-09 14:54:26 +02:00
parent cd5fa34bcf
commit 1e3430bdc3
12 changed files with 76 additions and 79 deletions

View File

@ -26,7 +26,7 @@
#define __SVG_BASE_H__
#include <etk/Types.h>
#include <vector>
#include <etk/VectorType.h>
#include <tinyXML/tinyxml.h>
#include <parserSVG/Renderer.h>

View File

@ -105,7 +105,7 @@ bool svg::Group::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2
sizeMax.x = etk_max(sizeMax.x, tmpPos.x);
sizeMax.y = etk_max(sizeMax.y, tmpPos.y);
// add element in the system
m_subElementList.push_back(elementParser);
m_subElementList.PushBack(elementParser);
}
}
}
@ -116,7 +116,7 @@ bool svg::Group::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2
void svg::Group::Display(int32_t spacing)
{
SVG_DEBUG(SpacingDist(spacing) << "Group (START) fill=" << m_paint.fill << " stroke=" << m_paint.stroke << " stroke-width=" << m_paint.strokeWidth );
for (int32_t iii=0; iii<m_subElementList.size(); iii++) {
for (int32_t iii=0; iii<m_subElementList.Size(); iii++) {
if (NULL != m_subElementList[iii]) {
m_subElementList[iii]->Display(spacing+1);
}
@ -126,7 +126,7 @@ void svg::Group::Display(int32_t spacing)
void svg::Group::AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans)
{
for (int32_t iii=0; iii<m_subElementList.size(); iii++) {
for (int32_t iii=0; iii<m_subElementList.Size(); iii++) {
if (NULL != m_subElementList[iii]) {
m_subElementList[iii]->AggDraw(myRenderer, basicTrans);
}

View File

@ -26,14 +26,14 @@
#define __SVG_GROUP_H__
#include <parserSVG/Base.h>
#include <vector>
#include <etk/VectorType.h>
namespace svg
{
class Group : public svg::Base
{
private:
std::vector<svg::Base *> m_subElementList; //!< group sub elements ...
etk::VectorType<svg::Base *> m_subElementList; //!< group sub elements ...
public:
Group(PaintState parentPaintState);
~Group(void);

View File

@ -42,12 +42,12 @@ svg::Path::~Path(void)
// return the next char position ... (after 'X' or NULL)
const char * extractCmd(const char * input, char& cmd, std::vector<float>& outputList)
const char * extractCmd(const char * input, char& cmd, etk::VectorType<float>& outputList)
{
if (*input == '\0') {
return NULL;
}
outputList.clear();
outputList.Clear();
cmd = '\0';
const char * outputPointer = NULL;
if (!( (input[0] <= 'Z' && input[0] >= 'A') || (input[0] <= 'z' && input[0] >= 'a') ) ) {
@ -67,7 +67,7 @@ const char * extractCmd(const char * input, char& cmd, std::vector<float>& outpu
while( sscanf(&input[iii], "%1[, ]%f%n", spacer, &element, &nbElementRead) == 2
|| sscanf(&input[iii], "%f%n", &element, &nbElementRead) == 1) {
SVG_VERBOSE("Find element : " << element);
outputList.push_back(element);
outputList.PushBack(element);
iii += nbElementRead;
}
outputPointer = &input[iii];
@ -95,7 +95,7 @@ bool svg::Path::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D
SVG_VERBOSE("Parse Path : \"" << elementXML << "\"");
char command;
std::vector<float> listDot;
etk::VectorType<float> listDot;
for( const char *sss=extractCmd(elementXML, command, listDot);
NULL != sss;
@ -123,144 +123,144 @@ bool svg::Path::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D
case 'M': // Move To (absolute)
case 'm': // Move To (relative)
// 2 Elements ...
if(listDot.size()%2 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.size() );
if(listDot.Size()%2 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.Size() );
break;
}
pathElement.cmd = svg::PATH_ENUM_MOVETO;
if (listDot.size() >= 2) {
if (listDot.Size() >= 2) {
pathElement.element[0] = listDot[0];
pathElement.element[1] = listDot[1];
m_listElement.push_back(pathElement);
m_listElement.PushBack(pathElement);
}
pathElement.cmd = svg::PATH_ENUM_LINETO;
for(int32_t iii=2; iii<listDot.size(); iii+=2) {
for(int32_t iii=2; iii<listDot.Size(); iii+=2) {
pathElement.element[0] = listDot[iii];
pathElement.element[1] = listDot[iii+1];
m_listElement.push_back(pathElement);
m_listElement.PushBack(pathElement);
}
break;
case 'L': // Line To (absolute)
case 'l': // Line To (relative)
// 2 Elements ...
if(listDot.size()%2 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.size() );
if(listDot.Size()%2 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.Size() );
break;
}
pathElement.cmd = svg::PATH_ENUM_LINETO;
for(int32_t iii=0; iii<listDot.size(); iii+=2) {
for(int32_t iii=0; iii<listDot.Size(); iii+=2) {
pathElement.element[0] = listDot[iii];
pathElement.element[1] = listDot[iii+1];
m_listElement.push_back(pathElement);
m_listElement.PushBack(pathElement);
}
break;
case 'V': // Vertical Line To (absolute)
case 'v': // Vertical Line To (relative)
// 1 Element ...
if(listDot.size() == 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.size() );
if(listDot.Size() == 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.Size() );
break;
}
pathElement.cmd = svg::PATH_ENUM_LINETO_V;
for(int32_t iii=0; iii<listDot.size(); iii+=1) {
for(int32_t iii=0; iii<listDot.Size(); iii+=1) {
pathElement.element[0] = listDot[iii];
m_listElement.push_back(pathElement);
m_listElement.PushBack(pathElement);
}
break;
case 'H': // Horizantal Line To (absolute)
case 'h': // Horizantal Line To (relative)
// 1 Element ...
if(listDot.size() == 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.size() );
if(listDot.Size() == 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.Size() );
break;
}
pathElement.cmd = svg::PATH_ENUM_LINETO_H;
for(int32_t iii=0; iii<listDot.size(); iii+=1) {
for(int32_t iii=0; iii<listDot.Size(); iii+=1) {
pathElement.element[0] = listDot[iii];
m_listElement.push_back(pathElement);
m_listElement.PushBack(pathElement);
}
break;
case 'Q': // Quadratic Bezier curve (absolute)
case 'q': // Quadratic Bezier curve (relative)
// 4 Elements ...
if(listDot.size()%4 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.size() );
if(listDot.Size()%4 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.Size() );
break;
}
pathElement.cmd = svg::PATH_ENUM_BEZIER_CURVETO;
for(int32_t iii=0; iii<listDot.size(); iii+=4) {
for(int32_t iii=0; iii<listDot.Size(); iii+=4) {
pathElement.element[0] = listDot[iii];
pathElement.element[1] = listDot[iii+1];
pathElement.element[2] = listDot[iii+2];
pathElement.element[3] = listDot[iii+3];
m_listElement.push_back(pathElement);
m_listElement.PushBack(pathElement);
}
break;
case 'T': // smooth quadratic Bezier curve to (absolute)
case 't': // smooth quadratic Bezier curve to (relative)
// 2 Elements ...
if(listDot.size()%2 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.size() );
if(listDot.Size()%2 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.Size() );
break;
}
pathElement.cmd = svg::PATH_ENUM_BEZIER_SMOTH_CURVETO;
for(int32_t iii=0; iii<listDot.size(); iii+=2) {
for(int32_t iii=0; iii<listDot.Size(); iii+=2) {
pathElement.element[0] = listDot[iii];
pathElement.element[1] = listDot[iii+1];
m_listElement.push_back(pathElement);
m_listElement.PushBack(pathElement);
}
break;
case 'C': // curve to (absolute)
case 'c': // curve to (relative)
// 6 Elements ...
if(listDot.size()%6 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.size() );
if(listDot.Size()%6 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.Size() );
break;
}
pathElement.cmd = svg::PATH_ENUM_CURVETO;
for(int32_t iii=0; iii<listDot.size(); iii+=6) {
for(int32_t iii=0; iii<listDot.Size(); iii+=6) {
pathElement.element[0] = listDot[iii];
pathElement.element[1] = listDot[iii+1];
pathElement.element[2] = listDot[iii+2];
pathElement.element[3] = listDot[iii+3];
pathElement.element[4] = listDot[iii+4];
pathElement.element[5] = listDot[iii+5];
m_listElement.push_back(pathElement);
m_listElement.PushBack(pathElement);
}
break;
case 'S': // smooth curve to (absolute)
case 's': // smooth curve to (relative)
// 4 Elements ...
if(listDot.size()%4 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.size() );
if(listDot.Size()%4 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.Size() );
break;
}
pathElement.cmd = svg::PATH_ENUM_SMOTH_CURVETO;
for(int32_t iii=0; iii<listDot.size(); iii+=4) {
for(int32_t iii=0; iii<listDot.Size(); iii+=4) {
pathElement.element[0] = listDot[iii];
pathElement.element[1] = listDot[iii+1];
pathElement.element[2] = listDot[iii+2];
pathElement.element[3] = listDot[iii+3];
m_listElement.push_back(pathElement);
m_listElement.PushBack(pathElement);
}
break;
case 'A': // elliptical Arc (absolute)
case 'a': // elliptical Arc (relative)
// 7 Elements ...
if(listDot.size()%7 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.size() );
if(listDot.Size()%7 != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.Size() );
break;
}
pathElement.cmd = svg::PATH_ENUM_ELLIPTIC;
for(int32_t iii=0; iii<listDot.size(); iii+=7) {
for(int32_t iii=0; iii<listDot.Size(); iii+=7) {
pathElement.element[0] = listDot[iii];
pathElement.element[1] = listDot[iii+1];
pathElement.element[2] = listDot[iii+2];
@ -268,18 +268,18 @@ bool svg::Path::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D
pathElement.element[4] = listDot[iii+4];
pathElement.element[5] = listDot[iii+5];
pathElement.element[6] = listDot[iii+6];
m_listElement.push_back(pathElement);
m_listElement.PushBack(pathElement);
}
break;
case 'Z': // closepath (absolute)
case 'z': // closepath (relative)
// 0 Element ...
if(listDot.size() != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.size() );
if(listDot.Size() != 0) {
SVG_WARNING("the PATH command "<< command << " has not the good number of element = " << listDot.Size() );
break;
}
pathElement.cmd = svg::PATH_ENUM_STOP;
m_listElement.push_back(pathElement);
m_listElement.PushBack(pathElement);
break;
default:
SVG_ERROR ("Unknow error : \"" << command << "\"");
@ -292,7 +292,7 @@ bool svg::Path::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D
void svg::Path::Display(int32_t spacing)
{
SVG_DEBUG(SpacingDist(spacing) << "Path");
for(int32_t iii=0; iii<m_listElement.size(); iii++) {
for(int32_t iii=0; iii<m_listElement.Size(); iii++) {
switch (m_listElement[iii].cmd) {
case PATH_ENUM_STOP:
SVG_DEBUG(SpacingDist(spacing+4) << "STOP");
@ -353,7 +353,7 @@ void svg::Path::AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans
path.start_new_path();
for(int32_t iii=0; iii<m_listElement.size(); iii++) {
for(int32_t iii=0; iii<m_listElement.Size(); iii++) {
switch (m_listElement[iii].cmd) {
case PATH_ENUM_STOP:
AbstractCloseSubpath(path);

View File

@ -27,7 +27,6 @@
#include <parserSVG/Base.h>
#include <agg/agg_path_storage.h>
#include <vector>
namespace svg
{
@ -53,7 +52,7 @@ namespace svg
class Path : public svg::Base
{
private:
std::vector<pathBasic_ts> m_listElement;
etk::VectorType<pathBasic_ts> m_listElement;
public:
Path(PaintState parentPaintState);
~Path(void);

View File

@ -61,7 +61,7 @@ bool svg::Polygon::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vecto
Vector2D<float> pos;
int32_t n;
if (sscanf(sss, "%f,%f%n", &pos.x, &pos.y, &n) == 2) {
m_listPoint.push_back(pos);
m_listPoint.PushBack(pos);
sss += n;
sizeMax.x = etk_max(sizeMax.x, pos.x);
sizeMax.y = etk_max(sizeMax.y, pos.y);
@ -77,7 +77,7 @@ bool svg::Polygon::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vecto
void svg::Polygon::Display(int32_t spacing)
{
SVG_DEBUG(SpacingDist(spacing) << "Polygon nbPoint=" << m_listPoint.size());
SVG_DEBUG(SpacingDist(spacing) << "Polygon nbPoint=" << m_listPoint.Size());
}
void svg::Polygon::AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans)
@ -88,7 +88,7 @@ void svg::Polygon::AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTr
path.start_new_path();
path.move_to(m_listPoint[0].x, m_listPoint[0].y);
for( int32_t iii=1; iii< m_listPoint.size(); iii++) {
for( int32_t iii=1; iii< m_listPoint.Size(); iii++) {
path.line_to(m_listPoint[iii].x, m_listPoint[iii].y);
}
path.close_polygon();

View File

@ -26,7 +26,7 @@
#define __SVG_POLYGON_H__
#include <parserSVG/Base.h>
#include <vector>
#include <etk/VectorType.h>
namespace svg
{
@ -37,8 +37,8 @@ namespace svg
class Polygon : public svg::Base
{
private:
std::vector<Vector2D<float> > m_listPoint; //!< list of all point of the polygone
PolygonMode_te m_diplayMode; //!< polygone specific display mode
etk::VectorType<Vector2D<float> > m_listPoint; //!< list of all point of the polygone
PolygonMode_te m_diplayMode; //!< polygone specific display mode
public:
Polygon(PaintState parentPaintState);
~Polygon(void);

View File

@ -59,7 +59,7 @@ bool svg::Polyline::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vect
Vector2D<float> pos;
int32_t n;
if (sscanf(sss, "%f,%f %n", &pos.x, &pos.y, &n) == 2) {
m_listPoint.push_back(pos);
m_listPoint.PushBack(pos);
sizeMax.x = etk_max(sizeMax.x, pos.x);
sizeMax.y = etk_max(sizeMax.y, pos.y);
sss += n;
@ -72,7 +72,7 @@ bool svg::Polyline::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vect
void svg::Polyline::Display(int32_t spacing)
{
SVG_DEBUG(SpacingDist(spacing) << "Polyline nbPoint=" << m_listPoint.size());
SVG_DEBUG(SpacingDist(spacing) << "Polyline nbPoint=" << m_listPoint.Size());
}
@ -81,7 +81,7 @@ void svg::Polyline::AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicT
agg::path_storage path;
path.start_new_path();
path.move_to(m_listPoint[0].x, m_listPoint[0].y);
for( int32_t iii=1; iii< m_listPoint.size(); iii++) {
for( int32_t iii=1; iii< m_listPoint.Size(); iii++) {
path.line_to(m_listPoint[iii].x, m_listPoint[iii].y);
}
/*

View File

@ -26,14 +26,14 @@
#define __SVG_POLYLINE_H__
#include <parserSVG/Base.h>
#include <vector>
#include <etk/VectorType.h>
namespace svg
{
class Polyline : public svg::Base
{
private:
std::vector<Vector2D<float> > m_listPoint; //!< list of all point of the polyline
etk::VectorType<Vector2D<float> > m_listPoint; //!< list of all point of the polyline
public:
Polyline(PaintState parentPaintState);
~Polyline(void);

View File

@ -22,8 +22,6 @@
*******************************************************************************
*/
#include <etk/Types.h>
#include <etk/Memory.h>
#include <parserSVG/Debug.h>
#include <parserSVG/Renderer.h>

View File

@ -184,7 +184,7 @@ svg::Parser::Parser(etk::File fileName) : m_renderedElement(NULL)
maxSize.y=size.y;
}
// add element in the system
m_subElementList.push_back(elementParser);
m_subElementList.PushBack(elementParser);
}
}
}
@ -217,7 +217,7 @@ svg::Parser::~Parser(void)
void svg::Parser::DisplayDebug(void)
{
SVG_DEBUG("Main SVG node : size=" << m_size);
for (int32_t iii=0; iii<m_subElementList.size(); iii++) {
for (int32_t iii=0; iii<m_subElementList.Size(); iii++) {
if (NULL != m_subElementList[iii]) {
m_subElementList[iii]->Display(1);
}
@ -227,7 +227,7 @@ void svg::Parser::DisplayDebug(void)
void svg::Parser::AggDraw(svg::Renderer& myRenderer, agg::trans_affine& basicTrans)
{
for (int32_t iii=0; iii<m_subElementList.size(); iii++) {
for (int32_t iii=0; iii<m_subElementList.Size(); iii++) {
if (NULL != m_subElementList[iii]) {
m_subElementList[iii]->AggDraw(myRenderer, basicTrans);
}

View File

@ -26,7 +26,7 @@
#define __SVG_PARSER_H__
#include <etk/File.h>
#include <vector>
#include <etk/VectorType.h>
#include <parserSVG/Base.h>
namespace svg
@ -34,13 +34,13 @@ namespace svg
class Parser : public svg::Base
{
private:
etk::File m_fileName;
bool m_loadOK;
etk::UString m_version;
etk::UString m_title;
std::vector<svg::Base *> m_subElementList;
Vector2D<float> m_size;
svg::Renderer* m_renderedElement;
etk::File m_fileName;
bool m_loadOK;
etk::UString m_version;
etk::UString m_title;
etk::VectorType<svg::Base *> m_subElementList;
Vector2D<float> m_size;
svg::Renderer* m_renderedElement;
public:
Parser(etk::File fileName);