MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / Bar

Class Bar

examples/src/json_traits_macros_examples.cpp:21–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 };
20
21 class Bar : public Foo
22 {
23 static const bool bar = true;
24 JSONCONS_TYPE_TRAITS_FRIEND
25 };
26
27 class Baz : public Foo
28 {
29 static const bool baz = true;
30 JSONCONS_TYPE_TRAITS_FRIEND
31 };
32
33 enum class BookCategory {fiction,biography};
34
35 inline
36 std::ostream& operator<<(std::ostream& os, const BookCategory& category)
37 {
38 switch (category)
39 {
40 case BookCategory::fiction: os << "fiction, "; break;
41 case BookCategory::biography: os << "biography, "; break;
42 }
43 return os;
44 }
45
46 // #1 Class with public member data and default constructor
47 struct Book1
48 {
49 BookCategory category;
50 std::string author;
51 std::string title;
52 double price{0};
53 };
54
55 // #2 Class with private member data and default constructor
56 class Book2
57 {
58 BookCategory category;
59 std::string author;
60 std::string title;
61 double price{0};
62
63 JSONCONS_TYPE_TRAITS_FRIEND
64 public:
65 Book2() = default;
66
67 BookCategory get_category() const {return category;}
68
69 const std::string& get_author() const {return author;}
70
71 const std::string& get_title() const{return title;}
72
73 double get_price() const{return price;}
74 };
75
76 // #3 Class with getters and initializing constructor
77 class Book3
78 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected