Files
MapLibreParticleLab/include/mbgl/platform/event.hpp
John Firebaugh 282e626ac1 [core] Make enum ↔ string conversion more generic-friendly
Rewrite enum.hpp in such a way that parseConstant can be defined generically for all enumerated types.

While there, properly validated enumerated property values.
2016-06-13 17:22:05 -07:00

59 lines
955 B
C++

#pragma once
#include <cstdint>
namespace mbgl {
enum class EventSeverity : uint8_t {
Debug,
Info,
Warning,
Error,
};
enum class Event : uint8_t {
General,
Setup,
Shader,
ParseStyle,
ParseTile,
Render,
Style,
Database,
HttpRequest,
Sprite,
Image,
OpenGL,
JNI,
Android,
Crash,
Glyph,
};
struct EventPermutation {
const EventSeverity severity;
const Event event;
constexpr bool operator==(const EventPermutation &rhs) const {
return severity == rhs.severity && event == rhs.event;
}
};
constexpr EventSeverity disabledEventSeverities[] = {
#if DEBUG
EventSeverity(-1) // Avoid zero size array
#else
EventSeverity::Debug
#endif
};
constexpr Event disabledEvents[] = {
Event(-1) // Avoid zero size array
};
constexpr EventPermutation disabledEventPermutations[] = {
{ EventSeverity::Debug, Event::Shader }
};
} // namespace mbgl