diff options
Diffstat (limited to 'plugins/PluginComponents_v_1_0_x.h')
-rw-r--r-- | plugins/PluginComponents_v_1_0_x.h | 184 |
1 files changed, 87 insertions, 97 deletions
diff --git a/plugins/PluginComponents_v_1_0_x.h b/plugins/PluginComponents_v_1_0_x.h index 628283f22..8448b8ad4 100644 --- a/plugins/PluginComponents_v_1_0_x.h +++ b/plugins/PluginComponents_v_1_0_x.h @@ -8,32 +8,32 @@ #ifndef MUMBLE_PLUGINCOMPONENT_H_ #define MUMBLE_PLUGINCOMPONENT_H_ -#include <stdint.h> -#include <stddef.h> #include <stdbool.h> +#include <stddef.h> +#include <stdint.h> #ifdef __cplusplus # include <string> #endif #ifdef QT_VERSION - #include <QString> +# include <QString> #endif // define the calling convention macro based on the compiler being used #if defined(_MSC_VER) - #define PLUGIN_CALLING_CONVENTION __cdecl +# define PLUGIN_CALLING_CONVENTION __cdecl #elif defined(__MINGW32__) - #define PLUGIN_CALLING_CONVENTION __attribute__((cdecl)) +# define PLUGIN_CALLING_CONVENTION __attribute__((cdecl)) #else - #define PLUGIN_CALLING_CONVENTION +# define PLUGIN_CALLING_CONVENTION #endif /// A macro holding the exit status of a successful operation #define STATUS_OK EC_OK /// A macro holding the version object that is considered to correspond to an unknown version -#define VERSION_UNKNOWN Version({0,0,0}) +#define VERSION_UNKNOWN Version({ 0, 0, 0 }) /// This enum's values correspond to special feature sets a plugin may provide. @@ -48,30 +48,19 @@ enum Mumble_PluginFeature { }; /// This enum's values represent talking states a user can be in when using Mumble. -enum Mumble_TalkingState { - INVALID=-1, - PASSIVE=0, - TALKING, - WHISPERING, - SHOUTING, - TALKING_MUTED -}; +enum Mumble_TalkingState { INVALID = -1, PASSIVE = 0, TALKING, WHISPERING, SHOUTING, TALKING_MUTED }; /// This enum's values represent transmission modes a user might have configured. Transmission mode /// in this context is referring to a method that determines when a user is speaking and thus when /// to transmit audio packets. -enum Mumble_TransmissionMode { - TM_CONTINOUS, - TM_VOICE_ACTIVATION, - TM_PUSH_TO_TALK -}; +enum Mumble_TransmissionMode { TM_CONTINOUS, TM_VOICE_ACTIVATION, TM_PUSH_TO_TALK }; /// This enum's values represent the error codes that are being used by the MumbleAPI. /// You can get a string-representation for each error code via the errorMessage function. enum Mumble_ErrorCode { EC_INTERNAL_ERROR = -2, - EC_GENERIC_ERROR = -1, - EC_OK = 0, + EC_GENERIC_ERROR = -1, + EC_OK = 0, EC_POINTER_NOT_FOUND, EC_NO_ACTIVE_CONNECTION, EC_USER_NOT_FOUND, @@ -106,45 +95,45 @@ enum Mumble_PositionalDataErrorCode { /// This enum's values represent keys for specific settings inside Mumble. enum Mumble_SettingsKey { - MSK_INVALID = -1, - MSK_AUDIO_INPUT_VOICE_HOLD = 0, + MSK_INVALID = -1, + MSK_AUDIO_INPUT_VOICE_HOLD = 0, MSK_AUDIO_INPUT_VAD_SILENCE_THRESHOLD = 1, - MSK_AUDIO_INPUT_VAD_SPEECH_THRESHOLD = 2, - MSK_AUDIO_OUTPUT_PA_MINIMUM_DISTANCE = 3, - MSK_AUDIO_OUTPUT_PA_MAXIMUM_DISTANCE = 4, - MSK_AUDIO_OUTPUT_PA_BLOOM = 5, - MSK_AUDIO_OUTPUT_PA_MINIMUM_VOLUME = 6, + MSK_AUDIO_INPUT_VAD_SPEECH_THRESHOLD = 2, + MSK_AUDIO_OUTPUT_PA_MINIMUM_DISTANCE = 3, + MSK_AUDIO_OUTPUT_PA_MAXIMUM_DISTANCE = 4, + MSK_AUDIO_OUTPUT_PA_BLOOM = 5, + MSK_AUDIO_OUTPUT_PA_MINIMUM_VOLUME = 6, }; /// This enum's values represent the key-codes Mumble's API uses to reference keys on the keyboard. enum Mumble_KeyCode { - KC_INVALID = -1, + KC_INVALID = -1, // Non-printable characters first - KC_NULL = 0, - KC_END = 1, - KC_LEFT = 2, - KC_RIGHT = 4, - KC_UP = 5, - KC_DOWN = 6, - KC_DELETE = 7, - KC_BACKSPACE = 8, - KC_TAB = 9, - KC_ENTER = 10, // == '\n' - KC_ESCAPE = 27, - KC_PAGE_UP = 11, - KC_PAGE_DOWN = 12, - KC_SHIFT = 13, - KC_CONTROL = 14, - KC_META = 15, - KC_ALT = 16, - KC_ALT_GR = 17, - KC_CAPSLOCK = 18, - KC_NUMLOCK = 19, - KC_SUPER = 20, // == windows key - KC_HOME = 21, // == Pos1 - KC_PRINT = 22, - KC_SCROLLLOCK = 23, + KC_NULL = 0, + KC_END = 1, + KC_LEFT = 2, + KC_RIGHT = 4, + KC_UP = 5, + KC_DOWN = 6, + KC_DELETE = 7, + KC_BACKSPACE = 8, + KC_TAB = 9, + KC_ENTER = 10, // == '\n' + KC_ESCAPE = 27, + KC_PAGE_UP = 11, + KC_PAGE_DOWN = 12, + KC_SHIFT = 13, + KC_CONTROL = 14, + KC_META = 15, + KC_ALT = 16, + KC_ALT_GR = 17, + KC_CAPSLOCK = 18, + KC_NUMLOCK = 19, + KC_SUPER = 20, // == windows key + KC_HOME = 21, // == Pos1 + KC_PRINT = 22, + KC_SCROLLLOCK = 23, // Printable characters are assigned to their ASCII code KC_SPACE = ' ', @@ -207,43 +196,43 @@ enum Mumble_KeyCode { KC_Y = 'Y', KC_Z = 'Z', // leave out lowercase letters (for now) - KC_OPEN_BRACKET = '[', - KC_BACKSLASH = '\\', - KC_CLOSE_BRACKET = ']', - KC_CIRCUMFLEX = '^', - KC_UNDERSCORE = '_', - KC_GRAVE_AKCENT = '`', - KC_OPEN_BRACE = '{', - KC_VERTICAL_BAR = '|', - KC_CLOSE_BRACE = '}', - KC_TILDE = '~', + KC_OPEN_BRACKET = '[', + KC_BACKSLASH = '\\', + KC_CLOSE_BRACKET = ']', + KC_CIRCUMFLEX = '^', + KC_UNDERSCORE = '_', + KC_GRAVE_AKCENT = '`', + KC_OPEN_BRACE = '{', + KC_VERTICAL_BAR = '|', + KC_CLOSE_BRACE = '}', + KC_TILDE = '~', // Some characters from the extended ASCII code - KC_DEGREE_SIGN = 176, + KC_DEGREE_SIGN = 176, // F-keys // Start at a value of 256 as extended ASCII codes range up to 255 - KC_F1 = 256, - KC_F2 = 257, - KC_F3 = 258, - KC_F4 = 259, - KC_F5 = 260, - KC_F6 = 261, - KC_F7 = 262, - KC_F8 = 263, - KC_F9 = 264, - KC_F10 = 265, - KC_F11 = 266, - KC_F12 = 267, - KC_F13 = 268, - KC_F14 = 269, - KC_F15 = 270, - KC_F16 = 271, - KC_F17 = 272, - KC_F18 = 273, - KC_F19 = 274, + KC_F1 = 256, + KC_F2 = 257, + KC_F3 = 258, + KC_F4 = 259, + KC_F5 = 260, + KC_F6 = 261, + KC_F7 = 262, + KC_F8 = 263, + KC_F9 = 264, + KC_F10 = 265, + KC_F11 = 266, + KC_F12 = 267, + KC_F13 = 268, + KC_F14 = 269, + KC_F15 = 270, + KC_F16 = 271, + KC_F17 = 272, + KC_F18 = 273, + KC_F19 = 274, }; /// A struct for representing a version of the form major.minor.patch @@ -252,7 +241,7 @@ struct Version { int32_t minor; int32_t patch; #ifdef __cplusplus - bool operator<(const Version& other) const { + bool operator<(const Version &other) const { if (this->major != other.major) { return this->major < other.major; } @@ -263,7 +252,7 @@ struct Version { return this->patch < other.patch; } - bool operator>(const Version& other) const { + bool operator>(const Version &other) const { if (this->major != other.major) { return this->major > other.major; } @@ -274,7 +263,7 @@ struct Version { return this->patch > other.patch; } - bool operator>=(const Version& other) const { + bool operator>=(const Version &other) const { if (this->major != other.major) { return this->major > other.major; } @@ -285,7 +274,7 @@ struct Version { return this->patch >= other.patch; } - bool operator<=(const Version& other) const { + bool operator<=(const Version &other) const { if (this->major != other.major) { return this->major < other.major; } @@ -296,36 +285,37 @@ struct Version { return this->patch <= other.patch; } - bool operator==(const Version& other) const { + bool operator==(const Version &other) const { return this->major == other.major && this->minor == other.minor && this->patch == other.patch; } - bool operator!=(const Version& other) const { + bool operator!=(const Version &other) const { return this->major != other.major || this->minor != other.minor || this->patch != other.patch; } operator std::string() const { - return std::string("v") + std::to_string(this->major) + std::string(".") + std::to_string(this->minor) + std::string(".") + std::to_string(this->patch); + return std::string("v") + std::to_string(this->major) + std::string(".") + std::to_string(this->minor) + + std::string(".") + std::to_string(this->patch); } -#ifdef QT_VERSION +# ifdef QT_VERSION operator QString() const { return QString::fromLatin1("v%0.%1.%2").arg(this->major).arg(this->minor).arg(this->patch); } -#endif +# endif #endif }; -/// Obtains a String representation for the given numeric error code. +/// Obtains a String representation for the given numeric error code. /// Note that the exact String representation corresponding to an error code may change and is thus /// not part of the plugin API as such. This function acts merely as a convenience helper for printing /// errors in a meaningful way. /// /// @param errorCode The error code to get the String representation for /// @returns The error message coresponding to the given error code. The message -/// is encoded as a C-string and is static, meaning that it is safe to use the -/// returned pointer in your code. -inline const char* errorMessage(int16_t errorCode) { +/// is encoded as a C-string and is static, meaning that it is safe to use the +/// returned pointer in your code. +inline const char *errorMessage(int16_t errorCode) { switch (errorCode) { case EC_GENERIC_ERROR: return "Generic error"; |