[DEV] usdate to the etk::FSNode

This commit is contained in:
Edouard DUPIN 2012-11-01 10:49:36 +01:00
parent 34d4ccc15f
commit 4ee34e6815
2 changed files with 11 additions and 11 deletions

View File

@ -47,7 +47,7 @@
#include <agg/agg_color_rgba.h> #include <agg/agg_color_rgba.h>
#include <agg/agg_pixfmt_rgba.h> #include <agg/agg_pixfmt_rgba.h>
svg::Parser::Parser(etk::File fileName) : m_renderedElement(NULL) svg::Parser::Parser(etk::FSNode fileName) : m_renderedElement(NULL)
{ {
m_fileName = fileName; m_fileName = fileName;
m_version = "0.0"; m_version = "0.0";
@ -74,13 +74,13 @@ svg::Parser::Parser(etk::File fileName) : m_renderedElement(NULL)
m_loadOK = false; m_loadOK = false;
return; return;
} }
int32_t fileSize = m_fileName.Size(); int32_t fileSize = m_fileName.FileSize();
if (0==fileSize) { if (0==fileSize) {
SVG_ERROR("This file is empty : " << m_fileName); SVG_ERROR("This file is empty : " << m_fileName);
m_loadOK = false; m_loadOK = false;
return; return;
} }
if (false == m_fileName.fOpenRead()) { if (false == m_fileName.FileOpenRead()) {
SVG_ERROR("Can not open the file : " << m_fileName); SVG_ERROR("Can not open the file : " << m_fileName);
m_loadOK = false; m_loadOK = false;
return; return;
@ -94,9 +94,9 @@ svg::Parser::Parser(etk::File fileName) : m_renderedElement(NULL)
} }
memset(fileBuffer, 0, (fileSize+5)*sizeof(char)); memset(fileBuffer, 0, (fileSize+5)*sizeof(char));
// load data from the file : // load data from the file :
m_fileName.fRead(fileBuffer, 1, fileSize); m_fileName.FileRead(fileBuffer, 1, fileSize);
// close the file: // close the file:
m_fileName.fClose(); m_fileName.FileClose();
// load the XML from the memory // load the XML from the memory
XmlDocument.Parse((const char*)fileBuffer, 0, TIXML_ENCODING_UTF8); XmlDocument.Parse((const char*)fileBuffer, 0, TIXML_ENCODING_UTF8);
@ -255,7 +255,7 @@ void svg::Parser::GenerateTestFile(void)
AggDraw(*m_renderedElement, basicTrans); AggDraw(*m_renderedElement, basicTrans);
etk::UString tmpFileOut = "yyy_out_"; etk::UString tmpFileOut = "yyy_out_";
tmpFileOut += m_fileName.GetShortFilename(); tmpFileOut += m_fileName.GetNameFile();
tmpFileOut += ".ppm"; tmpFileOut += ".ppm";
m_renderedElement->WritePpm(tmpFileOut); m_renderedElement->WritePpm(tmpFileOut);

View File

@ -25,7 +25,7 @@
#ifndef __SVG_PARSER_H__ #ifndef __SVG_PARSER_H__
#define __SVG_PARSER_H__ #define __SVG_PARSER_H__
#include <etk/os/File.h> #include <etk/os/FSNode.h>
#include <etk/Vector.h> #include <etk/Vector.h>
#include <parserSVG/Base.h> #include <parserSVG/Base.h>
#include <draw/Image.h> #include <draw/Image.h>
@ -35,7 +35,7 @@ namespace svg
class Parser : public svg::Base class Parser : public svg::Base
{ {
private: private:
etk::File m_fileName; etk::FSNode m_fileName;
bool m_loadOK; bool m_loadOK;
etk::UString m_version; etk::UString m_version;
etk::UString m_title; etk::UString m_title;
@ -44,7 +44,7 @@ namespace svg
svg::Renderer* m_renderedElement; svg::Renderer* m_renderedElement;
public: public:
Parser(etk::File fileName); Parser(etk::FSNode fileName);
~Parser(void); ~Parser(void);
bool IsLoadOk(void) { return m_loadOK; }; bool IsLoadOk(void) { return m_loadOK; };
void DisplayDebug(void); void DisplayDebug(void);