Skip to content

Commit cdd8eed

Browse files
committed
Fixed #1, updated to build full utf_range and removed lib dep on
temp_file as it is header only now
1 parent 5d09c27 commit cdd8eed

6 files changed

Lines changed: 25 additions & 26 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ target_link_libraries( json_to_cpp_lib utf_range utf_string ${Boost_LIBRARIES} $
9090

9191
add_executable( json_to_cpp ${HEADER_FILES} ${SOURCE_FOLDER}/main.cpp )
9292
add_dependencies( json_to_cpp dependency_stub )
93-
target_link_libraries( json_to_cpp json_to_cpp_lib parse_json utf_range temp_file ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CURL_LIBRARIES} )
93+
target_link_libraries( json_to_cpp json_to_cpp_lib parse_json utf_range ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CURL_LIBRARIES} )
9494

9595
#install( TARGETS json_to_cpp DESTINATION lib )
9696
install( TARGETS json_to_cpp DESTINATION bin )

glean.cmake

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
include( ExternalProject )
32
externalproject_add(
43
temp_file_prj
@@ -8,6 +7,14 @@ externalproject_add(
87
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/install -DGLEAN_INSTALL_ROOT=${CMAKE_BINARY_DIR}/install
98
)
109

10+
externalproject_add(
11+
date_prj
12+
GIT_REPOSITORY "https://github.com/beached/date.git"
13+
SOURCE_DIR "${CMAKE_BINARY_DIR}/dependencies/date"
14+
INSTALL_DIR "${CMAKE_BINARY_DIR}/install"
15+
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/install -DGLEAN_INSTALL_ROOT=${CMAKE_BINARY_DIR}/install
16+
)
17+
1118
externalproject_add(
1219
header_libraries_prj
1320
GIT_REPOSITORY "https://github.com/beached/header_libraries.git"
@@ -18,19 +25,11 @@ externalproject_add(
1825

1926
externalproject_add(
2027
utf_range_prj
21-
GIT_REPOSITORY "https://github.com/beached/utf_range.git"
2228
DEPENDS header_libraries_prj
29+
GIT_REPOSITORY "https://github.com/beached/utf_range.git"
2330
SOURCE_DIR "${CMAKE_BINARY_DIR}/dependencies/utf_range"
2431
INSTALL_DIR "${CMAKE_BINARY_DIR}/install"
25-
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/install -DGLEAN_INSTALL_ROOT=${CMAKE_BINARY_DIR}/install
26-
)
27-
28-
externalproject_add(
29-
date_prj
30-
GIT_REPOSITORY "https://github.com/beached/date.git"
31-
SOURCE_DIR "${CMAKE_BINARY_DIR}/dependencies/date"
32-
INSTALL_DIR "${CMAKE_BINARY_DIR}/install"
33-
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/install -DGLEAN_INSTALL_ROOT=${CMAKE_BINARY_DIR}/install -DUSE_SYSTEM_TZ_DB=ON -DENABLE_DATE_TESTING=OFF -DCMAKE_CXX_STANDARD=17
32+
CMAKE_ARGS -DDAW_USE_FULL_LIBRARY=On -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/install -DGLEAN_INSTALL_ROOT=${CMAKE_BINARY_DIR}/install
3433
)
3534

3635
externalproject_add(

glean.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"provides": "utf_range",
1919
"download_type": "git",
2020
"build_type": "cmake",
21-
"uri": "https://github.com/beached/utf_range.git"
21+
"uri": "https://github.com/beached/utf_range.git",
22+
"cmake_args": [ "-DDAW_USE_FULL_LIBRARY=ON" ]
2223
},
2324
{
2425
"provides": "date",

src/curl_t.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ namespace daw::curl {
109109
headers.append( "charsets: utf-8" );
110110

111111
auto curl = curl_t( );
112-
if( !curl ) {
112+
if( not curl ) {
113113
return std::nullopt;
114114
}
115115
curl.setopt( CURLOPT_HTTPHEADER, headers.get( ) );
@@ -151,7 +151,7 @@ namespace daw::curl {
151151
}
152152

153153
bool is_url( daw::string_view path ) {
154-
return boost::starts_with( path.data( ), "http://" ) ||
154+
return boost::starts_with( path.data( ), "http://" ) or
155155
boost::starts_with( path.data( ), "https://" );
156156
}
157157
} // namespace daw::curl

src/json_to_cpp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ namespace daw::json_to_cpp {
245245
std::vector<types::ti_object> &obj_info,
246246
state_t &obj_state, config_t const &config ) {
247247

248-
using ::daw::json::json_value_t;
249-
using namespace ::daw::json_to_cpp::types;
248+
using daw::json::json_value_t;
249+
using namespace daw::json_to_cpp::types;
250250
if( current_item.is_integer( ) ) {
251251
obj_state.has_integrals = true;
252252
return ti_integral( );
@@ -336,7 +336,7 @@ namespace daw::json_to_cpp {
336336
parse_json_object( current_item, config.root_object_name, result,
337337
obj_state, config );
338338
} else {
339-
auto root_obj_member = ::daw::json::make_object_value_item(
339+
auto root_obj_member = daw::json::make_object_value_item(
340340
config.root_object_name.c_str( ), current_item );
341341
auto root_object = json_object_value( );
342342
root_object.members_v.push_back( std::move( root_obj_member ) );
@@ -529,7 +529,7 @@ namespace daw::json_to_cpp {
529529

530530
void generate_cpp( daw::string_view json_string, config_t &config ) {
531531
auto obj_state = state_t( );
532-
auto json_obj = ::daw::json::parse_json( json_string );
532+
auto json_obj = daw::json::parse_json( json_string );
533533
auto obj_info = parse_json_object( json_obj, obj_state, config );
534534
generate_code( obj_info, config, obj_state );
535535
}

src/ti_array.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,22 @@ namespace daw::json_to_cpp::types {
6262
return "std::vector<" + ti_null::name( ) + ">";
6363
}
6464
return "std::vector<" +
65-
::daw::json_to_cpp::types::name( children->front( ).second ) + ">";
65+
daw::json_to_cpp::types::name( children->front( ).second ) + ">";
6666
}
6767

6868
std::string ti_array::json_name( daw::string_view member_name, bool use_cpp20,
6969
daw::string_view parent_name ) const {
7070
if( children->empty( ) ) {
7171
return "json_array<" +
72-
impl::format_member_name( member_name, use_cpp20, parent_name ) +
73-
", " + ti_null::array_member_info( ) +
74-
", " + name( ) + ">";
72+
impl::format_member_name( member_name, use_cpp20, parent_name ) +
73+
", " + ti_null::array_member_info( ) + ", " + name( ) + ">";
7574
}
7675
return "json_array<" +
7776
impl::format_member_name( member_name, use_cpp20, parent_name ) +
78-
", " + daw::json_to_cpp::types::array_member_info(
77+
", " +
78+
daw::json_to_cpp::types::array_member_info(
7979
children->front( ).second ) +
80-
", " + name( ) +
81-
">";
80+
", " + name( ) + ">";
8281
}
8382

8483
std::string ti_array::array_member_info( ) const {

0 commit comments

Comments
 (0)