Electroneum
ParseObjectHandler Struct Reference
Inheritance diagram for ParseObjectHandler:
Collaboration diagram for ParseObjectHandler:

Public Member Functions

 ParseObjectHandler ()
 
bool Default ()
 
bool Null ()
 
bool Bool (bool b)
 
bool Int (int i)
 
bool Uint (unsigned i)
 
bool Double (double d)
 
bool String (const char *str, size_t, bool)
 
bool StartObject ()
 
bool EndObject (SizeType memberCount)
 
bool StartArray ()
 
bool EndArray (SizeType elementCount)
 
- Public Member Functions inherited from BaseReaderHandler< UTF8<>, ParseObjectHandler >
bool Default ()
 
bool Null ()
 
bool Bool (bool)
 
bool Int (int)
 
bool Uint (unsigned)
 
bool Int64 (int64_t)
 
bool Uint64 (uint64_t)
 
bool Double (double)
 
bool RawNumber (const Ch *str, SizeType len, bool copy)
 enabled via kParseNumbersAsStringsFlag, string is not null-terminated (use length) More...
 
bool String (const Ch *, SizeType, bool)
 
bool StartObject ()
 
bool Key (const Ch *str, SizeType len, bool copy)
 
bool EndObject (SizeType)
 
bool StartArray ()
 
bool EndArray (SizeType)
 

Public Attributes

unsigned step_
 

Additional Inherited Members

- Public Types inherited from BaseReaderHandler< UTF8<>, ParseObjectHandler >
typedef UTF8<> ::Ch Ch
 
typedef internal::SelectIf< internal::IsSame< ParseObjectHandler, void >, BaseReaderHandler, ParseObjectHandler >::Type Override
 

Detailed Description

Definition at line 1089 of file readertest.cpp.

Constructor & Destructor Documentation

◆ ParseObjectHandler()

ParseObjectHandler::ParseObjectHandler ( )
inline

Definition at line 1090 of file readertest.cpp.

1090 : step_(0) {}

Member Function Documentation

◆ Bool()

bool ParseObjectHandler::Bool ( bool  b)
inline

Definition at line 1094 of file readertest.cpp.

1094  {
1095  switch(step_) {
1096  case 4: EXPECT_TRUE(b); step_++; return true;
1097  case 6: EXPECT_FALSE(b); step_++; return true;
1098  default: ADD_FAILURE(); return false;
1099  }
1100  }
#define ADD_FAILURE()
Definition: gtest.h:1808
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
#define EXPECT_FALSE(condition)
Definition: gtest.h:1862

◆ Default()

bool ParseObjectHandler::Default ( )
inline

Definition at line 1092 of file readertest.cpp.

1092 { ADD_FAILURE(); return false; }
#define ADD_FAILURE()
Definition: gtest.h:1808

◆ Double()

bool ParseObjectHandler::Double ( double  d)
inline

Definition at line 1111 of file readertest.cpp.

1111 { EXPECT_EQ(12u, step_); EXPECT_DOUBLE_EQ(3.1416, d); step_++; return true; }
#define EXPECT_DOUBLE_EQ(val1, val2)
Definition: gtest.h:2031
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922

◆ EndArray()

bool ParseObjectHandler::EndArray ( SizeType  elementCount)
inline

Definition at line 1128 of file readertest.cpp.

1128 { EXPECT_EQ(18u, step_); EXPECT_EQ(3u, elementCount); step_++; return true; }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922

◆ EndObject()

bool ParseObjectHandler::EndObject ( SizeType  memberCount)
inline

Definition at line 1126 of file readertest.cpp.

1126 { EXPECT_EQ(19u, step_); EXPECT_EQ(7u, memberCount); step_++; return true; }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922

◆ Int()

bool ParseObjectHandler::Int ( int  i)
inline

Definition at line 1101 of file readertest.cpp.

1101  {
1102  switch(step_) {
1103  case 10: EXPECT_EQ(123, i); step_++; return true;
1104  case 15: EXPECT_EQ(1, i); step_++; return true;
1105  case 16: EXPECT_EQ(2, i); step_++; return true;
1106  case 17: EXPECT_EQ(3, i); step_++; return true;
1107  default: ADD_FAILURE(); return false;
1108  }
1109  }
#define ADD_FAILURE()
Definition: gtest.h:1808
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922

◆ Null()

bool ParseObjectHandler::Null ( )
inline

Definition at line 1093 of file readertest.cpp.

1093 { EXPECT_EQ(8u, step_); step_++; return true; }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922

◆ StartArray()

bool ParseObjectHandler::StartArray ( )
inline

Definition at line 1127 of file readertest.cpp.

1127 { EXPECT_EQ(14u, step_); step_++; return true; }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922

◆ StartObject()

bool ParseObjectHandler::StartObject ( )
inline

Definition at line 1125 of file readertest.cpp.

1125 { EXPECT_EQ(0u, step_); step_++; return true; }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922

◆ String()

bool ParseObjectHandler::String ( const char *  str,
size_t  ,
bool   
)
inline

Definition at line 1112 of file readertest.cpp.

1112  {
1113  switch(step_) {
1114  case 1: EXPECT_STREQ("hello", str); step_++; return true;
1115  case 2: EXPECT_STREQ("world", str); step_++; return true;
1116  case 3: EXPECT_STREQ("t", str); step_++; return true;
1117  case 5: EXPECT_STREQ("f", str); step_++; return true;
1118  case 7: EXPECT_STREQ("n", str); step_++; return true;
1119  case 9: EXPECT_STREQ("i", str); step_++; return true;
1120  case 11: EXPECT_STREQ("pi", str); step_++; return true;
1121  case 13: EXPECT_STREQ("a", str); step_++; return true;
1122  default: ADD_FAILURE(); return false;
1123  }
1124  }
#define ADD_FAILURE()
Definition: gtest.h:1808
#define EXPECT_STREQ(s1, s2)
Definition: gtest.h:1995

◆ Uint()

bool ParseObjectHandler::Uint ( unsigned  i)
inline

Definition at line 1110 of file readertest.cpp.

1110 { return Int(static_cast<int>(i)); }

Member Data Documentation

◆ step_

unsigned ParseObjectHandler::step_

Definition at line 1130 of file readertest.cpp.


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