|
soma-io
4.7.0
|
#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. More... | |
| virtual | ~PythonReader () |
| virtual carto::GenericObject * | read () |
| virtual void | read (carto::GenericObject &) |
| attemps to read an already allocated object, if file data matches the object type. More... | |
| virtual void | read (carto::Object &) |
| void | readDictionary (carto::GenericObject &obj) |
| reads an already allocated dictionary: just fills it (doesn't clear it) More... | |
| void | readDictionary2 (carto::GenericObject &obj) |
| reads the remaining attributes of a string dictionary More... | |
| void | readIntDictionary2 (carto::TypedObject< carto::IntDictionary > &obj) |
| reads the remaining attributes of an int dictionary More... | |
| 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 More... | |
| 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 More... | |
| int | line () const |
| std::string | lineString () const |
| bool | operator! () const |
| status of the stream More... | |
| bool | is_open () const |
| is the stream open? More... | |
| bool | eof () const |
| have we hit EOF? More... | |
| const HelperSet & | helpers () const |
| helper functions read basic data type More... | |
| HelperSet & | helpers () |
| const carto::SyntaxSet & | syntaxes () const |
| carto::SyntaxSet & | syntaxes () |
| std::string | readUntil (const std::string &s) |
| read characters not in s More... | |
| void | skipUntil (const std::string &s) |
| skip characters not in s More... | |
| std::string | readWhile (const std::string &s) |
| read characters in s More... | |
| unsigned | skipWhile (const std::string &s) |
| skip characters in s More... | |
| 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. More... | |
| 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) More... | |
| 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() |
||
| ) |
| soma::PythonReader::PythonReader | ( | const carto::SyntaxSet & | rules = carto::SyntaxSet(), |
| const HelperSet & | helpers = HelperSet() |
||
| ) |
| soma::PythonReader::PythonReader | ( | carto::rc_ptr< DataSource > | ds, |
| const carto::SyntaxSet & | rules = carto::SyntaxSet(), |
||
| const HelperSet & | helpers = HelperSet() |
||
| ) |
PythonReader takes ownership of the DataSource.
|
virtual |
| void soma::PythonReader::attach | ( | std::istream & | s, |
| int | line_num = 1 |
||
| ) |
attach to an existing istream
| void soma::PythonReader::attach | ( | carto::rc_ptr< DataSource > | ds | ) |
| void soma::PythonReader::attach | ( | const std::string & | filename | ) |
| 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)
| 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(), soma::DataSource::getch(), carto::io_error::launchErrnoExcept(), readDictionary2(), skipWhile(), and soma::DataSource::url().
|
static |
Definition at line 241 of file pythonreader_d.h.
References dataSource(), soma::DataSource::eof(), eof(), soma::DataSource::getch(), carto::ValueObject< T >::getValue(), soma::DataSource::isOpen(), carto::io_error::launchErrnoExcept(), lineString(), name(), skipWhile(), soma::DataSource::ungetch(), and soma::DataSource::url().
| const HelperSet& soma::PythonReader::helpers | ( | ) | const |
helper functions read basic data type
| HelperSet& soma::PythonReader::helpers | ( | ) |
|
protected |
| 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 |
|
virtual |
|
virtual |
attemps to read an already allocated object, if file data matches the object type.
It currently only works for dictionaries
|
virtual |
| carto::GenericObject* soma::PythonReader::read | ( | carto::GenericObject * | parent, |
| const std::string & | semantic | ||
| ) |
| 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().
| const carto::SyntaxSet& soma::PythonReader::syntaxes | ( | ) | const |
| carto::SyntaxSet& soma::PythonReader::syntaxes | ( | ) |