34 #ifndef SOMAIO_WRITER_PYTHONWRITER_H 35 #define SOMAIO_WRITER_PYTHONWRITER_H 60 int indent,
bool writeInternals );
65 PythonWriter(
const std::string& filename,
67 const HelperSet& helpers = HelperSet() );
69 const HelperSet& helpers = HelperSet() );
73 const HelperSet& helpers = HelperSet() );
74 virtual ~PythonWriter();
76 void open(
const std::string& filename);
78 void attach( std::ostream & s );
81 virtual std::string name()
const;
82 bool operator ! ()
const;
87 const HelperSet & helpers()
const;
88 HelperSet & helpers();
93 void write(
const carto::GenericObject &
object,
94 bool writeInternals =
false,
95 bool writevariable =
true );
97 bool writeInternals =
false,
98 bool writevariable =
true );
100 void write(
const carto::GenericObject &
object,
int indent,
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 );
109 bool isInternal(
const std::string & syntax,
110 const std::string & semantic );
115 void setCatchFunction( CatchFunction f );
122 void writeString(
DataSource &, std::string );
125 static void genericSequenceHelper(
const carto::GenericObject & obj,
126 PythonWriter & w,
int ind,
127 bool writeInternals );
130 void init(
const HelperSet & helpers );
#define DECLARE_GENERIC_OBJECT_TYPE(T)
carto::rc_ptr< DataSource > dataSource()
void setNoneString(const std::string &none)
carto::rc_ptr< DataSource > _datasource
Abstraction layer for various data sources (file, buffer, socket...).
std::map< std::string, Syntax > SyntaxSet
std::map< std::string, Helper > HelperSet
void setQuoteCharacter(char q)
void setSingleLineMode(bool x)
CatchFunction _catchFunction
void(* Helper)(const carto::GenericObject &, PythonWriter &w, int indent, bool writeInternals)
char quoteCharacter() const
std::string noneString() const