1 // Copyright 2016-2017 the nyan authors, LGPLv3+. See copying.md for legal info. 2 #pragma once 3 4 5 #include <unordered_map> 6 7 namespace nyan { 8 9 /** 10 * boolean flags to be set by cmdline options 11 */ 12 enum class option_flag { 13 ECHO, 14 TEST_PARSER 15 }; 16 17 /** 18 * string arguments to be set by cmdline options 19 */ 20 enum class option_param { 21 FILE 22 }; 23 24 using flags_t = std::unordered_map<option_flag, bool>; 25 using params_t = std::unordered_map<option_param, std::string>; 26 27 28 /** 29 * Run the nyan tool. 30 */ 31 int run(flags_t, params_t); 32 33 /** 34 * Display the tool help. 35 */ 36 void help(); 37 38 39 } // namespace nyan 40 41 namespace std { 42 43 /** 44 * Hash for the option_flag enum class. Fak u C++! 45 */ 46 template<> 47 struct hash<nyan::option_flag> { 48 size_t operator ()(const nyan::option_flag &x) const { 49 return static_cast<size_t>(x); 50 } 51 }; 52 53 /** 54 * Hash for the option_param enum class. Fak u C++! 55 */ 56 template<> 57 struct hash<nyan::option_param> { 58 size_t operator ()(const nyan::option_param &x) const { 59 return static_cast<size_t>(x); 60 } 61 }; 62 63 } // namespace std 64