34 #ifndef SOMAIO_READER_PYTHONREADER_H
35 #define SOMAIO_READER_PYTHONREADER_H
84 void open(
const std::string& filename )
88 void attach( std::istream & s,
int line_num = 1 );
90 void attach(
const std::string& filename );
93 virtual std::string
name()
const;
124 const std::string & semantic );
131 std::string
readString(
char separator,
unsigned & charsread );
#define __deprecated__(msg)
bool operator!() const
status of the stream
std::string readString(char separator, unsigned &charsread)
const carto::SyntaxSet & syntaxes() const
void readDictionary(carto::GenericObject &obj)
reads an already allocated dictionary: just fills it (doesn't clear it)
void attach(std::istream &s, int line_num=1)
attach to an existing istream
std::string readWhile(const std::string &s)
read characters in s
void readDictionary2(carto::GenericObject &obj)
reads the remaining attributes of a string dictionary
void readIntDictionary2(carto::TypedObject< carto::IntDictionary > &obj)
reads the remaining attributes of an int dictionary
carto::GenericObject * read(carto::GenericObject *parent, const std::string &semantic)
virtual std::string name() const
file name
virtual carto::GenericObject * read()
carto::SyntaxSet & syntaxes()
void init(const HelperSet &helpers)
unsigned skipWhile(const std::string &s)
skip characters in s
void attach(const std::string &filename)
void skipUntil(const std::string &s)
skip characters not in s
PythonReader(const std::string &filename, const carto::SyntaxSet &rules=carto::SyntaxSet(), const HelperSet &helpers=HelperSet())
std::string readVariableName()
carto::GenericObject *(* Helper)(carto::GenericObject *, const std::string &, PythonReader &)
std::map< std::string, Helper > HelperSet
virtual void read(carto::Object &)
bool eof() const
have we hit EOF?
std::string lineString() const
carto::rc_ptr< DataSource > dataSource()
const HelperSet & helpers() const
helper functions read basic data type
PythonReader(carto::rc_ptr< DataSource > ds, const carto::SyntaxSet &rules=carto::SyntaxSet(), const HelperSet &helpers=HelperSet())
PythonReader takes ownership of the DataSource.
std::string readUntil(const std::string &s)
read characters not in s
void attach(carto::rc_ptr< DataSource > ds)
bool is_open() const
is the stream open?
bool readSyntax(std::string &syntax)
attempts to read the syntax and general type of next element and fills syntax and type accordingly.
PythonReader(const carto::SyntaxSet &rules=carto::SyntaxSet(), const HelperSet &helpers=HelperSet())
virtual void read(carto::GenericObject &)
attempts to read an already allocated object, if file data matches the object type.
void open(const std::string &filename) __attribute__((__deprecated__("use attach() instead")))
static carto::GenericObject * propertySetHelper(carto::GenericObject *, const std::string &, PythonReader &r)
static carto::GenericObject * dictHelper(carto::GenericObject *, const std::string &, PythonReader &r)
utility function, dictionary helper (can be useful in more specialized readers)
std::map< std::string, Syntax > SyntaxSet
#define DECLARE_GENERIC_OBJECT_TYPE(T)