Tag Parser  7.0.3
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
settings.h
Go to the documentation of this file.
1 #ifndef TAGPARSER_SETTINGS_H
2 #define TAGPARSER_SETTINGS_H
3 
4 #include "./tagtarget.h"
5 
6 #include <type_traits>
7 
8 namespace TagParser {
9 
10 enum class ElementPosition {
11  BeforeData,
12  AfterData,
13  Keep,
14 };
15 
19 enum class TagUsage {
20  Always,
21  KeepExisting,
22  Never,
23 };
24 
28 enum class TagCreationFlags : uint64 {
29  None = 0,
31  Id3InitOnCreate = 1 << 1,
35  = 1 << 4,
36 };
37 
39 {
40  return static_cast<TagCreationFlags>(
41  static_cast<std::underlying_type<TagCreationFlags>::type>(lhs) | static_cast<std::underlying_type<TagCreationFlags>::type>(rhs));
42 }
43 
45 {
46  return static_cast<std::underlying_type<TagCreationFlags>::type>(lhs) & static_cast<std::underlying_type<TagCreationFlags>::type>(rhs);
47 }
48 
50 {
51  return lhs = static_cast<TagCreationFlags>(
52  static_cast<std::underlying_type<TagCreationFlags>::type>(lhs) | static_cast<std::underlying_type<TagCreationFlags>::type>(rhs));
53 }
54 
56 {
57  return lhs = static_cast<TagCreationFlags>(
58  static_cast<std::underlying_type<TagCreationFlags>::type>(lhs) | static_cast<std::underlying_type<TagCreationFlags>::type>(rhs));
59 }
60 
62 {
63  return lhs = static_cast<TagCreationFlags>(
64  static_cast<std::underlying_type<TagCreationFlags>::type>(lhs) & (~static_cast<std::underlying_type<TagCreationFlags>::type>(rhs)));
65 }
66 
72  std::vector<TagTarget> requiredTargets = std::vector<TagTarget>();
82 
83  // workaround for GGC bug 66297 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66297)
84 #if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 2)
85  inline
86 #else
87  constexpr
88 #endif
90  setFlag(TagCreationFlags flag, bool enabled);
91 };
92 
93 #if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 2)
94 inline
95 #else
96 constexpr
97 #endif
100 {
101  if (enabled) {
102  flags |= flag;
103  } else {
104  flags -= flag;
105  }
106  return *this;
107 }
108 
109 } // namespace TagParser
110 
111 #endif // TAGPARSER_SETTINGS_H
TagCreationSettings & setFlag(TagCreationFlags flag, bool enabled)
Definition: settings.h:99
std::vector< TagTarget > requiredTargets
Specifies the required targets. If targets are not supported by the container an informal notificatio...
Definition: settings.h:72
TagCreationFlags flags
Specifies options to control the tag creation. See TagSettings::Flags.
Definition: settings.h:74
The TagSettings struct contains settings which can be passed to MediaFileInfo::createAppropriateTags(...
Definition: settings.h:70
TagUsage id3v1usage
Specifies the usage of ID3v1 when creating tags for MP3 files (has no effect when the file is no MP3 ...
Definition: settings.h:77
byte id3v2MajorVersion
Specifies the ID3v2 version to be used in case an ID3v2 tag present or will be created. Valid values are 2, 3 and 4.
Definition: settings.h:81
TagUsage
The TagUsage enum specifies the usage of a certain tag type.
Definition: settings.h:19
XingHeaderFlags operator|(XingHeaderFlags lhs, XingHeaderFlags rhs)
XingHeaderFlags operator &(XingHeaderFlags lhs, XingHeaderFlags rhs)
constexpr TagCreationFlags & operator-=(TagCreationFlags &lhs, TagCreationFlags rhs)
Definition: settings.h:61
TagCreationFlags
The Flags enum contains options to control the tag creation via MediaFileInfo::createAppropriateTags(...
Definition: settings.h:28
constexpr TagCreationFlags & operator+=(TagCreationFlags &lhs, TagCreationFlags rhs)
Definition: settings.h:55
DiagLevel & operator|=(DiagLevel &lhs, const DiagLevel &rhs)
Sets lhs to rhs if rhs is more critical than lhs and returns lhs.
Definition: diagnostics.h:32
TagUsage id3v2usage
Specifies the usage of ID3v2 when creating tags for MP3 files (has no effect when the file is no MP3 ...
Definition: settings.h:79
ElementPosition
Definition: settings.h:10