Return to Bugs & Features · Post Text · Post File
| ID: | 98 |
| Status: | 5 - New |
| Priority: | 1 - Request for Enhancement, e.g. asking for a feature |
| Scope: | 3 - Applies to all machines and operating systems |
| Subsystem: | Unassigned |
| Summary: | Add capability to load/save with a generic callback |
| Version: | 2.5 |
| Created By: | michael.watkins |
| Assigned To: | Unassigned |
| Fix Version: | Unassigned |
| Update Notification: | |
Trouble Report Files:
Post File
No files
Trouble Report Dialog:
Post Text
michael.watkins 11:25 Jun 08, 2009 | This enhancement would allow a generalized method to be used to load or save XML data with mini XML.
For example, a callback could be specified to new function entry points such as mxmlLoadStream, mxmlSAXLoadStream, mxmlSaveStream, etc.
The callback would consist of a function prototype defined like this:
typedef int (*mxml_read_stream_cb_t)(void *,void *,unsigned int); typedef int (*mxml_write_stream_cb_t)(void *,const void *,unsigned int);
For the read, the first argument would be the context passed through the entry point, the second argument would be the buffer used to store the data or the data to be written, and the third argument would be the number of bytes to read/write.
Thus, mxmlLoadStream would look like this:
extern mxml_node_t *mxmlLoadStream ( mxml_node_t *top, mxml_read_stream_cb_t read_stream_cb,void *read_stream_context, mxml_type_t (*cb)(mxml_node_t *) );
Internally, in mxml-file.c new functions would be needed similar to the file descriptor entry points, where a generalized function is called rather than read/write.
In fact, this generalized method could potentially replace all of the separate getc and putc functions currently used (mxml_fd_getc, mxml_file_getc, etc.). |
|