Skip to content

Commit

Permalink
Merge pull request #300 from miloyip/RemoveFileStream
Browse files Browse the repository at this point in the history
Remove deprecated FileStream
  • Loading branch information
miloyip committed Apr 14, 2015
2 parents 2d07198 + 9dcc1f4 commit 94c0082
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 104 deletions.
7 changes: 4 additions & 3 deletions example/serialize/serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// This example shows writing JSON string with writer directly.

#include "rapidjson/prettywriter.h" // for stringify JSON
#include "rapidjson/filestream.h" // wrapper of C stream for prettywriter as output
#include <cstdio>
#include <string>
#include <vector>
Expand Down Expand Up @@ -144,13 +143,15 @@ int main(int, char*[]) {

employees.push_back(Employee("Percy TSE", 30, false));

FileStream s(stdout);
PrettyWriter<FileStream> writer(s); // Can also use Writer for condensed formatting
StringBuffer sb;
PrettyWriter<StringBuffer> writer(sb);

writer.StartArray();
for (std::vector<Employee>::const_iterator employeeItr = employees.begin(); employeeItr != employees.end(); ++employeeItr)
employeeItr->Serialize(writer);
writer.EndArray();

puts(sb.GetString());

return 0;
}
6 changes: 3 additions & 3 deletions example/tutorial/tutorial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "rapidjson/document.h" // rapidjson's DOM-style API
#include "rapidjson/prettywriter.h" // for stringify JSON
#include "rapidjson/filestream.h" // wrapper of C stream for prettywriter as output
#include <cstdio>

using namespace rapidjson;
Expand Down Expand Up @@ -143,9 +142,10 @@ int main(int, char*[]) {
// 4. Stringify JSON

printf("\nModified JSON with reformatting:\n");
FileStream f(stdout);
PrettyWriter<FileStream> writer(f);
StringBuffer sb;
PrettyWriter<StringBuffer> writer(sb);
document.Accept(writer); // Accept() traverses the DOM and generates Handler events.
puts(sb.GetString());

return 0;
}
67 changes: 0 additions & 67 deletions include/rapidjson/filestream.h

This file was deleted.

12 changes: 0 additions & 12 deletions test/perftest/rapidjsontest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "rapidjson/document.h"
#include "rapidjson/prettywriter.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/filestream.h"
#include "rapidjson/filereadstream.h"
#include "rapidjson/encodedstream.h"
#include "rapidjson/memorystream.h"
Expand Down Expand Up @@ -324,17 +323,6 @@ TEST_F(RapidJson, UTF8_Validate) {
}
}

// Deprecated.
//TEST_F(RapidJson, FileStream_Read) {
// for (size_t i = 0; i < kTrialCount; i++) {
// FILE *fp = fopen(filename_, "rb");
// FileStream s(fp);
// while (s.Take() != '\0')
// ;
// fclose(fp);
// }
//}

TEST_F(RapidJson, FileReadStream) {
for (size_t i = 0; i < kTrialCount; i++) {
FILE *fp = fopen(filename_, "rb");
Expand Down
19 changes: 0 additions & 19 deletions test/unittest/filestreamtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
// THE SOFTWARE.

#include "unittest.h"
#include "rapidjson/filestream.h"
#include "rapidjson/filereadstream.h"
#include "rapidjson/filewritestream.h"
#include "rapidjson/encodedstream.h"
Expand Down Expand Up @@ -60,24 +59,6 @@ class FileStreamTest : public ::testing::Test {
size_t length_;
};

// Deprecated
//TEST_F(FileStreamTest, FileStream_Read) {
// FILE *fp = fopen(filename_, "rb");
// ASSERT_TRUE(fp != 0);
// FileStream s(fp);
//
// for (size_t i = 0; i < length_; i++) {
// EXPECT_EQ(json_[i], s.Peek());
// EXPECT_EQ(json_[i], s.Peek()); // 2nd time should be the same
// EXPECT_EQ(json_[i], s.Take());
// }
//
// EXPECT_EQ(length_, s.Tell());
// EXPECT_EQ('\0', s.Peek());
//
// fclose(fp);
//}

TEST_F(FileStreamTest, FileReadStream) {
FILE *fp = fopen(filename_, "rb");
ASSERT_TRUE(fp != 0);
Expand Down

0 comments on commit 94c0082

Please sign in to comment.