Browse Source

Trade: add *{Importer,Converter}Flag::Quiet.

A counterpart / inverse to Verbose, is meant to be used by plugins to
suppress all warnings.

This flag was already used by the ShaderConverter APIs. Fonts don't have
any flags (and don't have any verbose output or warnings at the moment
either), so there it isn't added; audio importers are in a maintenance
mode with no new features added as I'll be eventually merging them with
the general importer interface in Trade.
pull/617/head
Vladimír Vondruš 3 years ago
parent
commit
ad6b9a4061
  1. 2
      src/Magnum/Trade/AbstractImageConverter.cpp
  2. 12
      src/Magnum/Trade/AbstractImageConverter.h
  3. 2
      src/Magnum/Trade/AbstractImporter.cpp
  4. 12
      src/Magnum/Trade/AbstractImporter.h
  5. 2
      src/Magnum/Trade/AbstractSceneConverter.cpp
  6. 11
      src/Magnum/Trade/AbstractSceneConverter.h

2
src/Magnum/Trade/AbstractImageConverter.cpp

@ -1365,6 +1365,7 @@ Debug& operator<<(Debug& debug, const ImageConverterFlag value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(v) case ImageConverterFlag::v: return debug << "::" #v;
_c(Quiet)
_c(Verbose)
#undef _c
/* LCOV_EXCL_STOP */
@ -1375,6 +1376,7 @@ Debug& operator<<(Debug& debug, const ImageConverterFlag value) {
Debug& operator<<(Debug& debug, const ImageConverterFlags value) {
return Containers::enumSetDebugOutput(debug, value, "Trade::ImageConverterFlags{}", {
ImageConverterFlag::Quiet,
ImageConverterFlag::Verbose});
}

12
src/Magnum/Trade/AbstractImageConverter.h

@ -387,6 +387,13 @@ MAGNUM_TRADE_EXPORT Debug& operator<<(Debug& debug, ImageConverterFeatures value
@see @ref ImageConverterFlags, @ref AbstractImageConverter::setFlags()
*/
enum class ImageConverterFlag: UnsignedByte {
/**
* Suppress warnings, print just errors. By default the converter prints
* both warnings and errors.
* @m_since_latest
*/
Quiet = 1 << 1,
/**
* Print verbose diagnostic during conversion. By default the converter
* only prints messages on error or when some operation might cause
@ -398,6 +405,11 @@ enum class ImageConverterFlag: UnsignedByte {
*/
Verbose = 1 << 0
/** @todo is warning as error (like in ShaderConverter) usable for anything
here? in case of a compiler it makes sense, in case of an importer not
so much probably? it'd also mean expanding each and every Warning
print (using Error, adding a return) which is a lot to maintain */
/** @todo ~~Y flip~~ Y up */
};

2
src/Magnum/Trade/AbstractImporter.cpp

@ -1649,6 +1649,7 @@ Debug& operator<<(Debug& debug, const ImporterFlag value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(v) case ImporterFlag::v: return debug << "::" #v;
_c(Quiet)
_c(Verbose)
#undef _c
/* LCOV_EXCL_STOP */
@ -1659,6 +1660,7 @@ Debug& operator<<(Debug& debug, const ImporterFlag value) {
Debug& operator<<(Debug& debug, const ImporterFlags value) {
return Containers::enumSetDebugOutput(debug, value, "Trade::ImporterFlags{}", {
ImporterFlag::Quiet,
ImporterFlag::Verbose});
}

12
src/Magnum/Trade/AbstractImporter.h

@ -105,6 +105,13 @@ typedef CORRADE_DEPRECATED("use InputFileCallbackPolicy instead") InputFileCallb
@see @ref ImporterFlags, @ref AbstractImporter::setFlags()
*/
enum class ImporterFlag: UnsignedByte {
/**
* Suppress warnings, print just errors. By default the converter prints
* both warnings and errors.
* @m_since_latest
*/
Quiet = 1 << 1,
/**
* Print verbose diagnostic during import. By default the importer only
* prints messages on error or when some operation might cause unexpected
@ -117,6 +124,11 @@ enum class ImporterFlag: UnsignedByte {
*/
Verbose = 1 << 0,
/** @todo is warning as error (like in ShaderConverter) usable for anything
here? in case of a compiler it makes sense, in case of an importer not
so much probably? it'd also mean expanding each and every Warning
print (using Error, adding a return) which is a lot to maintain */
/** @todo ~~Y flip~~ Y up for images, "I want to import just once, don't copy" ... */
};

2
src/Magnum/Trade/AbstractSceneConverter.cpp

@ -1756,6 +1756,7 @@ Debug& operator<<(Debug& debug, const SceneConverterFlag value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(v) case SceneConverterFlag::v: return debug << "::" #v;
_c(Quiet)
_c(Verbose)
#undef _c
/* LCOV_EXCL_STOP */
@ -1766,6 +1767,7 @@ Debug& operator<<(Debug& debug, const SceneConverterFlag value) {
Debug& operator<<(Debug& debug, const SceneConverterFlags value) {
return Containers::enumSetDebugOutput(debug, value, "Trade::SceneConverterFlags{}", {
SceneConverterFlag::Quiet,
SceneConverterFlag::Verbose});
}

11
src/Magnum/Trade/AbstractSceneConverter.h

@ -287,6 +287,12 @@ MAGNUM_TRADE_EXPORT Debug& operator<<(Debug& debug, SceneConverterFeatures value
@see @ref SceneConverterFlags, @ref AbstractSceneConverter::setFlags()
*/
enum class SceneConverterFlag: UnsignedByte {
/**
* Suppress warnings, print just errors. By default the converter prints
* both warnings and errors.
*/
Quiet = 1 << 1,
/**
* Print verbose diagnostic during conversion. By default the converter
* only prints messages on error or when some operation might cause
@ -297,6 +303,11 @@ enum class SceneConverterFlag: UnsignedByte {
*/
Verbose = 1 << 0
/** @todo is warning as error (like in ShaderConverter) usable for anything
here? in case of a compiler it makes sense, in case of an importer not
so much probably? it'd also mean expanding each and every Warning
print (using Error, adding a return) which is a lot to maintain */
/** @todo Y flip */
};

Loading…
Cancel
Save