Package rosetta :: Package basic :: Module _basic_ :: Class Emitter
[hide private]
[frames] | no frames]

Class Emitter

 object --+    
          |    
??.instance --+
              |
             Emitter
Known Subclasses:

Lightweight class to ease writting YAML documents (http://yaml.org)
YAML is a structured data format, a more human-readable
 alternative to XML.
 I use the terms "map" and "list" here, but you may also see "mapping" and "sequence".
 The former is a series of key : value pairs, while the latter is a simple series of items.
 This class is not entirely able to enforce the generation of valid YAML --
 you can still e.g. write a key : value pair in the middle of a list.
 It will print a warning message but will otherwise try to continue on.
 YAML documents have optional explicit start/end markers; if the emitter
 supports them, they will be auto-generated when the class is initialized
 and when you're finished and you call end().
 Whitespace is YAML documents is semi-significant.  By default, this class
 will try to pretty-print, showing the depth of nesting through indentation.
 When starting a new list or map, you can request that it not be indented
 (i.e., be printed all on one line), but all lists and maps nested inside it
 will also be printed without linebreaks, regardless of the requested indentation.
 YAML refers to these two styles as "block" and "flow", respectively.

Instance Methods [hide private]
 
__init__(...)
Raises an exception This class cannot be instantiated from Python
 
__reduce__(...)
helper for pickle
 
depth(...)
depth( (Emitter)arg1) -> int : Number of closing brackets/braces required to end document (non-negative)
 
end(...)
end( (Emitter)arg1 [, (int)desired_depth=0]) -> None : By default, closes all open maps/lists, ending the document.
 
end_list(...)
end_list( (Emitter)arg1) -> None : Counterpart to start_list() -- writes closing bracket.
 
end_map(...)
end_map( (Emitter)arg1) -> None : Counterpart to start_map() -- writes closing brace.
 
flush(...)
flush( (Emitter)arg1) -> None : Flush the underlying output stream.
 
set_indent(...)
set_indent( (Emitter)arg1, (int)num_spaces) -> None : Number of spaces used for indenting.
 
start_doc(...)
start_doc( (Emitter)arg1) -> None : Start a new document, ending the previous one first if necessary.
 
start_list(...)
start_list( (Emitter)arg1 [, (bool)indent=True]) -> None : Write method for use inside lists / arrays
 
start_map(...)
start_map( (Emitter)arg1 [, (bool)indent=True]) -> None : Write method for use inside lists / arrays

Inherited from unreachable.instance: __new__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(...)
(Constructor)

 

Raises an exception This class cannot be instantiated from Python

Overrides: object.__init__

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

depth(...)

 

depth( (Emitter)arg1) -> int :
    Number of closing brackets/braces required to end document (non-negative)
    

    C++ signature :
        int depth(basic::Emitter {lvalue})

end(...)

 

end( (Emitter)arg1 [, (int)desired_depth=0]) -> None :
    By default, closes all open maps/lists, ending the document.
    

    C++ signature :
        void end(basic::Emitter {lvalue} [,unsigned long=0])

end_list(...)

 

end_list( (Emitter)arg1) -> None :
    Counterpart to start_list() -- writes closing bracket.
    

    C++ signature :
        void end_list(basic::Emitter {lvalue})

end_map(...)

 

end_map( (Emitter)arg1) -> None :
    Counterpart to start_map() -- writes closing brace.
    

    C++ signature :
        void end_map(basic::Emitter {lvalue})

flush(...)

 

flush( (Emitter)arg1) -> None :
    Flush the underlying output stream.
    

    C++ signature :
        void flush(basic::Emitter {lvalue})

set_indent(...)

 

set_indent( (Emitter)arg1, (int)num_spaces) -> None :
    Number of spaces used for indenting.  Default is one.
    

    C++ signature :
        void set_indent(basic::Emitter {lvalue},int)

start_doc(...)

 

start_doc( (Emitter)arg1) -> None :
    Start a new document, ending the previous one first if necessary.
    A no-op for some types of output (e.g. JSON) that don't allow multiple documents.
    

    C++ signature :
        void start_doc(basic::Emitter {lvalue})

start_doc( (Emitter)arg1) -> None :

    C++ signature :
        void start_doc(boost::shared_ptr<basic::Emitter> {lvalue})

start_list(...)

 

start_list( (Emitter)arg1 [, (bool)indent=True]) -> None :
    Write method for use inside lists / arrays
    

    C++ signature :
        void start_list(basic::Emitter {lvalue} [,bool=True])

start_list( (Emitter)arg1, (str)label [, (bool)indent=True]) -> None :
    Write method for use inside maps / dicts / objects
    

    C++ signature :
        void start_list(basic::Emitter {lvalue},std::string [,bool=True])

start_list( (Emitter)arg1, (str)label [, (bool)indent=True]) -> None :
    Write method for use inside maps / dicts / objects
    

    C++ signature :
        void start_list(basic::Emitter {lvalue},char const* [,bool=True])

start_map(...)

 

start_map( (Emitter)arg1 [, (bool)indent=True]) -> None :
    Write method for use inside lists / arrays
    

    C++ signature :
        void start_map(basic::Emitter {lvalue} [,bool=True])

start_map( (Emitter)arg1, (str)label [, (bool)indent=True]) -> None :
    Write method for use inside maps / dicts / objects
    

    C++ signature :
        void start_map(basic::Emitter {lvalue},std::string [,bool=True])

start_map( (Emitter)arg1, (str)label [, (bool)indent=True]) -> None :
    Write method for use inside maps / dicts / objects
    

    C++ signature :
        void start_map(basic::Emitter {lvalue},char const* [,bool=True])