-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.cpp
More file actions
37 lines (30 loc) · 830 Bytes
/
Copy pathmain.cpp
File metadata and controls
37 lines (30 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include "cppproperties/properties.hpp"
#include "cppproperties/archiver_xml.hpp"
struct shape :
tct::properties::properties
{
MAKE_PROPERTY(locked, bool);
MAKE_PROPERTY(x, int);
MAKE_PROPERTY(y, int);
MAKE_PROPERTY(name, std::string);
};
int main()
{
shape s;
// Set some property values
s.locked = false;
s.x = 24;
s.y = 48;
s.name = "My Shape";
// Print each property manually
std::cout << "locked = " << s.locked << "\n";
std::cout << "x = " << s.x << "\n";
std::cout << "y = " << s.y << "\n";
std::cout << "name = " << s.name << "\n";
std::cout << std::endl;
// Print properties automatically
std::cout << "Properties:\n";
std::cout << s.save(tct::properties::archiver_xml()) << std::endl;
return 0;
}