File: LevelReader.h

package info (click to toggle)
moagg 0.18-6
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 1,924 kB
  • ctags: 4,059
  • sloc: cpp: 23,814; sh: 2,652; makefile: 283
file content (79 lines) | stat: -rw-r--r-- 2,405 bytes parent folder | download | duplicates (3)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef LEVELREADER_H
#define LEVELREADER_H

#include <list>
#include <string>


//----------------------------------------------------------------------------
class LevelReader
{
    typedef std::list<std::string> Levels;

  public:
    typedef Levels::iterator iterator;
    typedef Levels::const_iterator const_iterator;

    //------------------------------------------------------------------------
    LevelReader();
    ~LevelReader();

    //------------------------------------------------------------------------
    void init(const char *mission);

    //------------------------------------------------------------------------
    inline const std::string &getMission() const
    {
        return m_mission;
    }

    //------------------------------------------------------------------------
    inline bool empty() const { return m_levels.empty(); }
    inline size_t size() const { return m_levels.size(); }

    inline iterator begin() { return m_levels.begin(); }
    inline iterator end() { return m_levels.end(); }

    inline const_iterator begin() const { return m_levels.begin(); }
    inline const_iterator end() const { return m_levels.end(); }

  private:
    //------------------------------------------------------------------------
    std::string m_mission;
    Levels m_levels;
};


//----------------------------------------------------------------------------
class MissionReader
{
    //------------------------------------------------------------------------
    typedef std::pair<std::string, std::string> Entry;
    typedef std::list<Entry> Missions;

  public:
    typedef Missions::iterator iterator;
    typedef Missions::const_iterator const_iterator;

    //------------------------------------------------------------------------
    MissionReader();
    ~MissionReader();

    //------------------------------------------------------------------------
    void init();

    //------------------------------------------------------------------------
    inline bool empty() const { return m_missions.empty(); }
    inline size_t size() const { return m_missions.size(); }

    iterator begin() { return m_missions.begin(); }
    iterator end() { return m_missions.end(); }

    const_iterator begin() const { return m_missions.begin(); }
    const_iterator end() const { return m_missions.end(); }

  private:
    Missions m_missions;
};

#endif //LEVELREADER_H