]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/zone.h
Add support for named zones
[r2c2.git] / source / libr2c2 / zone.h
1 /* $Id$
2
3 This file is part of R²C²
4 Copyright © 2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBR2C2_ZONE_H_
9 #define LIBR2C2_ZONE_H_
10
11 #include <set>
12 #include <string>
13 #include <msp/datafile/objectloader.h>
14
15 namespace R2C2 {
16
17 class Layout;
18 class Track;
19
20 class Zone
21 {
22 public:
23         class Loader: public Msp::DataFile::ObjectLoader<Zone>
24         {
25         public:
26                 Loader(Zone &);
27         private:
28                 void block(unsigned);
29         };
30
31         typedef std::set<Track *> TrackSet;
32
33         sigc::signal<void, const std::string &, const std::string &, unsigned> signal_name_changed;
34
35 private:
36         Layout &layout;
37         std::string group;
38         std::string qualifier;
39         unsigned number;
40         TrackSet tracks;
41
42 public:
43         Zone(Layout &);
44         ~Zone();
45
46         void set_name(const std::string &, const std::string &, unsigned);
47         const std::string &get_group() const { return group; }
48         const std::string &get_qualifier() const { return qualifier; }
49         unsigned get_number() const { return number; }
50         std::string get_name() const;
51
52         void add_track(Track &);
53         bool add_tracks(const TrackSet &);
54         const TrackSet &get_tracks() const { return tracks; }
55         bool has_track(Track &) const;
56
57         void save(std::list<Msp::DataFile::Statement> &) const;
58 private:
59         bool is_valid(Track &) const;
60 };
61
62 } // namespace R2C2
63
64 #endif