Skip to content

Commit

Permalink
Configuration commands are now case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomilist committed Sep 13, 2022
1 parent 5aac03a commit 34dcdff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 27 deletions.
2 changes: 1 addition & 1 deletion clip
Submodule clip updated 2 files
+3 −1 CMakeLists.txt
+8 −3 clip_win_wic.h
13 changes: 13 additions & 0 deletions include/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace mcon

void Settings::UpdateSettings(String a_console_input, bool a_user_triggered)
{
ToLowerCase(a_console_input);

lexer.character_stream->Read(a_console_input);
lexer.Scan();

Expand Down Expand Up @@ -338,4 +340,15 @@ namespace mcon

return;
}

void Settings::ToLowerCase(String& a_string)
{
#ifdef WIN32
std::transform(a_string.begin(), a_string.end(), a_string.begin(), std::towlower);
#else
std::transform(a_string.begin(), a_string.end(), a_string.begin(), std::tolower);
#endif

return;
}
}
28 changes: 2 additions & 26 deletions include/Settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <memory>
#include <unordered_map>
#include <fstream>
#include <cwctype>

// Definitions and forward declarations
#include "Definitions.hpp"
Expand Down Expand Up @@ -98,6 +99,7 @@ namespace mcon
void PrintHelp();
void Download();
void ShowGuide();
void ToLowerCase(String& a_string);

std::unique_ptr<CharacterStream> character_stream = std::make_unique<CharacterStream>();
std::shared_ptr<CharacterSet> character_set = std::make_shared<CharacterSet>();
Expand Down Expand Up @@ -188,30 +190,17 @@ namespace mcon

const std::unordered_map<String, InputLanguage> input_language_settings =
{
{STR("Mathcad"), InputLanguage::Mathcad},
{STR("mathcad"), InputLanguage::Mathcad},
/*
{STR("LaTeX"), InputLanguage::Latex},
{STR("Latex"), InputLanguage::Latex},
{STR("latex"), InputLanguage::Latex},
{STR("UnicodeMath"), InputLanguage::UnicodeMath},
{STR("unicodemath"), InputLanguage::UnicodeMath},
{STR("Unicode"), InputLanguage::UnicodeMath},
{STR("unicode"), InputLanguage::UnicodeMath},
{STR("AsciiMath"), InputLanguage::AsciiMath},
{STR("asciimath"), InputLanguage::AsciiMath},
{STR("Ascii"), InputLanguage::AsciiMath},
{STR("ASCII"), InputLanguage::AsciiMath},
{STR("ascii"), InputLanguage::AsciiMath},
{STR("MathML"), InputLanguage::MathML},
{STR("mathml"), InputLanguage::MathML},
{STR("Mathematica"), InputLanguage::Mathematica},
{STR("mathematica"), InputLanguage::Mathematica},
{STR("Excel"), InputLanguage::Excel},
{STR("excel"), InputLanguage::Excel},
{STR("MathJSON"), InputLanguage::MathJSON},
{STR("mathjson"), InputLanguage::MathJSON},
{STR("JSON"), InputLanguage::MathJSON},
{STR("json"), InputLanguage::MathJSON},
*/
};
Expand All @@ -232,30 +221,17 @@ namespace mcon

const std::unordered_map<String, OutputLanguage> output_language_settings =
{
{STR("Mathcad"), OutputLanguage::Mathcad},
{STR("mathcad"), OutputLanguage::Mathcad},
{STR("LaTeX"), OutputLanguage::Latex},
{STR("Latex"), OutputLanguage::Latex},
{STR("latex"), OutputLanguage::Latex},
{STR("MathML"), OutputLanguage::MathML},
{STR("mathml"), OutputLanguage::MathML},
{STR("UnicodeMath"), OutputLanguage::UnicodeMath},
{STR("unicodemath"), OutputLanguage::UnicodeMath},
{STR("Unicode"), OutputLanguage::UnicodeMath},
{STR("unicode"), OutputLanguage::UnicodeMath},
/*
{STR("AsciiMath"), OutputLanguage::AsciiMath},
{STR("asciimath"), OutputLanguage::AsciiMath},
{STR("Ascii"), OutputLanguage::AsciiMath},
{STR("ASCII"), OutputLanguage::AsciiMath},
{STR("ascii"), OutputLanguage::AsciiMath},
{STR("Mathematica"), OutputLanguage::Mathematica},
{STR("mathematica"), OutputLanguage::Mathematica},
{STR("Excel"), OutputLanguage::Excel},
{STR("excel"), OutputLanguage::Excel},
{STR("MathJSON"), OutputLanguage::MathJSON},
{STR("mathjson"), OutputLanguage::MathJSON},
{STR("JSON"), OutputLanguage::MathJSON},
{STR("json"), OutputLanguage::MathJSON},
*/
};
Expand Down

0 comments on commit 34dcdff

Please sign in to comment.