34 #ifndef SOMAIO_WRITER_PYTHONWRITER_H
35 #define SOMAIO_WRITER_PYTHONWRITER_H
60 int indent,
bool writeInternals );
76 void open(
const std::string& filename);
81 virtual std::string
name()
const;
82 bool operator ! ()
const;
94 bool writeInternals =
false,
95 bool writevariable =
true );
97 bool writeInternals =
false,
98 bool writevariable =
true );
101 const std::string & syntax =
"",
102 const std::string & semantic =
"",
103 bool writeInternals =
false );
106 const std::string & syntax =
"",
107 const std::string & semantic =
"",
108 bool writeInternals =
false );
110 const std::string & semantic );
127 bool writeInternals );
Abstraction layer for various data sources (file, buffer, socket...).
PythonWriter(const carto::SyntaxSet &rules=carto::SyntaxSet(), const HelperSet &helpers=HelperSet())
carto::SyntaxSet & syntaxes()
void setQuoteCharacter(char q)
void write(const carto::Object &object, int indent, const std::string &syntax="", const std::string &semantic="", bool writeInternals=false)
Writes an element according to the syntax.
const carto::SyntaxSet & syntaxes() const
CatchFunction _catchFunction
void write(const carto::GenericObject &object, int indent, const std::string &syntax="", const std::string &semantic="", bool writeInternals=false)
Writes an element according to the syntax.
void writeString(DataSource &, std::string)
utility function
PythonWriter(const std::string &filename, const carto::SyntaxSet &rules=carto::SyntaxSet(), const HelperSet &helpers=HelperSet())
void open(const std::string &filename)
virtual std::string name() const
std::map< std::string, Helper > HelperSet
PythonWriter(carto::rc_ptr< DataSource > ds, const carto::SyntaxSet &rules=carto::SyntaxSet(), const HelperSet &helpers=HelperSet())
PythonWriter takes ownership of the DataSource.
void setCatchFunction(CatchFunction f)
if set, the catch function is used instead of throwing the regular exception during writing
void write(const carto::Object &object, bool writeInternals=false, bool writevariable=true)
void setSingleLineMode(bool x)
void attach(carto::rc_ptr< DataSource > ds)
carto::rc_ptr< DataSource > dataSource()
void(* Helper)(const carto::GenericObject &, PythonWriter &w, int indent, bool writeInternals)
const HelperSet & helpers() const
helper functions read basic data type
void setNoneString(const std::string &none)
void init(const HelperSet &helpers)
carto::rc_ptr< DataSource > _datasource
void write(const carto::GenericObject &object, bool writeInternals=false, bool writevariable=true)
Writes a generic object to stream.
bool isInternal(const std::string &syntax, const std::string &semantic)
char quoteCharacter() const
std::string noneString() const
void attach(std::ostream &s)
attach to an existing (and open) stream
std::map< std::string, Syntax > SyntaxSet
#define DECLARE_GENERIC_OBJECT_TYPE(T)