~ubuntu-branches/ubuntu/utopic/ardour3/utopic

« back to all changes in this revision

Viewing changes to libs/ardour/ardour/session_metadata.h

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler
  • Date: 2013-09-21 19:05:02 UTC
  • Revision ID: package-import@ubuntu.com-20130921190502-8gsftrku6jnzhd7v
Tags: upstream-3.4~dfsg
ImportĀ upstreamĀ versionĀ 3.4~dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (C) 2008 Paul Davis
 
3
    Author: Sakari Bergen
 
4
 
 
5
    This program is free software; you can redistribute it and/or modify it
 
6
    under the terms of the GNU General Public License as published by the Free
 
7
    Software Foundation; either version 2 of the License, or (at your option)
 
8
    any later version.
 
9
 
 
10
    This program is distributed in the hope that it will be useful, but WITHOUT
 
11
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
12
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
13
    for more details.
 
14
 
 
15
    You should have received a copy of the GNU General Public License along
 
16
    with this program; if not, write to the Free Software Foundation, Inc.,
 
17
    675 Mass Ave, Cambridge, MA 02139, USA.
 
18
*/
 
19
 
 
20
#ifndef __ardour_session_metadata_h__
 
21
#define __ardour_session_metadata_h__
 
22
 
 
23
#include <string>
 
24
 
 
25
#include <map>
 
26
#include <utility>
 
27
 
 
28
#include "pbd/statefuldestructible.h"
 
29
#include "pbd/xml++.h"
 
30
 
 
31
namespace ARDOUR {
 
32
 
 
33
/** Represents metadata associated to a Session
 
34
 * Metadata can be accessed and edited via this class.
 
35
 * Exported files can also be tagged with this data.
 
36
 */
 
37
class SessionMetadata : public PBD::StatefulDestructible
 
38
{
 
39
  public:
 
40
        //singleton instance:
 
41
        static SessionMetadata *Metadata() { if (_metadata == NULL) _metadata = new SessionMetadata();  return _metadata; }
 
42
 
 
43
        SessionMetadata ();
 
44
        ~SessionMetadata ();
 
45
 
 
46
        /*** Accessing ***/
 
47
        std::string comment () const;
 
48
        std::string copyright () const;
 
49
        std::string isrc () const;
 
50
        uint32_t year () const;
 
51
 
 
52
        std::string grouping () const;
 
53
        std::string title () const;
 
54
        std::string subtitle () const;
 
55
 
 
56
        std::string artist () const;
 
57
        std::string album_artist () const;
 
58
        std::string lyricist () const;
 
59
        std::string composer () const;
 
60
        std::string conductor () const;
 
61
        std::string remixer () const;
 
62
        std::string arranger () const;
 
63
        std::string engineer () const;
 
64
        std::string producer () const;
 
65
        std::string dj_mixer () const;
 
66
        std::string mixer () const;
 
67
 
 
68
        std::string album () const;
 
69
        std::string compilation () const;
 
70
        std::string disc_subtitle () const;
 
71
        uint32_t disc_number () const;
 
72
        uint32_t total_discs () const;
 
73
        uint32_t track_number () const;
 
74
        uint32_t total_tracks () const;
 
75
 
 
76
        std::string genre () const;
 
77
 
 
78
        std::string instructor () const;
 
79
        std::string course () const;
 
80
 
 
81
        std::string user_name () const;
 
82
        std::string user_email () const;
 
83
        std::string user_web () const;
 
84
        std::string organization () const;
 
85
        std::string country () const;
 
86
 
 
87
        /*** Editing ***/
 
88
        void set_comment (const std::string &);
 
89
        void set_copyright (const std::string &);
 
90
        void set_isrc (const std::string &);
 
91
        void set_year (uint32_t);
 
92
 
 
93
        void set_grouping (const std::string &);
 
94
        void set_title (const std::string &);
 
95
        void set_subtitle (const std::string &);
 
96
 
 
97
        void set_artist (const std::string &);
 
98
        void set_album_artist (const std::string &);
 
99
        void set_lyricist (const std::string &);
 
100
        void set_composer (const std::string &);
 
101
        void set_conductor (const std::string &);
 
102
        void set_remixer (const std::string &);
 
103
        void set_arranger (const std::string &);
 
104
        void set_engineer (const std::string &);
 
105
        void set_producer (const std::string &);
 
106
        void set_dj_mixer (const std::string &);
 
107
        void set_mixer (const std::string &);
 
108
 
 
109
        void set_album (const std::string &);
 
110
        void set_compilation (const std::string &);
 
111
        void set_disc_subtitle (const std::string &);
 
112
        void set_disc_number (uint32_t);
 
113
        void set_total_discs (uint32_t);
 
114
        void set_track_number (uint32_t);
 
115
        void set_total_tracks (uint32_t);
 
116
 
 
117
        void set_genre (const std::string &);
 
118
 
 
119
        void set_instructor (const std::string &);
 
120
        void set_course (const std::string &);
 
121
 
 
122
        void set_user_name (const std::string &);
 
123
        void set_user_email (const std::string &);
 
124
        void set_user_web (const std::string &);
 
125
        void set_organization (const std::string &);
 
126
        void set_country (const std::string &);
 
127
 
 
128
        /*** Serialization ***/
 
129
        XMLNode & get_state ();  //serializes stuff in the map, to be stored in session file
 
130
        XMLNode & get_user_state ();  //serializes stuff in the user_map, to be stored in user's config file
 
131
        int set_state (const XMLNode &, int version_num);
 
132
 
 
133
  private:
 
134
 
 
135
        static SessionMetadata *_metadata;  //singleton instance 
 
136
 
 
137
        typedef std::pair<std::string, std::string> Property;
 
138
        typedef std::map<std::string, std::string> PropertyMap;
 
139
        PropertyMap map;
 
140
        PropertyMap user_map;
 
141
 
 
142
        XMLNode * get_xml (const std::string & name);
 
143
 
 
144
        std::string get_value (const std::string & name) const;
 
145
        uint32_t get_uint_value (const std::string & name) const;
 
146
 
 
147
        void set_value (const std::string & name, const std::string & value);
 
148
        void set_value (const std::string & name, uint32_t value);
 
149
};
 
150
 
 
151
} // namespace ARDOUR
 
152
 
 
153
#endif // __ardour_session_metadata_h__