mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-06 18:56:19 +08:00
Co-authored-by: Patrick Urbanke <patrick@getml.com>
This commit is contained in:
co-authored by
Patrick Urbanke
parent
32a345d368
commit
15f2c632dd
@@ -0,0 +1,40 @@
|
||||
#include <iostream>
|
||||
#include <rfl.hpp>
|
||||
#include <rfl/json.hpp>
|
||||
#include <source_location>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "write_and_read.hpp"
|
||||
|
||||
namespace test_xml_content2 {
|
||||
|
||||
struct Person {
|
||||
std::string xml_content;
|
||||
rfl::Attribute<std::string> town = "Springfield";
|
||||
rfl::Attribute<rfl::Timestamp<"%Y-%m-%d">> birthday;
|
||||
rfl::Attribute<rfl::Email> email;
|
||||
std::vector<Person> child;
|
||||
};
|
||||
|
||||
TEST(xml, test_xml_content2) {
|
||||
const auto bart = Person{.xml_content = "Bart Simpson",
|
||||
.birthday = "1987-04-19",
|
||||
.email = "bart@simpson.com"};
|
||||
|
||||
const auto lisa = Person{.xml_content = "Lisa Simpson",
|
||||
.birthday = "1987-04-19",
|
||||
.email = "lisa@simpson.com"};
|
||||
|
||||
const auto maggie = Person{.xml_content = "Maggie Simpson",
|
||||
.birthday = "1987-04-19",
|
||||
.email = "maggie@simpson.com"};
|
||||
|
||||
const auto homer = Person{.xml_content = "Homer Simpson",
|
||||
.birthday = "1987-04-19",
|
||||
.email = "homer@simpson.com",
|
||||
.child = std::vector<Person>({bart, lisa, maggie})};
|
||||
|
||||
write_and_read<"", rfl::SnakeCaseToCamelCase>(homer);
|
||||
}
|
||||
} // namespace test_xml_content2
|
||||
Reference in New Issue
Block a user