1 /* 2 * liquidsfz - sfz sampler 3 * 4 * Copyright (C) 2020-2021 Stefan Westerfeld 5 * 6 * This library is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU Lesser General Public License as published by the 8 * Free Software Foundation; either version 2.1 of the License, or (at your 9 * option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 14 * for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public License 17 * along with this library; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #ifndef LIQUIDSFZ_ARGPARSER_HH 22 #define LIQUIDSFZ_ARGPARSER_HH 23 24 #include <vector> 25 #include <string> 26 27 namespace LiquidSFZInternal 28 { 29 30 class ArgParser 31 { 32 std::vector<std::string> m_args; 33 bool starts_with (const std::string& s, const std::string& start); 34 public: 35 ArgParser (int argc, char **argv); 36 37 bool parse_cmd (const std::string& cmd); 38 bool parse_opt (const std::string& option, std::string& out_s); 39 bool parse_opt (const std::string& option, int& out_i); 40 bool parse_opt (const std::string& option, float& out_f); 41 bool parse_opt (const std::string& option); 42 bool parse_args (size_t expected_count, std::vector<std::string>& out_args); 43 }; 44 45 } 46 47 #endif /* LIQUIDSFZ_ARGPARSER_HH */ 48