OpenTREP Logo  0.07.18
C++ Open Travel Request Parsing Library
Loading...
Searching...
No Matches
PlaceHolder.cpp
Go to the documentation of this file.
1// //////////////////////////////////////////////////////////////////////
2// Import section
3// //////////////////////////////////////////////////////////////////////
4// C
5#include <cassert>
6#include <sstream>
7// OpenTREP
11
12namespace OPENTREP {
13
14 // //////////////////////////////////////////////////////////////////////
15 PlaceHolder::PlaceHolder () {
16 init();
17 }
18
19 // //////////////////////////////////////////////////////////////////////
20 PlaceHolder::~PlaceHolder () {
21 }
22
23 // //////////////////////////////////////////////////////////////////////
24 void PlaceHolder::init () {
25 _placeList.clear();
26 _placeOrderedList.clear();
27 }
28
29 // //////////////////////////////////////////////////////////////////////
30 std::string PlaceHolder::describeShortKey() const {
31 std::ostringstream oStr;
32 return oStr.str();
33 }
34
35 // //////////////////////////////////////////////////////////////////////
36 std::string PlaceHolder::describeKey() const {
37 return describeShortKey();
38 }
39
40 // //////////////////////////////////////////////////////////////////////
41 std::string PlaceHolder::toString() const {
42 std::ostringstream oStr;
43 oStr << describeShortKey() << std::endl;
44
45 for (PlaceOrderedList_T::const_iterator itPlace = _placeOrderedList.begin();
46 itPlace != _placeOrderedList.end(); ++itPlace) {
47 const Place* lPlace_ptr = *itPlace;
48 assert (lPlace_ptr != NULL);
49
50 oStr << lPlace_ptr->toString() << std::endl;
51 }
52
53 return oStr.str();
54 }
55
56 // //////////////////////////////////////////////////////////////////////
57 std::string PlaceHolder::toShortString() const {
58 std::ostringstream oStr;
59 oStr << describeShortKey() << std::endl;
60
61 for (PlaceOrderedList_T::const_iterator itPlace = _placeOrderedList.begin();
62 itPlace != _placeOrderedList.end(); ++itPlace) {
63 const Place* lPlace_ptr = *itPlace;
64 assert (lPlace_ptr != NULL);
65
66 oStr << lPlace_ptr->toShortString() << std::endl;
67 }
68
69 return oStr.str();
70 }
71
72 // //////////////////////////////////////////////////////////////////////
73 void PlaceHolder::toStream (std::ostream& ioOut) const {
74 ioOut << toString();
75 }
76
77 // //////////////////////////////////////////////////////////////////////
78 void PlaceHolder::fromStream (std::istream& ioIn) {
79 }
80
81 // //////////////////////////////////////////////////////////////////////
82 void PlaceHolder::createLocations (LocationList_T& ioLocationList) const {
83
84 for (PlaceOrderedList_T::const_iterator itPlace = _placeOrderedList.begin();
85 itPlace != _placeOrderedList.end(); ++itPlace) {
86 Place* lPlace_ptr = *itPlace;
87 assert (lPlace_ptr != NULL);
88
89 const Location& lLocation = lPlace_ptr->completeLocation();
90 ioLocationList.push_back (lLocation);
91 }
92 }
93
94
95}
std::string describeShortKey() const
std::string toString() const
void toStream(std::ostream &ioOut) const
std::string toShortString() const
std::string describeKey() const
void fromStream(std::istream &ioIn)
void createLocations(LocationList_T &) const
Class modelling a place/POR (point of reference).
Definition Place.hpp:29
const Location & completeLocation()
Definition Place.cpp:761
std::string toShortString() const
Definition Place.cpp:126
std::string toString() const
Definition Place.cpp:85
std::list< Location > LocationList_T
Structure modelling a (geographical) location.
Definition Location.hpp:25