|
soma-io 6.0.6
|
#include <soma-io/reader/pythonreader.h>
Classes | |
| struct | Private |
Public Types | |
| typedef carto::GenericObject *(* | Helper) (carto::GenericObject *, const std::string &, PythonReader &) |
| typedef std::map< std::string, Helper > | HelperSet |
Public Member Functions | |
| PythonReader (const std::string &filename, const carto::SyntaxSet &rules=carto::SyntaxSet(), const HelperSet &helpers=HelperSet()) | |
| PythonReader (const carto::SyntaxSet &rules=carto::SyntaxSet(), const HelperSet &helpers=HelperSet()) | |
| PythonReader (carto::rc_ptr< DataSource > ds, const carto::SyntaxSet &rules=carto::SyntaxSet(), const HelperSet &helpers=HelperSet()) | |
| PythonReader takes ownership of the DataSource. | |
| virtual | ~PythonReader () |
| virtual carto::GenericObject * | read () |
| virtual void | read (carto::GenericObject &) |
| attempts to read an already allocated object, if file data matches the object type. | |
| virtual void | read (carto::Object &) |
| void | readDictionary (carto::GenericObject &obj) |
| reads an already allocated dictionary: just fills it (doesn't clear it) | |
| 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 | |
| void | open (const std::string &filename) __attribute__((__deprecated__("use attach() instead"))) |
| void | close () |
| void | attach (std::istream &s, int line_num=1) |
| attach to an existing istream | |
| void | attach (carto::rc_ptr< DataSource > ds) |
| void | attach (const std::string &filename) |
| carto::rc_ptr< DataSource > | dataSource () |
| virtual std::string | name () const |
| file name | |
| int | line () const |
| std::string | lineString () const |
| bool | operator! () const |
| status of the stream | |
| bool | is_open () const |
| is the stream open? | |
| bool | eof () const |
| have we hit EOF? | |
| const HelperSet & | helpers () const |
| helper functions read basic data type | |
| HelperSet & | helpers () |
| const carto::SyntaxSet & | syntaxes () const |
| carto::SyntaxSet & | syntaxes () |
| std::string | readUntil (const std::string &s) |
| read characters not in s | |
| void | skipUntil (const std::string &s) |
| skip characters not in s | |
| std::string | readWhile (const std::string &s) |
| read characters in s | |
| unsigned | skipWhile (const std::string &s) |
| skip characters in s | |
| carto::GenericObject * | read (carto::GenericObject *parent, const std::string &semantic) |
| std::string | readVariableName () |
| bool | readSyntax (std::string &syntax) |
attempts to read the syntax and general type of next element and fills syntax and type accordingly. | |
| std::string | readString (char separator, unsigned &charsread) |
Static Public Member Functions | |
| static carto::GenericObject * | dictHelper (carto::GenericObject *, const std::string &, PythonReader &r) |
| utility function, dictionary helper (can be useful in more specialized readers) | |
| static carto::GenericObject * | propertySetHelper (carto::GenericObject *, const std::string &, PythonReader &r) |
| template<typename T> | |
| static carto::GenericObject * | genericSequenceHelper (carto::GenericObject *, const std::string &, PythonReader &r) |
| template<typename T> | |
| static carto::GenericObject * | genericDictHelper (carto::GenericObject *, const std::string &, PythonReader &r) |
Protected Member Functions | |
| void | init (const HelperSet &helpers) |
Definition at line 50 of file pythonreader.h.
| typedef carto::GenericObject *(* soma::PythonReader::Helper) (carto::GenericObject *, const std::string &, PythonReader &) |
Definition at line 53 of file pythonreader.h.
| typedef std::map<std::string, Helper> soma::PythonReader::HelperSet |
Definition at line 56 of file pythonreader.h.
| soma::PythonReader::PythonReader | ( | const std::string & | filename, |
| const carto::SyntaxSet & | rules = carto::SyntaxSet(), | ||
| const HelperSet & | helpers = HelperSet() ) |
References helpers().
Referenced by dictHelper(), genericDictHelper(), genericSequenceHelper(), and propertySetHelper().
| soma::PythonReader::PythonReader | ( | const carto::SyntaxSet & | rules = carto::SyntaxSet(), |
| const HelperSet & | helpers = HelperSet() ) |
References helpers().
| soma::PythonReader::PythonReader | ( | carto::rc_ptr< DataSource > | ds, |
| const carto::SyntaxSet & | rules = carto::SyntaxSet(), | ||
| const HelperSet & | helpers = HelperSet() ) |
PythonReader takes ownership of the DataSource.
References helpers().
|
virtual |
| void soma::PythonReader::attach | ( | carto::rc_ptr< DataSource > | ds | ) |
| void soma::PythonReader::attach | ( | const std::string & | filename | ) |
| void soma::PythonReader::attach | ( | std::istream & | s, |
| int | line_num = 1 ) |
attach to an existing istream
| void soma::PythonReader::close | ( | ) |
| carto::rc_ptr< DataSource > soma::PythonReader::dataSource | ( | ) |
Referenced by genericDictHelper(), and genericSequenceHelper().
|
static |
utility function, dictionary helper (can be useful in more specialized readers)
References PythonReader().
| bool soma::PythonReader::eof | ( | ) | const |
have we hit EOF?
Referenced by genericDictHelper(), and genericSequenceHelper().
|
static |
Definition at line 321 of file pythonreader_d.h.
References dataSource(), soma::DataSource::eof(), eof(), genericDictHelper(), soma::DataSource::getch(), carto::io_error::launchErrnoExcept(), PythonReader(), readDictionary2(), skipWhile(), and soma::DataSource::url().
Referenced by genericDictHelper(), and propertySetHelper().
|
static |
Definition at line 241 of file pythonreader_d.h.
References dataSource(), soma::DataSource::eof(), eof(), genericSequenceHelper(), soma::DataSource::getch(), carto::ValueObject< typename T >::getValue(), soma::DataSource::isOpen(), carto::io_error::launchErrnoExcept(), lineString(), name(), PythonReader(), skipWhile(), soma::DataSource::ungetch(), and soma::DataSource::url().
Referenced by genericSequenceHelper(), and propertySetHelper().
| HelperSet & soma::PythonReader::helpers | ( | ) |
| const HelperSet & soma::PythonReader::helpers | ( | ) | const |
helper functions read basic data type
Referenced by init(), PythonReader(), PythonReader(), and PythonReader().
| bool soma::PythonReader::is_open | ( | ) | const |
is the stream open?
| int soma::PythonReader::line | ( | ) | const |
| std::string soma::PythonReader::lineString | ( | ) | const |
Referenced by genericSequenceHelper().
|
virtual |
file name
Referenced by genericSequenceHelper().
| void soma::PythonReader::open | ( | const std::string & | filename | ) |
| bool soma::PythonReader::operator! | ( | ) | const |
status of the stream
|
static |
References genericDictHelper(), genericSequenceHelper(), and PythonReader().
|
virtual |
|
virtual |
attempts to read an already allocated object, if file data matches the object type.
It currently only works for dictionaries
| carto::GenericObject * soma::PythonReader::read | ( | carto::GenericObject * | parent, |
| const std::string & | semantic ) |
|
virtual |
| void soma::PythonReader::readDictionary | ( | carto::GenericObject & | obj | ) |
reads an already allocated dictionary: just fills it (doesn't clear it)
| void soma::PythonReader::readDictionary2 | ( | carto::GenericObject & | obj | ) |
reads the remaining attributes of a string dictionary
Referenced by genericDictHelper().
| void soma::PythonReader::readIntDictionary2 | ( | carto::TypedObject< carto::IntDictionary > & | obj | ) |
reads the remaining attributes of an int dictionary
| std::string soma::PythonReader::readString | ( | char | separator, |
| unsigned & | charsread ) |
| bool soma::PythonReader::readSyntax | ( | std::string & | syntax | ) |
attempts to read the syntax and general type of next element and fills syntax and type accordingly.
type will be "dictionary" or "list".
| std::string soma::PythonReader::readUntil | ( | const std::string & | s | ) |
read characters not in s
| s | continue while characters outside s |
| std::string soma::PythonReader::readVariableName | ( | ) |
| std::string soma::PythonReader::readWhile | ( | const std::string & | s | ) |
read characters in s
| s | continue while characters in s |
| void soma::PythonReader::skipUntil | ( | const std::string & | s | ) |
skip characters not in s
| s | continue while characters outside s |
| unsigned soma::PythonReader::skipWhile | ( | const std::string & | s | ) |
skip characters in s
| s | continue while characters in s |
Referenced by genericDictHelper(), and genericSequenceHelper().
| carto::SyntaxSet & soma::PythonReader::syntaxes | ( | ) |
| const carto::SyntaxSet & soma::PythonReader::syntaxes | ( | ) | const |