[DEV] integarate std x11

This commit is contained in:
Edouard DUPIN 2013-11-11 20:19:43 +01:00
parent 7e28d6b250
commit 32b1966f8d
18 changed files with 55 additions and 55 deletions

View File

@ -24,7 +24,7 @@ void esvg::Base::parseTransform(exml::Element* _element) {
if (NULL == _element) {
return;
}
etk::UString inputString = _element->getAttribute("transform");
std::string inputString = _element->getAttribute("transform");
if (inputString.size() == 0) {
return;
}
@ -93,7 +93,7 @@ void esvg::Base::parsePosition(const exml::Element *_element, etk::Vector2D<floa
if (NULL == _element) {
return;
}
etk::UString content = _element->getAttribute("x");
std::string content = _element->getAttribute("x");
if (content.size()!=0) {
_pos.setX(parseLength(content));
}
@ -117,10 +117,10 @@ void esvg::Base::parsePosition(const exml::Element *_element, etk::Vector2D<floa
* @param[in] _dataInput Data C String with the printed lenght
* @return standart number of pixels
*/
float esvg::Base::parseLength(const etk::UString& _dataInput) {
float esvg::Base::parseLength(const std::string& _dataInput) {
SVG_VERBOSE(" lenght : '" << _dataInput << "'");
float n = _dataInput.toFloat();
etk::UString unit;
std::string unit;
for (int32_t iii=0; iii<_dataInput.size(); iii++) {
if( (_dataInput[iii]>='0' && _dataInput[iii]<='9')
|| _dataInput[iii]<='+'
@ -161,7 +161,7 @@ float esvg::Base::parseLength(const etk::UString& _dataInput) {
}
// return the next char position ... (after ';' or NULL)
int32_t extractPartOfStyle(const etk::UString& _data, etk::UString& _outputType, etk::UString& _outputData, int32_t _pos) {
int32_t extractPartOfStyle(const std::string& _data, std::string& _outputType, std::string& _outputData, int32_t _pos) {
_outputType = "";
_outputData = "";
if (_pos == -1) {
@ -205,7 +205,7 @@ void esvg::Base::parsePaintAttr(const exml::Element *_element) {
}
bool fillNone = false;
bool strokeNone = false;
etk::UString content = _element->getAttribute("fill");
std::string content = _element->getAttribute("fill");
if (content.size()!=0) {
m_paint.fill = parseColor(content);
if (m_paint.fill.a == 0) {
@ -280,8 +280,8 @@ void esvg::Base::parsePaintAttr(const exml::Element *_element) {
}
content = _element->getAttribute("style");
if (content.size()!=0) {
etk::UString outputType;
etk::UString outputValue;
std::string outputType;
std::string outputValue;
for( int32_t sss=extractPartOfStyle(content, outputType, outputValue, 0);
-2 != sss;
@ -369,7 +369,7 @@ void esvg::Base::parsePaintAttr(const exml::Element *_element) {
* @param[in] _inputData Data C String with the xml definition
* @return the parsed color
*/
draw::Color esvg::Base::parseColor(const etk::UString& _inputData) {
draw::Color esvg::Base::parseColor(const std::string& _inputData) {
draw::Color localColor = draw::color::white;
if( _inputData.size() > 4

View File

@ -10,7 +10,7 @@
#define __ESVG_BASE_H__
#include <etk/types.h>
#include <etk/Vector.h>
#include <vector>
#include <etk/math/Vector2D.h>
#include <draw/Color.h>
@ -45,9 +45,9 @@ namespace esvg {
virtual void display(int32_t _spacing) { };
void parseTransform(exml::Element *_element);
void parsePosition(const exml::Element *_element, etk::Vector2D<float> &_pos, etk::Vector2D<float> &_size);
float parseLength(const etk::UString& _dataInput);
float parseLength(const std::string& _dataInput);
void parsePaintAttr(const exml::Element *_element);
draw::Color parseColor(const etk::UString& _inputData);
draw::Color parseColor(const std::string& _inputData);
};
};

View File

@ -34,7 +34,7 @@ bool esvg::Circle::parse(exml::Element * _element, agg::trans_affine& _parentTra
// add the property of the parrent modifications ...
m_transformMatrix *= _parentTrans;
etk::UString content = _element->getAttribute("cx");
std::string content = _element->getAttribute("cx");
if (content.size()!=0) {
m_position.setX(parseLength(content));
}

View File

@ -35,7 +35,7 @@ bool esvg::Ellipse::parse(exml::Element * _element, agg::trans_affine& _parentTr
m_c.setValue(0,0);
m_r.setValue(0,0);
etk::UString content = _element->getAttribute("cx");
std::string content = _element->getAttribute("cx");
if (content.size()!=0) {
m_c.setX(parseLength(content));
}

View File

@ -92,7 +92,7 @@ bool esvg::Group::parse(exml::Element * _element, agg::trans_affine& _parentTran
_sizeMax.setValue(etk_max(_sizeMax.x(), tmpPos.x()),
etk_max(_sizeMax.y(), tmpPos.y()));
// add element in the system
m_subElementList.pushBack(elementParser);
m_subElementList.push_back(elementParser);
}
}
}

View File

@ -10,12 +10,12 @@
#define __ESVG_GROUP_H__
#include <esvg/Base.h>
#include <etk/Vector.h>
#include <vector>
namespace esvg {
class Group : public esvg::Base {
private:
etk::Vector<esvg::Base *> m_subElementList; //!< group sub elements ...
std::vector<esvg::Base *> m_subElementList; //!< group sub elements ...
public:
Group(PaintState _parentPaintState);
~Group(void);

View File

@ -35,7 +35,7 @@ bool esvg::Line::parse(exml::Element * _element, agg::trans_affine& _parentTrans
// add the property of the parrent modifications ...
m_transformMatrix *= _parentTrans;
etk::UString content = _element->getAttribute("x1");
std::string content = _element->getAttribute("x1");
if (content.size()!=0) {
m_startPos.setX(parseLength(content));
}

View File

@ -27,7 +27,7 @@ esvg::Path::~Path(void) {
// return the next char position ... (after 'X' or NULL)
const char * extractCmd(const char* _input, char& _cmd, etk::Vector<float>& _outputList) {
const char * extractCmd(const char* _input, char& _cmd, std::vector<float>& _outputList) {
if (*_input == '\0') {
return NULL;
}
@ -51,7 +51,7 @@ const char * extractCmd(const char* _input, char& _cmd, etk::Vector<float>& _out
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.pushBack(element);
_outputList.push_back(element);
iii += nbElementRead;
}
outputPointer = &_input[iii];
@ -73,7 +73,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
m_transformMatrix *= _parentTrans;
etk::UString elementXML1 = _element->getAttribute("d");
std::string elementXML1 = _element->getAttribute("d");
if (elementXML1.size() == 0) {
SVG_ERROR("(l "<<_element->getPos()<<") path: missing 'p' attribute");
return false;
@ -81,7 +81,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
SVG_VERBOSE("Parse Path : \"" << elementXML << "\"");
char command;
etk::Vector<float> listDot;
std::vector<float> listDot;
etk::Char plop = elementXML1.c_str();
const char* elementXML = plop;
@ -119,13 +119,13 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
if (listDot.size() >= 2) {
pathElement.m_element[0] = listDot[0];
pathElement.m_element[1] = listDot[1];
m_listElement.pushBack(pathElement);
m_listElement.push_back(pathElement);
}
pathElement.m_cmd = esvg::pathLineTo;
for(int32_t iii=2; iii<listDot.size(); iii+=2) {
pathElement.m_element[0] = listDot[iii];
pathElement.m_element[1] = listDot[iii+1];
m_listElement.pushBack(pathElement);
m_listElement.push_back(pathElement);
}
break;
@ -140,7 +140,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
for(int32_t iii=0; iii<listDot.size(); iii+=2) {
pathElement.m_element[0] = listDot[iii];
pathElement.m_element[1] = listDot[iii+1];
m_listElement.pushBack(pathElement);
m_listElement.push_back(pathElement);
}
break;
@ -154,7 +154,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
pathElement.m_cmd = esvg::pathLineToV;
for(int32_t iii=0; iii<listDot.size(); iii+=1) {
pathElement.m_element[0] = listDot[iii];
m_listElement.pushBack(pathElement);
m_listElement.push_back(pathElement);
}
break;
@ -168,7 +168,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
pathElement.m_cmd = esvg::pathLineToH;
for(int32_t iii=0; iii<listDot.size(); iii+=1) {
pathElement.m_element[0] = listDot[iii];
m_listElement.pushBack(pathElement);
m_listElement.push_back(pathElement);
}
break;
@ -185,7 +185,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
pathElement.m_element[1] = listDot[iii+1];
pathElement.m_element[2] = listDot[iii+2];
pathElement.m_element[3] = listDot[iii+3];
m_listElement.pushBack(pathElement);
m_listElement.push_back(pathElement);
}
break;
@ -200,7 +200,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
for(int32_t iii=0; iii<listDot.size(); iii+=2) {
pathElement.m_element[0] = listDot[iii];
pathElement.m_element[1] = listDot[iii+1];
m_listElement.pushBack(pathElement);
m_listElement.push_back(pathElement);
}
break;
@ -219,7 +219,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
pathElement.m_element[3] = listDot[iii+3];
pathElement.m_element[4] = listDot[iii+4];
pathElement.m_element[5] = listDot[iii+5];
m_listElement.pushBack(pathElement);
m_listElement.push_back(pathElement);
}
break;
@ -236,7 +236,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
pathElement.m_element[1] = listDot[iii+1];
pathElement.m_element[2] = listDot[iii+2];
pathElement.m_element[3] = listDot[iii+3];
m_listElement.pushBack(pathElement);
m_listElement.push_back(pathElement);
}
break;
@ -256,7 +256,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
pathElement.m_element[4] = listDot[iii+4];
pathElement.m_element[5] = listDot[iii+5];
pathElement.m_element[6] = listDot[iii+6];
m_listElement.pushBack(pathElement);
m_listElement.push_back(pathElement);
}
break;
case 'Z': // closepath (absolute)
@ -267,7 +267,7 @@ bool esvg::Path::parse(exml::Element * _element, agg::trans_affine& _parentTrans
break;
}
pathElement.m_cmd = esvg::pathStop;
m_listElement.pushBack(pathElement);
m_listElement.push_back(pathElement);
break;
default:
SVG_ERROR ("Unknow error : \"" << command << "\"");

View File

@ -38,7 +38,7 @@ namespace esvg {
};
class Path : public esvg::Base {
private:
etk::Vector<PathBasic> m_listElement;
std::vector<PathBasic> m_listElement;
public:
Path(PaintState _parentPaintState);
~Path(void);

View File

@ -36,7 +36,7 @@ bool esvg::Polygon::parse(exml::Element * _element, agg::trans_affine& _parentTr
SVG_VERBOSE("parsed P2. trans : (" << m_transformMatrix.sx << "," << m_transformMatrix.shy << "," << m_transformMatrix.shx << "," << m_transformMatrix.sy << "," << m_transformMatrix.tx << "," << m_transformMatrix.ty << ")");
const etk::UString sss1 = _element->getAttribute("points");
const std::string sss1 = _element->getAttribute("points");
if (sss1.size() == 0) {
SVG_ERROR("(l "/*<<_element->Pos()*/<<") polygon: missing points attribute");
return false;
@ -49,7 +49,7 @@ bool esvg::Polygon::parse(exml::Element * _element, agg::trans_affine& _parentTr
vec2 pos(0,0);
int32_t n;
if (sscanf(sss, "%f,%f%n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
m_listPoint.pushBack(pos);
m_listPoint.push_back(pos);
sss += n;
_sizeMax.setValue(etk_max(_sizeMax.x(), pos.x()),
etk_max(_sizeMax.y(), pos.y()));

View File

@ -10,7 +10,7 @@
#define __ESVG_POLYGON_H__
#include <esvg/Base.h>
#include <etk/Vector.h>
#include <vector>
namespace esvg {
enum polygonMode {
@ -19,7 +19,7 @@ namespace esvg {
};
class Polygon : public esvg::Base {
private:
etk::Vector<etk::Vector2D<float> > m_listPoint; //!< list of all point of the polygone
std::vector<etk::Vector2D<float> > m_listPoint; //!< list of all point of the polygone
enum esvg::polygonMode m_diplayMode; //!< polygone specific display mode
public:
Polygon(PaintState parentPaintState);

View File

@ -31,7 +31,7 @@ bool esvg::Polyline::parse(exml::Element * _element, agg::trans_affine& _parentT
// add the property of the parrent modifications ...
m_transformMatrix *= _parentTrans;
etk::UString sss1 = _element->getAttribute("points");
std::string sss1 = _element->getAttribute("points");
if (sss1.size() == 0) {
SVG_ERROR("(l "<<_element->getPos()<<") polyline: missing points attribute");
return false;
@ -44,7 +44,7 @@ bool esvg::Polyline::parse(exml::Element * _element, agg::trans_affine& _parentT
etk::Vector2D<float> pos;
int32_t n;
if (sscanf(sss, "%f,%f %n", &pos.m_floats[0], &pos.m_floats[1], &n) == 2) {
m_listPoint.pushBack(pos);
m_listPoint.push_back(pos);
_sizeMax.setValue(etk_max(_sizeMax.x(), pos.x()),
etk_max(_sizeMax.y(), pos.y()));
sss += n;

View File

@ -10,12 +10,12 @@
#define __ESVG_POLYLINE_H__
#include <esvg/Base.h>
#include <etk/Vector.h>
#include <vector>
namespace esvg {
class Polyline : public esvg::Base {
private:
etk::Vector<etk::Vector2D<float> > m_listPoint; //!< list of all point of the polyline
std::vector<etk::Vector2D<float> > m_listPoint; //!< list of all point of the polyline
public:
Polyline(PaintState _parentPaintState);
~Polyline(void);

View File

@ -41,7 +41,7 @@ bool esvg::Rectangle::parse(exml::Element * _element, agg::trans_affine& _parent
parsePosition(_element, m_position, m_size);
etk::UString content = _element->getAttribute("rx");
std::string content = _element->getAttribute("rx");
if (content.size()!=0) {
m_roundedCorner.setX(parseLength(content));
}

View File

@ -75,7 +75,7 @@ esvg::Renderer::~Renderer(void) {
// Writing the buffer to a .PPM file, assuming it has
// RGB-structure, one byte per color component
//--------------------------------------------------
void esvg::Renderer::writePpm(etk::UString fileName) {
void esvg::Renderer::writePpm(std::string fileName) {
if (NULL == m_buffer) {
return;
}

View File

@ -58,7 +58,7 @@ namespace esvg {
public:
Renderer(uint32_t width, uint32_t height);
~Renderer(void);
void writePpm(etk::UString fileName);
void writePpm(std::string fileName);
etk::Vector2D<float> m_size;
agg::rendering_buffer * m_renderingBuffer;
agg::pixfmt_rgba32 * m_pixFrame;

View File

@ -35,7 +35,7 @@
#define __class__ "Document"
esvg::Document::Document(const etk::UString& _fileName) : m_renderedElement(NULL) {
esvg::Document::Document(const std::string& _fileName) : m_renderedElement(NULL) {
m_fileName = _fileName;
m_version = "0.0";
m_loadOK = true;
@ -139,7 +139,7 @@ esvg::Document::Document(const etk::UString& _fileName) : m_renderedElement(NULL
maxSize.setY(size.y());
}
// add element in the system
m_subElementList.pushBack(elementParser);
m_subElementList.push_back(elementParser);
}
if (m_size.x() == 0 || m_size.y()==0) {
m_size.setValue((int32_t)maxSize.x(), (int32_t)maxSize.y());
@ -204,7 +204,7 @@ void esvg::Document::generateTestFile(void)
aggDraw(*m_renderedElement, basicTrans);
etk::UString tmpFileOut = "yyy_out_";
std::string tmpFileOut = "yyy_out_";
tmpFileOut += m_fileName;
tmpFileOut += ".ppm";
m_renderedElement->writePpm(tmpFileOut);
@ -243,7 +243,7 @@ void esvg::Document::generateAnImage(int32_t _sizeX, int32_t _sizeY)
aggDraw(*m_renderedElement, basicTrans);
/*
etk::UString tmpFileOut = "zzz_out_test.ppm";
std::string tmpFileOut = "zzz_out_test.ppm";
m_renderedElement->WritePpm(tmpFileOut);
*/
}

View File

@ -10,7 +10,7 @@
#define __ESVG_H__
#include <etk/types.h>
#include <etk/Vector.h>
#include <vector>
#include <etk/math/Vector2D.h>
#include <etk/os/FSNode.h>
@ -20,15 +20,15 @@
namespace esvg {
class Document : public esvg::Base {
private:
etk::UString m_fileName;
std::string m_fileName;
bool m_loadOK;
etk::UString m_version;
etk::UString m_title;
etk::Vector<esvg::Base *> m_subElementList;
std::string m_version;
std::string m_title;
std::vector<esvg::Base *> m_subElementList;
vec2 m_size;
esvg::Renderer* m_renderedElement;
public:
Document(const etk::UString& _fileName);
Document(const std::string& _fileName);
~Document(void);
bool isLoadOk(void) { return m_loadOK; };
void displayDebug(void);