File: qtag.hh

package info (click to toggle)
quelcom 0.4.0-16
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 1,544 kB
  • sloc: cpp: 4,148; makefile: 158; sh: 15
file content (83 lines) | stat: -rw-r--r-- 1,813 bytes parent folder | download | duplicates (3)
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
/*! \file
 * header functions for qtag
 */

# ifndef __qtag_hh__
# define __qtag_hh__

# include "qfile.hh"
# include <sys/types.h>

using namespace std;

/*!
 * \brief class for mp3 tags
 *
 * this class models (partially) a mp3 tag v1.0
 */
class qtag {

  private:
    static const u_int32_t fieldlengths[];

   //! struct for mp3 tags
    struct tag {
      char tagid[3],	/*!< 'TAG' */
      title[30],	/*!< title */
      artist[30],	/*!< artist */
      album[30],	/*!< album name */
      year[4],		/*!< year */
      comment[30],	/*!< free comment */
      genre[1];		/*!< one byte music genre identifier */
    };

   //! memory location where the tag is mapped
    struct tag *tag;

  public:

   //! length of the tag
    static const u_int32_t LENGTH;

   //! list of tag fields
    enum field { TAG=0, TITLE, ARTIST, ALBUM, YEAR, COMMENT, GENRE };

   /*!
    * initializes itself with a tag in memory
    * \param a the address where the tag is found
    */
    qtag (caddr_t a);
   /*!
    * initializes itself with a tag in a file
    * \param f the file where to look for the tag
    */
    qtag (qfile &f);

   /*!
    * \brief gets the location in memory where the tag is placed
    * \return the memory address of the tag
    */
    caddr_t getMap();
   // treballar amb strings!!
    void get (enum field f, char *); 
    void set (enum field f, char *); 

   /*
    * \brief whether the tag is (found and) valid
    * \return whether is a valid tag or not
    */
    bool isValid();

    u_int32_t fieldlength (enum field f) { return fieldlengths[f]; }
    void cleanFields ();

   /*!
    * \brief print the wav characteristics on the given output stream
    * \param os the given output stream
    */
    void print (ostream *os);
}; 

ostream &operator<<(ostream &os, qtag &t);

# endif