]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/zone.h
Add support for named zones
[r2c2.git] / source / libr2c2 / zone.h
diff --git a/source/libr2c2/zone.h b/source/libr2c2/zone.h
new file mode 100644 (file)
index 0000000..98feb67
--- /dev/null
@@ -0,0 +1,64 @@
+/* $Id$
+
+This file is part of R²C²
+Copyright © 2010  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
+#ifndef LIBR2C2_ZONE_H_
+#define LIBR2C2_ZONE_H_
+
+#include <set>
+#include <string>
+#include <msp/datafile/objectloader.h>
+
+namespace R2C2 {
+
+class Layout;
+class Track;
+
+class Zone
+{
+public:
+       class Loader: public Msp::DataFile::ObjectLoader<Zone>
+       {
+       public:
+               Loader(Zone &);
+       private:
+               void block(unsigned);
+       };
+
+       typedef std::set<Track *> TrackSet;
+
+       sigc::signal<void, const std::string &, const std::string &, unsigned> signal_name_changed;
+
+private:
+       Layout &layout;
+       std::string group;
+       std::string qualifier;
+       unsigned number;
+       TrackSet tracks;
+
+public:
+       Zone(Layout &);
+       ~Zone();
+
+       void set_name(const std::string &, const std::string &, unsigned);
+       const std::string &get_group() const { return group; }
+       const std::string &get_qualifier() const { return qualifier; }
+       unsigned get_number() const { return number; }
+       std::string get_name() const;
+
+       void add_track(Track &);
+       bool add_tracks(const TrackSet &);
+       const TrackSet &get_tracks() const { return tracks; }
+       bool has_track(Track &) const;
+
+       void save(std::list<Msp::DataFile::Statement> &) const;
+private:
+       bool is_valid(Track &) const;
+};
+
+} // namespace R2C2
+
+#endif