Commit 70ceea57e3a6c7d01b6130b55b868a2b4266b3c1
1 parent
37fab4ee
Cleanup uses of inline
Showing
4 changed files
with
27 additions
and
18 deletions
include/cxxopts.hpp
| @@ -908,7 +908,6 @@ namespace cxxopts | @@ -908,7 +908,6 @@ namespace cxxopts | ||
| 908 | { | 908 | { |
| 909 | } | 909 | } |
| 910 | 910 | ||
| 911 | - inline | ||
| 912 | Options& | 911 | Options& |
| 913 | positional_help(std::string help_text) | 912 | positional_help(std::string help_text) |
| 914 | { | 913 | { |
| @@ -916,15 +915,12 @@ namespace cxxopts | @@ -916,15 +915,12 @@ namespace cxxopts | ||
| 916 | return *this; | 915 | return *this; |
| 917 | } | 916 | } |
| 918 | 917 | ||
| 919 | - inline | ||
| 920 | void | 918 | void |
| 921 | parse(int& argc, char**& argv); | 919 | parse(int& argc, char**& argv); |
| 922 | 920 | ||
| 923 | - inline | ||
| 924 | OptionAdder | 921 | OptionAdder |
| 925 | add_options(std::string group = ""); | 922 | add_options(std::string group = ""); |
| 926 | 923 | ||
| 927 | - inline | ||
| 928 | void | 924 | void |
| 929 | add_option | 925 | add_option |
| 930 | ( | 926 | ( |
| @@ -962,29 +958,23 @@ namespace cxxopts | @@ -962,29 +958,23 @@ namespace cxxopts | ||
| 962 | } | 958 | } |
| 963 | 959 | ||
| 964 | //parse positional arguments into the given option | 960 | //parse positional arguments into the given option |
| 965 | - inline | ||
| 966 | void | 961 | void |
| 967 | parse_positional(std::string option); | 962 | parse_positional(std::string option); |
| 968 | 963 | ||
| 969 | - inline | ||
| 970 | void | 964 | void |
| 971 | parse_positional(std::vector<std::string> options); | 965 | parse_positional(std::vector<std::string> options); |
| 972 | 966 | ||
| 973 | - inline | ||
| 974 | std::string | 967 | std::string |
| 975 | help(const std::vector<std::string>& groups = {""}) const; | 968 | help(const std::vector<std::string>& groups = {""}) const; |
| 976 | 969 | ||
| 977 | - inline | ||
| 978 | const std::vector<std::string> | 970 | const std::vector<std::string> |
| 979 | groups() const; | 971 | groups() const; |
| 980 | 972 | ||
| 981 | - inline | ||
| 982 | const HelpGroupDetails& | 973 | const HelpGroupDetails& |
| 983 | group_help(const std::string& group) const; | 974 | group_help(const std::string& group) const; |
| 984 | 975 | ||
| 985 | private: | 976 | private: |
| 986 | 977 | ||
| 987 | - inline | ||
| 988 | void | 978 | void |
| 989 | add_one_option | 979 | add_one_option |
| 990 | ( | 980 | ( |
| @@ -992,15 +982,12 @@ namespace cxxopts | @@ -992,15 +982,12 @@ namespace cxxopts | ||
| 992 | std::shared_ptr<OptionDetails> details | 982 | std::shared_ptr<OptionDetails> details |
| 993 | ); | 983 | ); |
| 994 | 984 | ||
| 995 | - inline | ||
| 996 | bool | 985 | bool |
| 997 | consume_positional(std::string a); | 986 | consume_positional(std::string a); |
| 998 | 987 | ||
| 999 | - inline | ||
| 1000 | void | 988 | void |
| 1001 | add_to_option(const std::string& option, const std::string& arg); | 989 | add_to_option(const std::string& option, const std::string& arg); |
| 1002 | 990 | ||
| 1003 | - inline | ||
| 1004 | void | 991 | void |
| 1005 | parse_option | 992 | parse_option |
| 1006 | ( | 993 | ( |
| @@ -1009,7 +996,6 @@ namespace cxxopts | @@ -1009,7 +996,6 @@ namespace cxxopts | ||
| 1009 | const std::string& arg = "" | 996 | const std::string& arg = "" |
| 1010 | ); | 997 | ); |
| 1011 | 998 | ||
| 1012 | - inline | ||
| 1013 | void | 999 | void |
| 1014 | checked_parse_arg | 1000 | checked_parse_arg |
| 1015 | ( | 1001 | ( |
| @@ -1020,11 +1006,9 @@ namespace cxxopts | @@ -1020,11 +1006,9 @@ namespace cxxopts | ||
| 1020 | const std::string& name | 1006 | const std::string& name |
| 1021 | ); | 1007 | ); |
| 1022 | 1008 | ||
| 1023 | - inline | ||
| 1024 | String | 1009 | String |
| 1025 | help_one_group(const std::string& group) const; | 1010 | help_one_group(const std::string& group) const; |
| 1026 | 1011 | ||
| 1027 | - inline | ||
| 1028 | void | 1012 | void |
| 1029 | generate_group_help | 1013 | generate_group_help |
| 1030 | ( | 1014 | ( |
| @@ -1032,7 +1016,6 @@ namespace cxxopts | @@ -1032,7 +1016,6 @@ namespace cxxopts | ||
| 1032 | const std::vector<std::string>& groups | 1016 | const std::vector<std::string>& groups |
| 1033 | ) const; | 1017 | ) const; |
| 1034 | 1018 | ||
| 1035 | - inline | ||
| 1036 | void | 1019 | void |
| 1037 | generate_all_groups_help(String& result) const; | 1020 | generate_all_groups_help(String& result) const; |
| 1038 | 1021 | ||
| @@ -1058,7 +1041,6 @@ namespace cxxopts | @@ -1058,7 +1041,6 @@ namespace cxxopts | ||
| 1058 | { | 1041 | { |
| 1059 | } | 1042 | } |
| 1060 | 1043 | ||
| 1061 | - inline | ||
| 1062 | OptionAdder& | 1044 | OptionAdder& |
| 1063 | operator() | 1045 | operator() |
| 1064 | ( | 1046 | ( |
| @@ -1209,12 +1191,14 @@ namespace cxxopts | @@ -1209,12 +1191,14 @@ namespace cxxopts | ||
| 1209 | } | 1191 | } |
| 1210 | } | 1192 | } |
| 1211 | 1193 | ||
| 1194 | +inline | ||
| 1212 | OptionAdder | 1195 | OptionAdder |
| 1213 | Options::add_options(std::string group) | 1196 | Options::add_options(std::string group) |
| 1214 | { | 1197 | { |
| 1215 | return OptionAdder(*this, std::move(group)); | 1198 | return OptionAdder(*this, std::move(group)); |
| 1216 | } | 1199 | } |
| 1217 | 1200 | ||
| 1201 | +inline | ||
| 1218 | OptionAdder& | 1202 | OptionAdder& |
| 1219 | OptionAdder::operator() | 1203 | OptionAdder::operator() |
| 1220 | ( | 1204 | ( |
| @@ -1272,6 +1256,7 @@ OptionAdder::operator() | @@ -1272,6 +1256,7 @@ OptionAdder::operator() | ||
| 1272 | return *this; | 1256 | return *this; |
| 1273 | } | 1257 | } |
| 1274 | 1258 | ||
| 1259 | +inline | ||
| 1275 | void | 1260 | void |
| 1276 | Options::parse_option | 1261 | Options::parse_option |
| 1277 | ( | 1262 | ( |
| @@ -1283,6 +1268,7 @@ Options::parse_option | @@ -1283,6 +1268,7 @@ Options::parse_option | ||
| 1283 | value->parse(arg); | 1268 | value->parse(arg); |
| 1284 | } | 1269 | } |
| 1285 | 1270 | ||
| 1271 | +inline | ||
| 1286 | void | 1272 | void |
| 1287 | Options::checked_parse_arg | 1273 | Options::checked_parse_arg |
| 1288 | ( | 1274 | ( |
| @@ -1318,6 +1304,7 @@ Options::checked_parse_arg | @@ -1318,6 +1304,7 @@ Options::checked_parse_arg | ||
| 1318 | } | 1304 | } |
| 1319 | } | 1305 | } |
| 1320 | 1306 | ||
| 1307 | +inline | ||
| 1321 | void | 1308 | void |
| 1322 | Options::add_to_option(const std::string& option, const std::string& arg) | 1309 | Options::add_to_option(const std::string& option, const std::string& arg) |
| 1323 | { | 1310 | { |
| @@ -1331,6 +1318,7 @@ Options::add_to_option(const std::string& option, const std::string& arg) | @@ -1331,6 +1318,7 @@ Options::add_to_option(const std::string& option, const std::string& arg) | ||
| 1331 | parse_option(iter->second, option, arg); | 1318 | parse_option(iter->second, option, arg); |
| 1332 | } | 1319 | } |
| 1333 | 1320 | ||
| 1321 | +inline | ||
| 1334 | bool | 1322 | bool |
| 1335 | Options::consume_positional(std::string a) | 1323 | Options::consume_positional(std::string a) |
| 1336 | { | 1324 | { |
| @@ -1365,12 +1353,14 @@ Options::consume_positional(std::string a) | @@ -1365,12 +1353,14 @@ Options::consume_positional(std::string a) | ||
| 1365 | return false; | 1353 | return false; |
| 1366 | } | 1354 | } |
| 1367 | 1355 | ||
| 1356 | +inline | ||
| 1368 | void | 1357 | void |
| 1369 | Options::parse_positional(std::string option) | 1358 | Options::parse_positional(std::string option) |
| 1370 | { | 1359 | { |
| 1371 | parse_positional(std::vector<std::string>{option}); | 1360 | parse_positional(std::vector<std::string>{option}); |
| 1372 | } | 1361 | } |
| 1373 | 1362 | ||
| 1363 | +inline | ||
| 1374 | void | 1364 | void |
| 1375 | Options::parse_positional(std::vector<std::string> options) | 1365 | Options::parse_positional(std::vector<std::string> options) |
| 1376 | { | 1366 | { |
| @@ -1380,6 +1370,7 @@ Options::parse_positional(std::vector<std::string> options) | @@ -1380,6 +1370,7 @@ Options::parse_positional(std::vector<std::string> options) | ||
| 1380 | m_positional_set.insert(m_positional.begin(), m_positional.end()); | 1370 | m_positional_set.insert(m_positional.begin(), m_positional.end()); |
| 1381 | } | 1371 | } |
| 1382 | 1372 | ||
| 1373 | +inline | ||
| 1383 | void | 1374 | void |
| 1384 | Options::parse(int& argc, char**& argv) | 1375 | Options::parse(int& argc, char**& argv) |
| 1385 | { | 1376 | { |
| @@ -1538,6 +1529,7 @@ Options::parse(int& argc, char**& argv) | @@ -1538,6 +1529,7 @@ Options::parse(int& argc, char**& argv) | ||
| 1538 | 1529 | ||
| 1539 | } | 1530 | } |
| 1540 | 1531 | ||
| 1532 | +inline | ||
| 1541 | void | 1533 | void |
| 1542 | Options::add_option | 1534 | Options::add_option |
| 1543 | ( | 1535 | ( |
| @@ -1573,6 +1565,7 @@ Options::add_option | @@ -1573,6 +1565,7 @@ Options::add_option | ||
| 1573 | value->is_container()}); | 1565 | value->is_container()}); |
| 1574 | } | 1566 | } |
| 1575 | 1567 | ||
| 1568 | +inline | ||
| 1576 | void | 1569 | void |
| 1577 | Options::add_one_option | 1570 | Options::add_one_option |
| 1578 | ( | 1571 | ( |
| @@ -1588,6 +1581,7 @@ Options::add_one_option | @@ -1588,6 +1581,7 @@ Options::add_one_option | ||
| 1588 | } | 1581 | } |
| 1589 | } | 1582 | } |
| 1590 | 1583 | ||
| 1584 | +inline | ||
| 1591 | String | 1585 | String |
| 1592 | Options::help_one_group(const std::string& g) const | 1586 | Options::help_one_group(const std::string& g) const |
| 1593 | { | 1587 | { |
| @@ -1658,6 +1652,7 @@ Options::help_one_group(const std::string& g) const | @@ -1658,6 +1652,7 @@ Options::help_one_group(const std::string& g) const | ||
| 1658 | return result; | 1652 | return result; |
| 1659 | } | 1653 | } |
| 1660 | 1654 | ||
| 1655 | +inline | ||
| 1661 | void | 1656 | void |
| 1662 | Options::generate_group_help | 1657 | Options::generate_group_help |
| 1663 | ( | 1658 | ( |
| @@ -1680,6 +1675,7 @@ Options::generate_group_help | @@ -1680,6 +1675,7 @@ Options::generate_group_help | ||
| 1680 | } | 1675 | } |
| 1681 | } | 1676 | } |
| 1682 | 1677 | ||
| 1678 | +inline | ||
| 1683 | void | 1679 | void |
| 1684 | Options::generate_all_groups_help(String& result) const | 1680 | Options::generate_all_groups_help(String& result) const |
| 1685 | { | 1681 | { |
| @@ -1694,6 +1690,7 @@ Options::generate_all_groups_help(String& result) const | @@ -1694,6 +1690,7 @@ Options::generate_all_groups_help(String& result) const | ||
| 1694 | generate_group_help(result, all_groups); | 1690 | generate_group_help(result, all_groups); |
| 1695 | } | 1691 | } |
| 1696 | 1692 | ||
| 1693 | +inline | ||
| 1697 | std::string | 1694 | std::string |
| 1698 | Options::help(const std::vector<std::string>& help_groups) const | 1695 | Options::help(const std::vector<std::string>& help_groups) const |
| 1699 | { | 1696 | { |
| @@ -1718,6 +1715,7 @@ Options::help(const std::vector<std::string>& help_groups) const | @@ -1718,6 +1715,7 @@ Options::help(const std::vector<std::string>& help_groups) const | ||
| 1718 | return toUTF8String(result); | 1715 | return toUTF8String(result); |
| 1719 | } | 1716 | } |
| 1720 | 1717 | ||
| 1718 | +inline | ||
| 1721 | const std::vector<std::string> | 1719 | const std::vector<std::string> |
| 1722 | Options::groups() const | 1720 | Options::groups() const |
| 1723 | { | 1721 | { |
| @@ -1736,6 +1734,7 @@ Options::groups() const | @@ -1736,6 +1734,7 @@ Options::groups() const | ||
| 1736 | return g; | 1734 | return g; |
| 1737 | } | 1735 | } |
| 1738 | 1736 | ||
| 1737 | +inline | ||
| 1739 | const HelpGroupDetails& | 1738 | const HelpGroupDetails& |
| 1740 | Options::group_help(const std::string& group) const | 1739 | Options::group_help(const std::string& group) const |
| 1741 | { | 1740 | { |
test/CMakeLists.txt
| @@ -29,4 +29,7 @@ if (CXXOPTS_BUILD_TESTS) | @@ -29,4 +29,7 @@ if (CXXOPTS_BUILD_TESTS) | ||
| 29 | "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" | 29 | "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" |
| 30 | "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" | 30 | "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" |
| 31 | ) | 31 | ) |
| 32 | + | ||
| 33 | + add_executable(link_test link_a.cpp link_b.cpp) | ||
| 34 | + target_link_libraries(link_test cxxopts) | ||
| 32 | endif() | 35 | endif() |
test/link_a.cpp
0 → 100644
test/link_b.cpp
0 → 100644
| 1 | +#include <cxxopts.hpp> |