Add noexcept specifiers to keyboard_input functions

This commit is contained in:
Vasily
2019-05-25 18:49:42 +02:00
committed by username223
parent f72e1b2541
commit 2c0f49d8d6
2 changed files with 7 additions and 6 deletions
+6 -5
View File
@@ -1,6 +1,6 @@
#include "input_parser.h" #include "input_parser.h"
std::optional<Token> getModifier( const char& character ) std::optional<Token> getModifier( const char& character ) noexcept
{ {
switch ( character ) switch ( character )
{ {
@@ -19,7 +19,7 @@ std::optional<Token> getModifier( const char& character )
} }
} }
std::optional<Token> getNumberOrLetter( const char& character ) std::optional<Token> getNumberOrLetter( const char& character ) noexcept
{ {
if ( islower( character ) || isdigit( character ) ) if ( islower( character ) || isdigit( character ) )
{ {
@@ -28,7 +28,7 @@ std::optional<Token> getNumberOrLetter( const char& character )
return std::nullopt; return std::nullopt;
} }
std::optional<Token> getFunctionNumber( const char& character ) std::optional<Token> getFunctionNumber( const char& character ) noexcept
{ {
switch ( character ) switch ( character )
{ {
@@ -57,7 +57,7 @@ std::optional<Token> getFunctionNumber( const char& character )
} }
} }
std::optional<Token> checkIfLegalCapitalLiteral( std::string input ) std::optional<Token> checkIfLegalCapitalLiteral( std::string input ) noexcept
{ {
// C++ can't do string comparisons in switches. :( // C++ can't do string comparisons in switches. :(
if ( input == "BACKSPACE" ) if ( input == "BACKSPACE" )
@@ -149,7 +149,8 @@ std::optional<Token> checkIfLegalCapitalLiteral( std::string input )
return std::nullopt; return std::nullopt;
} }
std::vector<Token> ParseKeyboardInputsToTokens( const std::string inputs ) std::vector<Token>
ParseKeyboardInputsToTokens( const std::string inputs ) noexcept
{ {
std::vector<Token> tokens{}; std::vector<Token> tokens{};
+1 -1
View File
@@ -88,4 +88,4 @@ enum class Token
MODIFIER_SUPER, MODIFIER_SUPER,
}; };
std::vector<Token> ParseKeyboardInputsToTokens( std::string inputs ); std::vector<Token> ParseKeyboardInputsToTokens( std::string inputs ) noexcept;