Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
P6R::p6IJSONReader Interface Referenceabstract

#include <p6jsonreader.h>

Inherits P6R::p6ICom.

Public Member Functions

virtual P6INT32 addref (void)=0
 
virtual P6R::P6ERR getContentHandler (p6IJSONContentHandler **pObject)=0
 
virtual P6R::P6ERR getErrorHandler (p6IJSONErrorHandler **pObject)=0
 
virtual P6R::P6ERR initialize (P6JSONFLAGS flags, P6UINT32 streamBufSize)=0
 
virtual P6R::P6ERR queryInterface (const P6R::P6IID &iid, P6VOID **ppIface)=0
 
virtual P6INT32 release (void)=0
 
virtual P6R::P6ERR releaseAllHandlers (void)=0
 
virtual P6R::P6ERR setContentHandler (p6IJSONContentHandler *pObject)=0
 
virtual P6R::P6ERR setErrorHandler (p6IJSONErrorHandler *pObject)=0
 

Detailed Description

This is the main JSON interface.

Notice that there is no separate parse function. That is because this component implements the P6R::p6IDataStream interface (see p6datastream.h). Thus this component supports the parsing of a stream of JSON data.

To parse either a single buffer or a stream of JSON buffers perform the following steps:

* First get an JSON reader object:
* p6IJSONReader *pReader;
* P6ERR err = p6CreateInstance( NULL, CID_p6JSONReader, VALIDATEIF( p6IJSONReader, &pReader ));
*
* Then using the JSON reader, get the p6IDataStream interface on that component:
* p6IDataStream *pStream
* err = pReader->queryInterface( VALIDATEIF( p6IDataStream, &pStream ));
*
* Initialize the data stream interface:
* err = pStream->beginStream();
*
* Pass the buffer(s) to be parsed one at a time:
* err = pStream->processStream( buffer, bufSize ); // -> 1st buffer of stream
* . . . . . .
* err = pStream->processStream( buffer, bufSize ); // -> nth buffer of stream
*

The input 'buffer' to the processStream() method is where the P6JSONSTRING pointers will often point to. The processStream() function can return an "eEndOfFile" error code to indicate that it is done with the buffer provided and that the buffer is incomplete (i.e., the JSON top most object has not yet been closed).

Close the stream down: err = pStream->endStream(); pStream->release();

Definition at line 76 of file p6jsonreader.h.


The documentation for this interface was generated from the following file: