herald  2.0.0
location.h
1 // Copyright 2020-2021 Herald Project Contributors
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #ifndef HERALD_LOCATION_H
6 #define HERALD_LOCATION_H
7 
8 #include "location_reference.h"
9 #include "date.h"
10 
11 #include <string>
12 #include <memory>
13 
14 namespace herald {
15 namespace datatype {
16 
17 template <typename LocationReferenceT>
18 class Location {
19 public:
20  Location(LocationReferenceT&& value, Date&& start, Date&& end)
21  : mValue(std::move(value)),mStart(std::move(start)),mEnd(std::move(end))
22  {};
23  ~Location();
24 
25  std::string description() const {
26  return mValue->description() + ":[from=" + ((std::string)mStart) + ",to=" + ((std::string)mEnd) + "]";
27  }
28 
29  operator std::string() const noexcept {
30  return description();
31  }
32 
33 private:
34  LocationReferenceT mValue;
35  Date mStart;
36  Date mEnd;
37 };
38 
39 } // end namespace
40 } // end namespace
41 
42 #endif
Definition: date.h:18
Definition: location.h:18
Acts as a non-global memory arena for arbitrary classes.
Definition: aggregates.h:15