xref: /MusicPlayer2/MusicPlayer2/taglib/s3mfile.h (revision 443d2d2511be730d1b1dd3181942b7fa6539aa1a)
1 /***************************************************************************
2     copyright           : (C) 2011 by Mathias Panzenböck
3     email               : [email protected]
4  ***************************************************************************/
5 
6 /***************************************************************************
7  *   This library is free software; you can redistribute it and/or modify  *
8  *   it under the terms of the GNU Lesser General Public License version   *
9  *   2.1 as published by the Free Software Foundation.                     *
10  *                                                                         *
11  *   This library is distributed in the hope that it will be useful, but   *
12  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
14  *   Lesser General Public License for more details.                       *
15  *                                                                         *
16  *   You should have received a copy of the GNU Lesser General Public      *
17  *   License along with this library; if not, write to the Free Software   *
18  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA         *
19  *   02110-1301  USA                                                       *
20  *                                                                         *
21  *   Alternatively, this file is available under the Mozilla Public        *
22  *   License Version 1.1.  You may obtain a copy of the License at         *
23  *   http://www.mozilla.org/MPL/                                           *
24  ***************************************************************************/
25 
26 #ifndef TAGLIB_S3MFILE_H
27 #define TAGLIB_S3MFILE_H
28 
29 #include "tfile.h"
30 #include "audioproperties.h"
31 #include "taglib_export.h"
32 #include "modfilebase.h"
33 #include "modtag.h"
34 #include "s3mproperties.h"
35 
36 namespace TagLib {
37 
38   namespace S3M {
39 
40     class TAGLIB_EXPORT File : public Mod::FileBase {
41       public:
42         /*!
43          * Constructs a ScreamTracker III from \a file.
44          *
45          * \note In the current implementation, both \a readProperties and
46          * \a propertiesStyle are ignored.  The audio properties are always
47          * read.
48          */
49         File(FileName file, bool readProperties = true,
50              AudioProperties::ReadStyle propertiesStyle =
51              AudioProperties::Average);
52 
53         /*!
54          * Constructs a ScreamTracker III file from \a stream.
55          *
56          * \note In the current implementation, both \a readProperties and
57          * \a propertiesStyle are ignored.  The audio properties are always
58          * read.
59          *
60          * \note TagLib will *not* take ownership of the stream, the caller is
61          * responsible for deleting it after the File object.
62          */
63         File(IOStream *stream, bool readProperties = true,
64              AudioProperties::ReadStyle propertiesStyle =
65              AudioProperties::Average);
66 
67         /*!
68          * Destroys this instance of the File.
69          */
70         virtual ~File();
71 
72         Mod::Tag *tag() const;
73 
74         /*!
75          * Implements the unified property interface -- export function.
76          * Forwards to Mod::Tag::properties().
77          */
78         PropertyMap properties() const;
79 
80         /*!
81          * Implements the unified property interface -- import function.
82          * Forwards to Mod::Tag::setProperties().
83          */
84         PropertyMap setProperties(const PropertyMap &);
85 
86         /*!
87          * Returns the S3M::Properties for this file. If no audio properties
88          * were read then this will return a null pointer.
89          */
90         S3M::Properties *audioProperties() const;
91 
92         /*!
93          * Save the file.
94          * This is the same as calling save(AllTags);
95          *
96          * \note Saving ScreamTracker III tags is not supported.
97          */
98         bool save();
99 
100       private:
101         File(const File &);
102         File &operator=(const File &);
103 
104         void read(bool readProperties);
105 
106         class FilePrivate;
107         FilePrivate *d;
108     };
109   }
110 }
111 
112 #endif
113