summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/session_metadata.h
blob: 481e21c338e8aea62e49901b5e3f9cabdb05aec8 (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
    Copyright (C) 2008 Paul Davis
    Author: Sakari Bergen

    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the Free
    Software Foundation; either version 2 of the License, or (at your option)
    any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef __ardour_session_metadata_h__
#define __ardour_session_metadata_h__

#include <string>
#include <glibmm/ustring.h>

#include <map>
#include <utility>

#include "pbd/statefuldestructible.h"
#include "pbd/xml++.h"

namespace ARDOUR {

/** Represents metadata associated to a Session
 * Metadata can be accessed and edited via this class.
 * Exported files can also be tagged with this data.
 */
class SessionMetadata : public PBD::StatefulDestructible
{
  public:
	SessionMetadata ();
	~SessionMetadata ();

	/*** Accessing ***/
	Glib::ustring comment () const;
	Glib::ustring copyright () const;
	Glib::ustring isrc () const;
	uint32_t year () const;

	Glib::ustring grouping () const;
	Glib::ustring title () const;
	Glib::ustring subtitle () const;

	Glib::ustring artist () const;
	Glib::ustring album_artist () const;
	Glib::ustring lyricist () const;
	Glib::ustring composer () const;
	Glib::ustring conductor () const;
	Glib::ustring remixer () const;
	Glib::ustring arranger () const;
	Glib::ustring engineer () const;
	Glib::ustring producer () const;
	Glib::ustring dj_mixer () const;
	Glib::ustring mixer () const;

	Glib::ustring album () const;
	Glib::ustring compilation () const;
	Glib::ustring disc_subtitle () const;
	uint32_t disc_number () const;
	uint32_t total_discs () const;
	uint32_t track_number () const;
	uint32_t total_tracks () const;

	Glib::ustring genre () const;

	/*** Editing ***/
	void set_comment (const Glib::ustring &);
	void set_copyright (const Glib::ustring &);
	void set_isrc (const Glib::ustring &);
	void set_year (uint32_t);

	void set_grouping (const Glib::ustring &);
	void set_title (const Glib::ustring &);
	void set_subtitle (const Glib::ustring &);

	void set_artist (const Glib::ustring &);
	void set_album_artist (const Glib::ustring &);
	void set_lyricist (const Glib::ustring &);
	void set_composer (const Glib::ustring &);
	void set_conductor (const Glib::ustring &);
	void set_remixer (const Glib::ustring &);
	void set_arranger (const Glib::ustring &);
	void set_engineer (const Glib::ustring &);
	void set_producer (const Glib::ustring &);
	void set_dj_mixer (const Glib::ustring &);
	void set_mixer (const Glib::ustring &);

	void set_album (const Glib::ustring &);
	void set_compilation (const Glib::ustring &);
	void set_disc_subtitle (const Glib::ustring &);
	void set_disc_number (uint32_t);
	void set_total_discs (uint32_t);
	void set_track_number (uint32_t);
	void set_total_tracks (uint32_t);

	void set_genre (const Glib::ustring &);

	/*** Serialization ***/
	XMLNode & get_state ();
	int set_state (const XMLNode &, int version);

  private:

	typedef std::pair<Glib::ustring, Glib::ustring> Property;
	typedef std::map<Glib::ustring, Glib::ustring> PropertyMap;
	PropertyMap map;

	XMLNode * get_xml (const Glib::ustring & name);

	Glib::ustring get_value (const Glib::ustring & name) const;
	uint32_t get_uint_value (const Glib::ustring & name) const;

	void set_value (const Glib::ustring & name, const Glib::ustring & value);
	void set_value (const Glib::ustring & name, uint32_t value);
};

} // namespace ARDOUR

#endif // __ardour_session_metadata_h__