blob: aee7e0ccbf16b71778677163f4aef75686d5eda3 (
plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// file : examples/persistence/position.hxx
// copyright : not copyrighted - public domain
#ifndef POSITION_HXX
#define POSITION_HXX
#include <string>
#include <vector>
#include <iosfwd>
#include <libstudxml/forward.hxx> // xml::{parser,serializer} forward declarations.
enum object_type {building, mountain};
// XML parser and serializer will use these operators to convert
// object_type to/from a string representation unless we provide
// an xml::value_traits specialization.
//
std::ostream&
operator<< (std::ostream&, object_type);
std::istream&
operator>> (std::istream&, object_type&);
class position
{
public:
// Constructors as well as accessor and modifiers not shown.
// XML persistence.
//
public:
position (xml::parser&);
void
serialize (xml::serializer&) const;
private:
float lat_;
float lon_;
};
class object
{
public:
typedef std::vector<position> positions_type;
// Constructors as well as accessor and modifiers not shown.
// XML persistence.
//
public:
object (xml::parser&);
void
serialize (xml::serializer&) const;
private:
std::string name_;
object_type type_;
unsigned int id_;
positions_type positions_;
};
#endif // POSITION_HXX
|