tag.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #include "nsid3v1.h"
  3. class nstest;
  4. namespace ID3v1
  5. {
  6. class Tag
  7. {
  8. friend class nstest;
  9. public:
  10. Tag();
  11. int Parse(const void *data, size_t len);
  12. void New(); // creates an empty (but valid) tag
  13. // Member value getters
  14. const char *GetHeader(void) const;
  15. const char *GetTitle(void) const;
  16. const char *GetArtist(void) const;
  17. const char *GetAlbum(void) const;
  18. const char *GetYear(void) const;
  19. const char *GetComment(void) const;
  20. uint8_t GetTrack(void) const;
  21. uint8_t GetGenre(void) const;
  22. // Member length getters
  23. size_t GetHeaderLength(void) const;
  24. size_t GetTitleLength(void) const;
  25. size_t GetArtistLength(void) const;
  26. size_t GetAlbumLength(void) const;
  27. size_t GetYearLength(void) const;
  28. size_t GetCommentLength(void) const;
  29. void SetTitle(const char *title, size_t length);
  30. void SetArtist(const char *artist, size_t length);
  31. void SetAlbum(const char *album, size_t length);
  32. void SetYear(const char *year, size_t length);
  33. void SetComment(const char *comment, size_t length);
  34. void SetTrack(uint8_t track);
  35. void SetGenre(uint8_t genre);
  36. int Serialize(void *data, size_t len);
  37. protected:
  38. char header[3];
  39. char title[30];
  40. char artist[30];
  41. char album[30];
  42. char year[4];
  43. char comment[30]; // Bytes 29 & 30 can contain 0 & genre respectivly, ID3V1.1
  44. uint8_t track;
  45. uint8_t genre;
  46. };
  47. }