Skip to content

Commit 8e34434

Browse files
committed
Conversion from cpprestsdk to RapidJSON
1 parent 880e8a7 commit 8e34434

14 files changed

+1085
-633
lines changed

CMakeLists.txt

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,11 @@ find_package(pegtl CONFIG REQUIRED)
1818
target_include_directories(graphqlpeg INTERFACE $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}> $<INSTALL_INTERFACE:include>)
1919
target_link_libraries(graphqlpeg taocpp::pegtl)
2020

21-
find_package(cpprestsdk REQUIRED)
22-
set(CPPRESTSDK cpprestsdk::cpprest)
21+
find_package(RapidJSON CONFIG REQUIRED)
2322

24-
if(UNIX)
25-
find_library(BOOST_SYSTEM boost_system)
26-
list(APPEND CPPRESTSDK ${BOOST_SYSTEM})
27-
endif()
28-
29-
target_include_directories(graphqlservice INTERFACE $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}> $<INSTALL_INTERFACE:include>)
30-
target_link_libraries(graphqlservice ${CPPRESTSDK} graphqlpeg)
31-
target_link_libraries(schemagen ${CPPRESTSDK} graphqlpeg)
23+
target_include_directories(graphqlservice INTERFACE ${RAPIDJSON_INCLUDE_DIRS} $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}> $<INSTALL_INTERFACE:include>)
24+
target_link_libraries(graphqlservice graphqlpeg)
25+
target_link_libraries(schemagen graphqlpeg)
3226

3327
add_custom_command(
3428
OUTPUT IntrospectionSchema.cpp IntrospectionSchema.h
@@ -59,31 +53,27 @@ if(BUILD_TESTS OR UPDATE_SAMPLES)
5953
TodaySchema.cpp
6054
Today.cpp)
6155

62-
target_link_libraries(todaygraphql
63-
${CPPRESTSDK}
64-
graphqlservice)
65-
target_include_directories(todaygraphql SYSTEM PUBLIC ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
56+
target_link_libraries(todaygraphql graphqlservice)
57+
target_include_directories(todaygraphql SYSTEM PUBLIC ${RAPIDJSON_INCLUDE_DIRS} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
6658

6759
add_executable(test_today test_today.cpp)
6860

6961
target_link_libraries(test_today
70-
${CPPRESTSDK}
7162
graphqlpeg
7263
graphqlservice
7364
todaygraphql)
74-
target_include_directories(test_today SYSTEM PUBLIC ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
65+
target_include_directories(test_today SYSTEM PUBLIC ${RAPIDJSON_INCLUDE_DIRS} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
7566

7667
enable_testing()
7768
add_executable(tests tests.cpp)
7869
find_package(GTest REQUIRED)
7970
target_link_libraries(tests
80-
${CPPRESTSDK}
8171
graphqlpeg
8272
graphqlservice
8373
todaygraphql
8474
GTest::GTest
8575
GTest::Main)
86-
target_include_directories(tests SYSTEM PUBLIC ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
76+
target_include_directories(tests SYSTEM PUBLIC ${RAPIDJSON_INCLUDE_DIRS} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
8777
add_test(TodayServiceCase tests)
8878
add_test(ArgumentsCase tests)
8979

GraphQLGrammar.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace facebook {
1212
namespace graphql {
1313
namespace peg {
1414

15-
using namespace tao::pegtl;
15+
using namespace tao::graphqlpeg;
1616

1717
template <typename _Rule>
1818
void for_each_child(const ast_node& n, std::function<bool(const ast_node&)>&& func)
@@ -94,13 +94,13 @@ struct string_escape_sequence
9494
};
9595

9696
struct string_quote_character
97-
: source_character
97+
: plus<seq<not_at<backslash_token>, not_at<quote_token>, not_at<ascii::eol>, source_character>>
9898
{
9999
};
100100

101101
// https://facebook.github.io/graphql/June2018/#StringCharacter
102102
struct string_quote
103-
: if_must<quote_token, star<seq<not_at<quote_token>, not_at<ascii::eol>, sor<string_escape_sequence, string_quote_character>>>, quote_token>
103+
: if_must<quote_token, star<sor<string_escape_sequence, string_quote_character>>, quote_token>
104104
{
105105
};
106106

@@ -110,18 +110,18 @@ struct block_quote_token
110110
};
111111

112112
struct block_escape_sequence
113-
: if_must<backslash_token, block_quote_token>
113+
: seq<backslash_token, block_quote_token>
114114
{
115115
};
116116

117117
struct block_quote_character
118-
: source_character
118+
: plus<seq<not_at<block_quote_token>, not_at<block_escape_sequence>, source_character>>
119119
{
120120
};
121121

122122
// https://facebook.github.io/graphql/June2018/#BlockStringCharacter
123123
struct block_quote
124-
: if_must<block_quote_token, star<seq<not_at<block_quote_token>, sor<block_escape_sequence, block_quote_character>>>, block_quote_token>
124+
: if_must<block_quote_token, star<sor<block_escape_sequence, block_quote_character>>, block_quote_token>
125125
{
126126
};
127127

@@ -804,7 +804,7 @@ struct definition
804804

805805
// https://facebook.github.io/graphql/June2018/#Document
806806
struct document
807-
: must<bof, opt<utf8::bom>, star<ignored>, list<definition, plus<ignored>>, star<ignored>, tao::pegtl::eof>
807+
: must<bof, opt<utf8::bom>, star<ignored>, list<definition, plus<ignored>>, star<ignored>, tao::graphqlpeg::eof>
808808
{
809809
};
810810

0 commit comments

Comments
 (0)