forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from uilianries/reflectcpp-0.14.0
CCI PR 24857 Suggestions for Review
- Loading branch information
Showing
4 changed files
with
61 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package LANGUAGES CXX) | ||
|
||
find_package(reflectcpp REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE reflectcpp::reflectcpp) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) | ||
|
||
if(CONAN_TEST_WITH_MSGPACK) | ||
target_compile_definitions(${PROJECT_NAME} PRIVATE CONAN_TEST_WITH_MSGPACK) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,16 @@ | ||
#include <cstdlib> | ||
#include <iostream> | ||
#include <rfl.hpp> | ||
#include <string> | ||
|
||
#if defined(CONAN_TEST_WITH_MSGPACK) | ||
#include <rfl/msgpack.hpp> | ||
#endif | ||
#include "rfl.hpp" | ||
#include "rfl/Generic.hpp" | ||
#include "rfl/json.hpp" | ||
|
||
struct TestStruct { | ||
int x; | ||
std::string name; | ||
}; | ||
|
||
int main(void) { | ||
for (const auto& f : rfl::fields<TestStruct>()) { | ||
(void)f.name(); | ||
(void)f.type(); | ||
} | ||
|
||
#if defined(CONAN_TEST_WITH_MSGPACK) | ||
const auto test = TestStruct{.x = 15, .name = "test_package"}; | ||
std::cout << "msgpack test: "; | ||
rfl::msgpack::write(test, std::cout) << std::endl; | ||
#endif | ||
|
||
std::cout << "reflectcpp test successful\n"; | ||
|
||
return 0; | ||
auto person = rfl::Generic::Object(); | ||
person["first_name"] = "John"; | ||
person["last_name"] = "Doe"; | ||
rfl::json::write(person, std::cout) << std::endl; | ||
return EXIT_SUCCESS; | ||
} |