Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/miloyip/rapidjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormiloyip@gmail.com <miloyip@gmail.com@c5894555-1306-4e8d-425f-1f6f381ee07c>2011-11-21 14:00:33 +0400
committermiloyip@gmail.com <miloyip@gmail.com@c5894555-1306-4e8d-425f-1f6f381ee07c>2011-11-21 14:00:33 +0400
commit04515a639e48d46d7abbd45b2cf6462ea681ac62 (patch)
treee1e6bd00155f8cabf2757bd4331a7b32a2eb9439 /example
parentbce34fbea8400a54356d71e200e67593033cfd39 (diff)
Implemented FileWriteStream with buffering
git-svn-id: https://rapidjson.googlecode.com/svn/trunk@23 c5894555-1306-4e8d-425f-1f6f381ee07c
Diffstat (limited to 'example')
-rw-r--r--example/condense/condense.cpp11
-rw-r--r--example/pretty/pretty.cpp11
2 files changed, 14 insertions, 8 deletions
diff --git a/example/condense/condense.cpp b/example/condense/condense.cpp
index 262dbd73..22c882ed 100644
--- a/example/condense/condense.cpp
+++ b/example/condense/condense.cpp
@@ -5,18 +5,21 @@
#include "rapidjson/reader.h"
#include "rapidjson/writer.h"
-#include "rapidjson/filestream.h"
+#include "rapidjson/filereadstream.h"
+#include "rapidjson/filewritestream.h"
using namespace rapidjson;
int main(int argc, char* argv[]) {
// Prepare JSON reader and input stream.
Reader reader;
- FileStream is(stdin);
+ char readBuffer[65536];
+ FileReadStream is(stdin, readBuffer, sizeof(readBuffer));
// Prepare JSON writer and output stream.
- FileStream os(stdout);
- Writer<FileStream> writer(os);
+ char writeBuffer[65536];
+ FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
+ Writer<FileWriteStream> writer(os);
// JSON reader parse from the input stream and let writer generate the output.
if (!reader.Parse<0>(is, writer)) {
diff --git a/example/pretty/pretty.cpp b/example/pretty/pretty.cpp
index f34db433..dae41b46 100644
--- a/example/pretty/pretty.cpp
+++ b/example/pretty/pretty.cpp
@@ -2,18 +2,21 @@
#include "rapidjson/reader.h"
#include "rapidjson/prettywriter.h"
-#include "rapidjson/filestream.h"
+#include "rapidjson/filereadstream.h"
+#include "rapidjson/filewritestream.h"
using namespace rapidjson;
int main(int argc, char* argv[]) {
// Prepare reader and input stream.
Reader reader;
- FileStream is(stdin);
+ char readBuffer[65536];
+ FileReadStream is(stdin, readBuffer, sizeof(readBuffer));
// Prepare writer and output stream.
- FileStream os(stdout);
- PrettyWriter<FileStream> writer(os);
+ char writeBuffer[65536];
+ FileWriteStream os(stdout, writeBuffer, sizeof(writeBuffer));
+ PrettyWriter<FileWriteStream> writer(os);
// JSON reader parse from the input stream and let writer generate the output.
if (!reader.Parse<0>(is, writer)) {