Commit 70ceea57e3a6c7d01b6130b55b868a2b4266b3c1

Authored by Jarryd Beck
1 parent 37fab4ee

Cleanup uses of inline

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