Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

dt_stream_util.c File Reference

Go to the source code of this file.

Functions

dt_bool dt_stream_transfer (dt_reader *src, dt_writer *dst)
 Reads stream steps from src and sends them to dst until completion or an error occurs.

dt_bool dt_stream_validated_transfer (dt_reader *src, dt_writer *dst)
 Reads stream steps from a reader to a writer while validating the structure of the stream.

dt_nodedt_read_tree_from_file (const char *srcPath)
 Load the textual file at path srcPath into an in-memory data structure.

dt_bool dt_write_tree_to_file (dt_node const *root, const char *dstPath)
 Saved the tree below root to a textual file at path srcPath.


Function Documentation

dt_node* dt_read_tree_from_file const char *  srcPath  ) 
 

Load the textual file at path srcPath into an in-memory data structure.

Returns:
The root of the loaded datatree, or NULL if the operation failed.

Definition at line 53 of file dt_stream_util.c.

dt_bool dt_stream_transfer dt_reader src,
dt_writer dst
 

Reads stream steps from src and sends them to dst until completion or an error occurs.

Returns:
Zero if either src or dst reported an error during the transmission.
A non-zero value if all steps including a final dt_end were transmitted.
See also:
dt_stream_validated_transfer() for a version of this function that can also be used if src might be sending an invalid data sequence (e.g. if the source is parsing an input file.

Definition at line 18 of file dt_stream_util.c.

dt_bool dt_stream_validated_transfer dt_reader src,
dt_writer dst
 

Reads stream steps from a reader to a writer while validating the structure of the stream.

The transfer is interrupted if the reader or writer report an error, or if an inconsistency in the transmitted data structure is detected.

Returns:
Zero if any error was encountered during the transmission.
A non-zero value if all steps including a final dt_end were transmitted.
This function is similar to dt_stream_transfer(), but automatically inserts a validator to protect dst from structural errors in the stream received from src.
This is typically useful when the data source is a file being parsed.

See also:
dt_create_validator_writer -- the validator object which is used by this function.

Definition at line 40 of file dt_stream_util.c.

dt_bool dt_write_tree_to_file dt_node const *  root,
const char *  dstPath
 

Saved the tree below root to a textual file at path srcPath.

Returns:
True if the file was successfully written.

Definition at line 83 of file dt_stream_util.c.


Generated on Sun Jun 1 16:35:38 2003 for datatree by doxygen 1.3.1