Skip to content

Commit

Permalink
Assert in unused write-only rapidjson::Stream methods
Browse files Browse the repository at this point in the history
Resolves the issue #88.
  • Loading branch information
sapek committed Oct 12, 2015
1 parent 38a92c6 commit ef83b48
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions cpp/inc/bond/protocol/detail/rapidjson_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ class RapidJsonInputStream
count(that.count)
{}

char Peek()
char Peek()
{
return current;
}

size_t Tell() const
size_t Tell() const
{
return count;
}

char Take()
char Take()
{
char c = current;

Expand All @@ -72,8 +72,8 @@ class RapidJsonInputStream

// not implemented for read only stream
char* PutBegin() { BOOST_ASSERT(false); return 0; }
void Put(char) { BOOST_ASSERT(false); }
size_t PutEnd(char*) { BOOST_ASSERT(false); return 0; }
void Put(char) { BOOST_ASSERT(false); }
size_t PutEnd(char*) { BOOST_ASSERT(false); return 0; }

RapidJsonInputStream& operator=(const RapidJsonInputStream& that)
{
Expand All @@ -86,9 +86,9 @@ class RapidJsonInputStream
}

private:
Buffer* input;
uint8_t current;
size_t count;
Buffer* input;
uint8_t current;
size_t count;
};


Expand All @@ -106,24 +106,16 @@ class RapidJsonOutputStream
char Peek() { BOOST_ASSERT(false); return 0; }
size_t Tell() const { BOOST_ASSERT(false); return 0; }
char Take() { BOOST_ASSERT(false); return 0; }
size_t PutEnd(char* begin) { BOOST_ASSERT(false); return 0; }
char* PutBegin() { BOOST_ASSERT(false); return 0; }

char* PutBegin()
{
return 0;
}

void Put(char c)
void Put(char c)
{
output.Write(c);
}

size_t PutEnd(char* begin)
{
BOOST_ASSERT(begin == 0);
}

private:
Buffer& output;
Buffer& output;
};


Expand Down

0 comments on commit ef83b48

Please sign in to comment.