Tag Parser  7.1.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
utils.cpp
Go to the documentation of this file.
1 #include "./helper.h"
2 
3 #include "../aspectratio.h"
4 #include "../backuphelper.h"
5 #include "../diagnostics.h"
6 #include "../exceptions.h"
7 #include "../margin.h"
8 #include "../mediafileinfo.h"
9 #include "../mediaformat.h"
10 #include "../positioninset.h"
11 #include "../progressfeedback.h"
12 #include "../signature.h"
13 #include "../size.h"
14 #include "../tagtarget.h"
15 
16 #include <c++utilities/conversion/stringbuilder.h>
17 #include <c++utilities/io/catchiofailure.h>
18 #include <c++utilities/tests/testutils.h>
19 using namespace TestUtilities;
20 
21 #include <cppunit/TestFixture.h>
22 #include <cppunit/extensions/HelperMacros.h>
23 
24 #include <cstdio>
25 
26 using namespace std;
27 using namespace TagParser;
28 using namespace ConversionUtilities;
29 using namespace IoUtilities;
30 using namespace TestUtilities::Literals;
31 
32 using namespace CPPUNIT_NS;
33 
37 class UtilitiesTests : public TestFixture {
38  CPPUNIT_TEST_SUITE(UtilitiesTests);
39  CPPUNIT_TEST(testSize);
40  CPPUNIT_TEST(testTagTarget);
41  CPPUNIT_TEST(testSignature);
42  CPPUNIT_TEST(testMargin);
43  CPPUNIT_TEST(testAspectRatio);
44  CPPUNIT_TEST(testMediaFormat);
45  CPPUNIT_TEST(testPositionInSet);
46  CPPUNIT_TEST(testProgressFeedback);
47  CPPUNIT_TEST(testAbortableProgressFeedback);
48  CPPUNIT_TEST(testDiagnostics);
49 #ifdef PLATFORM_UNIX
50  CPPUNIT_TEST(testBackupFile);
51 #endif
52  CPPUNIT_TEST_SUITE_END();
53 
54 public:
55  void setUp();
56  void tearDown();
57 
58  void testSize();
59  void testStatusProvider();
60  void testTagTarget();
61  void testSignature();
62  void testMargin();
63  void testAspectRatio();
64  void testMediaFormat();
65  void testPositionInSet();
66  void testProgressFeedback();
67  void testAbortableProgressFeedback();
68  void testDiagnostics();
69 #ifdef PLATFORM_UNIX
70  void testBackupFile();
71 #endif
72 };
73 
75 
77 {
78 }
79 
81 {
82 }
83 
85 {
86  static_assert(Size().isNull(), "Size::isNull()");
87  static_assert(!Size(3, 4).isNull(), "Size::isNull()");
88  static_assert(Size(3, 4).resolution() == 12, "Size::resolution");
89 
90  Size size(1920, 1080);
91  CPPUNIT_ASSERT_EQUAL("width: 1920, height: 1080"s, size.toString());
92  CPPUNIT_ASSERT_EQUAL("1080p"s, string(size.abbreviation()));
93  size.setWidth(1280);
94  size.setHeight(720);
95  CPPUNIT_ASSERT_EQUAL("720p"s, string(size.abbreviation()));
96 }
97 
99 {
100  TagTarget target;
101  CPPUNIT_ASSERT(target.isEmpty());
102  CPPUNIT_ASSERT_EQUAL_MESSAGE("default level is 50", 50ul, target.level());
103  CPPUNIT_ASSERT_EQUAL("level 50"s, target.toString(TagTargetLevel::Unspecified));
104  target = TagTarget(30, { 1, 2, 3 }, { 4 }, { 5, 6 }, { 7, 8, 9 });
105  CPPUNIT_ASSERT(!target.isEmpty());
106  const auto mapping = [](uint64 level) { return level == 30 ? TagTargetLevel::Track : TagTargetLevel::Unspecified; };
107  CPPUNIT_ASSERT_EQUAL(
108  "level 30 'track, song, chapter', track 1, track 2, track 3, chapter 4, edition 5, edition 6, attachment 7, attachment 8, attachment 9"s,
109  target.toString(mapping));
110  target.setLevel(40);
111  CPPUNIT_ASSERT_EQUAL("level 40, track 1, track 2, track 3, chapter 4, edition 5, edition 6, attachment 7, attachment 8, attachment 9"s,
112  target.toString(mapping));
113  target.setLevelName("test");
114  CPPUNIT_ASSERT_EQUAL("level 40 'test', track 1, track 2, track 3, chapter 4, edition 5, edition 6, attachment 7, attachment 8, attachment 9"s,
115  target.toString(mapping));
116  CPPUNIT_ASSERT(target == TagTarget(40, { 1, 2, 3 }, { 4 }, { 5, 6 }, { 7, 8, 9 }));
117  target.clear();
118  CPPUNIT_ASSERT(target.isEmpty());
119 }
120 
122 {
123  const unsigned char xzHead[12] = { 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00, 0x00, 0x04, 0xe6, 0xd6, 0xb4, 0x46 };
124 
125  // truncated buffer
126  CPPUNIT_ASSERT_EQUAL(ContainerFormat::Unknown, parseSignature(reinterpret_cast<const char *>(xzHead), 3));
127  CPPUNIT_ASSERT_EQUAL(ContainerFormat::Unknown, parseSignature(reinterpret_cast<const char *>(xzHead), 2));
128  CPPUNIT_ASSERT_EQUAL(ContainerFormat::Unknown, parseSignature(reinterpret_cast<const char *>(xzHead), 0));
129 
130  const auto containerFormat = parseSignature(reinterpret_cast<const char *>(xzHead), sizeof(xzHead));
131  CPPUNIT_ASSERT_EQUAL(ContainerFormat::Xz, containerFormat);
132  CPPUNIT_ASSERT_EQUAL("xz compressed file"s, string(containerFormatName(containerFormat)));
133  CPPUNIT_ASSERT_EQUAL("xz"s, string(containerFormatAbbreviation(containerFormat)));
134  CPPUNIT_ASSERT_EQUAL(string(), string(containerFormatSubversion(containerFormat)));
135 }
136 
138 {
139  static_assert(Margin().isNull(), "empty margin");
140  static_assert(!Margin(0, 2).isNull(), "non-empty margin");
141 
142  CPPUNIT_ASSERT_EQUAL("top: 1; left: 2; bottom: 3; right: 4"s, Margin(1, 2, 3, 4).toString());
143 }
144 
146 {
147  static_assert(!AspectRatio().isValid(), "invalid aspect ratio");
148  static_assert(AspectRatio(16, 9).isValid(), "valid aspect ratio");
149  static_assert(AspectRatio(16, 9).isExtended(), "extended aspect ratio");
150 
151  const AspectRatio ratio(4);
152  CPPUNIT_ASSERT_EQUAL(static_cast<uint16>(16), ratio.numerator);
153  CPPUNIT_ASSERT_EQUAL(static_cast<uint16>(11), ratio.denominator);
154  const AspectRatio ratio2(77);
155  CPPUNIT_ASSERT_EQUAL(static_cast<uint16>(0), ratio2.numerator);
156  CPPUNIT_ASSERT_EQUAL(static_cast<uint16>(0), ratio2.denominator);
157 }
158 
160 {
161  // unspecific format
163  CPPUNIT_ASSERT_EQUAL("Advanced Audio Coding"s, string(aac.name()));
164  CPPUNIT_ASSERT_EQUAL("AAC"s, string(aac.abbreviation()));
165  CPPUNIT_ASSERT_EQUAL("AAC"s, string(aac.shortAbbreviation()));
166 
167  // specific format
169  CPPUNIT_ASSERT(aac == GeneralMediaFormat::Aac);
170  CPPUNIT_ASSERT(aac != GeneralMediaFormat::Mpeg1Audio);
171  CPPUNIT_ASSERT_EQUAL("Advanced Audio Coding Low Complexity Profile"s, string(aac.name()));
172  CPPUNIT_ASSERT_EQUAL("MPEG-4 AAC-LC"s, string(aac.abbreviation()));
173  CPPUNIT_ASSERT_EQUAL("HE-AAC"s, string(aac.shortAbbreviation()));
174  CPPUNIT_ASSERT_EQUAL("Spectral Band Replication / HE-AAC"s, string(aac.extensionName()));
175 }
176 
178 {
179  const PositionInSet empty;
180  CPPUNIT_ASSERT(empty.isNull());
181  CPPUNIT_ASSERT_EQUAL(0, empty.position());
182  CPPUNIT_ASSERT_EQUAL(0, empty.total());
183  CPPUNIT_ASSERT_EQUAL(""s, empty.toString());
184 
185  const PositionInSet oneOfThree(1, 3);
186  CPPUNIT_ASSERT(!oneOfThree.isNull());
187  CPPUNIT_ASSERT_EQUAL(1, oneOfThree.position());
188  CPPUNIT_ASSERT_EQUAL(3, oneOfThree.total());
189  CPPUNIT_ASSERT_EQUAL("1/3"s, oneOfThree.toString());
190 
191  const PositionInSet posOnly(5, 0);
192  CPPUNIT_ASSERT(!posOnly.isNull());
193  CPPUNIT_ASSERT_EQUAL(5, posOnly.position());
194  CPPUNIT_ASSERT_EQUAL(0, posOnly.total());
195  CPPUNIT_ASSERT_EQUAL("5"s, posOnly.toString());
196 
197  const PositionInSet totalOnly(0, 5);
198  CPPUNIT_ASSERT(!totalOnly.isNull());
199  CPPUNIT_ASSERT_EQUAL(0, totalOnly.position());
200  CPPUNIT_ASSERT_EQUAL(5, totalOnly.total());
201  CPPUNIT_ASSERT_EQUAL("/5"s, totalOnly.toString());
202 }
203 
205 {
206  unsigned int steps = 0;
207  string step;
208  unsigned int stepPercentage;
209  unsigned int overallPercentage = 0;
210 
211  ProgressFeedback progress(
212  [&](const ProgressFeedback &progress) {
213  ++steps;
214  step = progress.step();
215  stepPercentage = progress.stepPercentage();
216  overallPercentage = progress.overallPercentage();
217  },
218  [&](const ProgressFeedback &progress) {
219  stepPercentage = progress.stepPercentage();
220  overallPercentage = progress.overallPercentage();
221  });
222  CPPUNIT_ASSERT_EQUAL(0u, steps);
223  progress.updateOverallPercentage(25);
224  CPPUNIT_ASSERT_EQUAL(0u, steps);
225  CPPUNIT_ASSERT_EQUAL(25u, overallPercentage);
226  progress.updateStep("foo", 45);
227  CPPUNIT_ASSERT_EQUAL(1u, steps);
228  CPPUNIT_ASSERT_EQUAL("foo"s, step);
229  CPPUNIT_ASSERT_EQUAL(45u, stepPercentage);
230  CPPUNIT_ASSERT_EQUAL(25u, overallPercentage);
231  progress.updateStepPercentage(60);
232  CPPUNIT_ASSERT_EQUAL(1u, steps);
233  CPPUNIT_ASSERT_EQUAL("foo"s, step);
234  CPPUNIT_ASSERT_EQUAL(60u, stepPercentage);
235  CPPUNIT_ASSERT_EQUAL(25u, overallPercentage);
236  progress.updateStepPercentageFromFraction(0.75);
237  CPPUNIT_ASSERT_EQUAL(1u, steps);
238  CPPUNIT_ASSERT_EQUAL("foo"s, step);
239  CPPUNIT_ASSERT_EQUAL(75u, stepPercentage);
240  CPPUNIT_ASSERT_EQUAL(25u, overallPercentage);
241 }
242 
244 {
245  unsigned int steps = 0;
246  string step;
247  unsigned int stepPercentage;
248  unsigned int overallPercentage = 0;
249 
250  AbortableProgressFeedback progress(
251  [&](const AbortableProgressFeedback &progress) {
252  ++steps;
253  step = progress.step();
254  stepPercentage = progress.stepPercentage();
255  overallPercentage = progress.overallPercentage();
256  },
257  [&](const AbortableProgressFeedback &progress) {
258  stepPercentage = progress.stepPercentage();
259  overallPercentage = progress.overallPercentage();
260  });
261  CPPUNIT_ASSERT(!progress.isAborted());
262  CPPUNIT_ASSERT_NO_THROW_MESSAGE("stop does nothing if not aborted", progress.stopIfAborted());
263  CPPUNIT_ASSERT_EQUAL(0u, steps);
264  progress.updateOverallPercentage(25);
265  CPPUNIT_ASSERT_EQUAL(0u, steps);
266  CPPUNIT_ASSERT_EQUAL(25u, overallPercentage);
267  progress.updateStep("foo", 45);
268  CPPUNIT_ASSERT_EQUAL(1u, steps);
269  CPPUNIT_ASSERT_EQUAL("foo"s, step);
270  CPPUNIT_ASSERT_EQUAL(45u, stepPercentage);
271  CPPUNIT_ASSERT_EQUAL(25u, overallPercentage);
272  CPPUNIT_ASSERT_NO_THROW_MESSAGE("next step continues if not aborted", progress.nextStepOrStop("bar", 33));
273  CPPUNIT_ASSERT_EQUAL(2u, steps);
274  CPPUNIT_ASSERT_EQUAL("bar"s, step);
275  CPPUNIT_ASSERT_EQUAL(33u, stepPercentage);
276  CPPUNIT_ASSERT_EQUAL(25u, overallPercentage);
277  progress.tryToAbort();
278  CPPUNIT_ASSERT(progress.isAborted());
279  CPPUNIT_ASSERT_THROW(progress.nextStepOrStop("not going to happen", 33), OperationAbortedException);
280  CPPUNIT_ASSERT_EQUAL(2u, steps);
281  CPPUNIT_ASSERT_EQUAL("bar"s, step);
282  CPPUNIT_ASSERT_EQUAL(33u, stepPercentage);
283  CPPUNIT_ASSERT_EQUAL(25u, overallPercentage);
284 }
285 
287 {
288  Diagnostics diag;
289  CPPUNIT_ASSERT_EQUAL(DiagLevel::None, diag.level());
290  diag.emplace_back(DiagLevel::Warning, "warning msg", "context");
291  CPPUNIT_ASSERT_EQUAL(DiagLevel::Warning, diag.level());
292  CPPUNIT_ASSERT(!diag.has(DiagLevel::Critical));
293  diag.emplace_back(DiagLevel::Critical, "critical msg", "context");
294  CPPUNIT_ASSERT_EQUAL(DiagLevel::Critical, diag.level());
295  CPPUNIT_ASSERT(diag.has(DiagLevel::Critical));
296 }
297 
298 #ifdef PLATFORM_UNIX
299 void UtilitiesTests::testBackupFile()
300 {
301  using namespace BackupHelper;
302 
303  // ensure backup directory is empty, so backups will be created in the same directory
304  // as the original file
305  backupDirectory().clear();
306 
307  // setup testfile
308  MediaFileInfo file(workingCopyPath("unsupported.bin"));
309  const auto workingDir(file.containingDirectory());
310  file.open();
311 
312  // create backup file
313  string backupPath1, backupPath2;
314  NativeFileStream backupStream1, backupStream2;
315  createBackupFile(file.path(), backupPath1, file.stream(), backupStream1);
316  CPPUNIT_ASSERT_EQUAL(workingDir + "/unsupported.bin.bak", backupPath1);
317 
318  // recreate original file (like the 'make' methods would do to apply changes)
319  file.stream().open(file.path(), ios_base::out);
320  file.stream() << "test1" << endl;
321 
322  // create a 2nd backup which should not override the first one
323  createBackupFile(file.path(), backupPath2, file.stream(), backupStream2);
324  CPPUNIT_ASSERT_EQUAL(workingDir + "/unsupported.bin.1.bak", backupPath2);
325 
326  // get rid of 2nd backup, recreate original file
327  backupStream2.close();
328  remove(backupPath2.data());
329  file.stream().open(file.path(), ios_base::out);
330  file.stream() << "test2" << endl;
331 
332  // create backup under another location
333  backupDirectory() = "bak";
334  try {
335  createBackupFile(file.path(), backupPath2, file.stream(), backupStream2);
336  CPPUNIT_FAIL("renaming failed because backup dir does not exist");
337  } catch (...) {
338  const char *what = catchIoFailure();
339  CPPUNIT_ASSERT(strstr(what, "Unable to rename original file before rewriting it."));
340  }
341  backupStream2.clear();
342  workingCopyPathMode("bak/unsupported.bin", WorkingCopyMode::NoCopy);
343  createBackupFile(file.path(), backupPath2, file.stream(), backupStream2);
344  CPPUNIT_ASSERT_EQUAL(workingDir + "/bak/unsupported.bin", backupPath2);
345 
346  // get rid of 2nd backup (again)
347  backupStream2.close();
348  CPPUNIT_ASSERT_EQUAL(0, remove(backupPath2.data()));
349  CPPUNIT_ASSERT_EQUAL(0, remove(argsToString(workingDir % '/' + backupDirectory()).data()));
350 
351  // should be able to use backup stream, eg. seek to the end
352  backupStream1.seekg(0, ios_base::end);
353  CPPUNIT_ASSERT_EQUAL(41_st, static_cast<size_t>(backupStream1.tellg()));
354 
355  // restore backup
356  restoreOriginalFileFromBackupFile(file.path(), backupPath1, file.stream(), backupStream1);
357 
358  // check restored backup
359  file.open(true);
360  file.stream().seekg(0x1D);
361  CPPUNIT_ASSERT_EQUAL(0x34_st, static_cast<size_t>(file.stream().get()));
362  file.close();
363 
364  // reset backup dir again
365  backupDirectory().clear();
366 
367  // restore after user aborted
368  createBackupFile(file.path(), backupPath1, file.stream(), backupStream1);
369  try {
371  } catch (...) {
372  Diagnostics diag;
373  CPPUNIT_ASSERT_THROW(
374  handleFailureAfterFileModified(file, backupPath1, file.stream(), backupStream1, diag, "test"), OperationAbortedException);
375  CPPUNIT_ASSERT(diag.level() < DiagLevel::Critical);
376  CPPUNIT_ASSERT(!diag.empty());
377  CPPUNIT_ASSERT_EQUAL("Rewriting the file to apply changed tag information has been aborted."s, diag.front().message());
378  CPPUNIT_ASSERT_EQUAL("The original file has been restored."s, diag.back().message());
379  }
380 
381  // restore after error
382  createBackupFile(file.path(), backupPath1, file.stream(), backupStream1);
383  try {
384  throw Failure();
385  } catch (...) {
386  Diagnostics diag;
387  CPPUNIT_ASSERT_THROW(handleFailureAfterFileModified(file, backupPath1, file.stream(), backupStream1, diag, "test"), Failure);
388  CPPUNIT_ASSERT(diag.level() >= DiagLevel::Critical);
389  CPPUNIT_ASSERT_EQUAL("Rewriting the file to apply changed tag information failed."s, diag.front().message());
390  CPPUNIT_ASSERT_EQUAL("The original file has been restored."s, diag.back().message());
391  }
392 
393  // restore after io failure
394  createBackupFile(file.path(), backupPath1, file.stream(), backupStream1);
395  try {
396  throwIoFailure("simulated IO failure");
397  } catch (...) {
398  Diagnostics diag;
399  try {
400  handleFailureAfterFileModified(file, backupPath1, file.stream(), backupStream1, diag, "test");
401  CPPUNIT_FAIL("IO failure not rethrown");
402  } catch (...) {
403  catchIoFailure();
404  }
405  CPPUNIT_ASSERT(diag.level() >= DiagLevel::Critical);
406  CPPUNIT_ASSERT_EQUAL("An IO error occured when rewriting the file to apply changed tag information."s, diag.front().message());
407  CPPUNIT_ASSERT_EQUAL("The original file has been restored."s, diag.back().message());
408  }
409 
410  CPPUNIT_ASSERT_EQUAL(0, remove(file.path().data()));
411 }
412 #endif
The Margin class defines the four margins of a rectangle.
Definition: margin.h:16
StringType toString() const
Returns the string representation of the current PositionInSet.
std::string toString(const std::function< TagTargetLevel(uint64)> &tagTargetMapping) const
Returns the string representation of the current instance.
Definition: tagtarget.h:201
const char * abbreviation() const
Returns an abbreviation for the current instance, eg.
Definition: size.cpp:9
void updateStepPercentage(byte stepPercentage)
Updates the current step percentage and invokes the second callback specified on construction (or the...
void setWidth(uint32 value)
Sets the width.
Definition: size.h:75
void tearDown()
Definition: utils.cpp:80
The ProgressFeedback class provides feedback about an ongoing operation via callbacks.
void stopIfAborted() const
Throws an OperationAbortedException if aborted.
void testPositionInSet()
Definition: utils.cpp:177
constexpr int32 position() const
Returns the element position of the current instance.
Definition: positioninset.h:76
uint64 level() const
Returns the level.
Definition: tagtarget.h:72
The MediaFormat class specifies the format of media data.
Definition: mediaformat.h:243
STL namespace.
The PositionInSet class describes the position of an element in a set which consists of a certain num...
Definition: positioninset.h:21
void testMargin()
Definition: utils.cpp:137
TAG_PARSER_EXPORT std::string & backupDirectory()
Returns the directory used to store backup files.
The UtilitiesTests class tests various utility classes and functions of the tagparser library...
Definition: utils.cpp:37
void updateStepPercentageFromFraction(double stepPercentage)
Updates the current step percentage and invokes the second callback specified on construction (or the...
The MediaFileInfo class allows to read and write tag information providing a container/tag format ind...
Definition: mediafileinfo.h:44
bool isAborted() const
Returns whether the operation has been aborted via tryToAbort().
void testAspectRatio()
Definition: utils.cpp:145
constexpr int32 total() const
Returns the total element count of the current instance.
Definition: positioninset.h:84
void setHeight(uint32 value)
Sets the height.
Definition: size.h:83
void testDiagnostics()
Definition: utils.cpp:286
The Size class defines the size of a two-dimensional object using integer point precision.
Definition: size.h:16
byte stepPercentage() const
Returns the percentage of the current step (initially 0, supposed to be a value from 0 to 100)...
byte overallPercentage() const
Returns the overall percentage (initially 0, supposed to be a value from 0 to 100).
Contains utility classes helping to read and write streams.
DiagLevel level() const
Returns the worst diag level present in the container.
Definition: diagnostics.cpp:53
TAG_PARSER_EXPORT const char * containerFormatName(ContainerFormat containerFormat)
Returns the name of the specified container format as C-style string.
Definition: signature.cpp:361
const char * extensionName() const
Returns the abbreviation of the media format as C-style string.
void testAbortableProgressFeedback()
Definition: utils.cpp:243
bool isEmpty() const
Returns an indication whether the target is empty.
Definition: tagtarget.h:168
void tryToAbort()
Aborts the operation.
The TagTarget class specifies the target of a tag.
Definition: tagtarget.h:21
TAG_PARSER_EXPORT void restoreOriginalFileFromBackupFile(const std::string &originalPath, const std::string &backupPath, IoUtilities::NativeFileStream &originalStream, IoUtilities::NativeFileStream &backupStream)
TAG_PARSER_EXPORT const char * containerFormatAbbreviation(ContainerFormat containerFormat, MediaType mediaType=MediaType::Unknown, unsigned int version=0)
Returns the abbreviation of the container format as C-style string considering the specified media ty...
Definition: signature.cpp:243
void updateOverallPercentage(byte overallPercentage)
Updates the overall percentage and invokes the second callback specified on construction (or the firs...
void testProgressFeedback()
Definition: utils.cpp:204
void testMediaFormat()
Definition: utils.cpp:159
The AbortableProgressFeedback class provides feedback about an ongoing operation via callbacks...
CPPUNIT_TEST_SUITE_REGISTRATION(UtilitiesTests)
constexpr bool isNull() const
Returns an indication whether both the element position and total element count is 0...
Definition: positioninset.h:92
const char * shortAbbreviation() const
Returns a short abbreviation of the media format as C-style string.
void updateStep(const std::string &step, byte stepPercentage=0)
Updates the current step and invokes the first callback specified on construction.
TAG_PARSER_EXPORT void handleFailureAfterFileModified(MediaFileInfo &mediaFileInfo, const std::string &backupPath, IoUtilities::NativeFileStream &outputStream, IoUtilities::NativeFileStream &backupStream, Diagnostics &diag, const std::string &context="making file")
const char * name() const
Returns the name of the media format as C-style string.
Definition: mediaformat.cpp:17
void testTagTarget()
Definition: utils.cpp:98
const char * abbreviation() const
Returns the abbreviation of the media format as C-style string.
void setUp()
Definition: utils.cpp:76
std::string toString() const
Returns the string representation of the current size.
Definition: size.h:124
bool has(DiagLevel level) const
Returns whether there&#39;s at least one DiagMessage which is at least as worse as level.
Definition: diagnostics.cpp:40
void testSize()
Definition: utils.cpp:84
TAG_PARSER_EXPORT ContainerFormat parseSignature(const char *buffer, int bufferSize)
Parses the signature read from the specified buffer.
Definition: signature.cpp:100
void testSignature()
Definition: utils.cpp:121
const std::string & step() const
Returns the name of the current step (initially empty).
The class inherits from std::exception and serves as base class for exceptions thrown by the elements...
Definition: exceptions.h:11
The exception that is thrown when an operation has been stopped and thus not successfully completed b...
Definition: exceptions.h:39
TAG_PARSER_EXPORT void createBackupFile(const std::string &originalPath, std::string &backupPath, IoUtilities::NativeFileStream &originalStream, IoUtilities::NativeFileStream &backupStream)
TAG_PARSER_EXPORT const char * containerFormatSubversion(ContainerFormat containerFormat)
Returns the subversion of the container format as C-style string.
Definition: signature.cpp:462
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:9
void nextStepOrStop(const std::string &step, byte stepPercentage=0)
Throws an OperationAbortedException if aborted; otherwise the data for the next step is set...
The AspectRatio struct defines an aspect ratio.
Definition: aspectratio.h:10
The Diagnostics class is a container for DiagMessage.
Definition: diagnostics.h:154