HoverRace  2.0
TrackList.h
Go to the documentation of this file.
1 
2 // TrackList.h
3 //
4 // Copyright (c) 2010, 2014, 2015 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include "TrackEntry.h"
25 
26 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
27 # ifdef MR_ENGINE
28 # define MR_DllDeclare __declspec( dllexport )
29 # else
30 # define MR_DllDeclare __declspec( dllimport )
31 # endif
32 #else
33 # define MR_DllDeclare
34 #endif
35 
36 namespace HoverRace {
37  namespace Parcel {
38  class TrackBundle;
39  }
40 }
41 
42 namespace HoverRace {
43 namespace Model {
44 
50 {
51 public:
52  TrackList();
53 
54 public:
55  void Reload(const Parcel::TrackBundle &trackBundle);
56 
58  void Clear() { tracks.clear(); }
59  bool IsEmpty() const { return tracks.empty(); }
60 
61  std::shared_ptr<TrackEntry> &operator[](size_t i) { return tracks[i]; }
62 
63 private:
64  using tracks_t = std::vector<std::shared_ptr<TrackEntry>>;
65 public:
66  using iterator = tracks_t::iterator;
67  using const_iterator = tracks_t::const_iterator;
68  using value_type = std::shared_ptr<TrackEntry>;
69 
70  iterator begin() { return tracks.begin(); }
71  iterator end() { return tracks.end(); }
72  const_iterator begin() const { return tracks.begin(); }
73  const_iterator end() const { return tracks.end(); }
74 
75 private:
77 };
78 
79 } // namespace Model
80 } // namespace HoverRace
81 
82 #undef MR_DllDeclare
bool IsEmpty() const
Definition: TrackList.h:59
std::shared_ptr< TrackEntry > & operator[](size_t i)
Definition: TrackList.h:61
iterator begin()
Definition: TrackList.h:70
std::vector< std::shared_ptr< TrackEntry >> tracks_t
Definition: TrackList.h:64
tracks_t::iterator iterator
Definition: TrackList.h:66
tracks_t::const_iterator const_iterator
Definition: TrackList.h:67
iterator end()
Definition: TrackList.h:71
#define MR_DllDeclare
Definition: TrackList.h:33
std::shared_ptr< TrackEntry > value_type
Definition: TrackList.h:68
const_iterator begin() const
Definition: TrackList.h:72
tracks_t tracks
Definition: TrackList.h:76
Sorted list of track headers.
Definition: TrackList.h:49
Definition: Announcement.h:24
const_iterator end() const
Definition: TrackList.h:73
A source of track parcels.
Definition: TrackBundle.h:58
void Clear()
Clear the list of available tracks.
Definition: TrackList.h:58