#include "cconsolestream.h"
#include "ccontenthandler.h"
#include "cerrorhandler.h"
using namespace P6R;
using namespace P6EXAMPLES;
namespace {
{
if(
P6SUCCEEDED(err = cpJSON->initialize(P6JSON_NOFLAGS,0))) {
}
}
return err;
}
{
if (
P6SUCCEEDED( err = cpInit->initialize( pConsole, pStr ))) {
}
}
return err;
}
{
if (
P6SUCCEEDED( err = cpInit->initialize( pConsole ))) {
}
}
return err;
}
{
"{\"menu\": {\n" \
" \"id\": \"file\",\n" \
" \"value\": \"File\",\n" \
" \"popup\": {\n" \
" \"menuitem\": [\n" \
" {\"value\": \"New\", \"onclick\": \"CreateNewDoc()\"],\n" \
" {\"value\": \"Open\", \"onclick\": \"OpenDoc()\"},\n" \
" {\"value\": \"Close\", \"onclick\": \"CloseDoc()\"}\n" \
" ]\n" \
" },\n" \
" \"readings\":[ -30, 44, 100.34, 3.5E4, 3.5e-4, true ]\n" \
"}}";
if(
P6FAILED(err = getContentHandler(pConsole, cpStr, cpContent.
addressof())))
return err;
err = cpReader->setContentHandler( cpContent );
err = cpReader->setErrorHandler( cpError );
err = cpStr->strlen( pJSON, 100000, &bufSize );
err = cpStream->endStream();
pConsole->
writeStdout(
"ERROR: Example failed with [ %1$ ]\n", &args[0], 1, NULL );
}
return err;
}
}
int main(int argc,char *argv[])
{
err = runJSON( cpConsole, cpDebugStream );
cpConsole->writeStdout("runDOM result: [ %1$ ]\n",&args[0],1,NULL);
cpConsole = NULL;
}
else printf("ERROR: Failed to retrieve console interface [ %x ]\n", err );
}
else printf("ERROR: Failed to initialize the loader [ %x ]\n", err );
}
else printf( "ERROR: Failed to create CConsoleStream [ %x ]\n", err );
return err;
}