Skip to content

Commit

Permalink
Merge pull request #131 from gvansickle/feature/129-update-to-optionp…
Browse files Browse the repository at this point in the history
…arser-17

Feature/129 update to optionparser 17
  • Loading branch information
gvansickle authored Aug 22, 2022
2 parents 2b6b1f9 + a159d7b commit bac6682
Show file tree
Hide file tree
Showing 17 changed files with 2,510 additions and 1,834 deletions.
12 changes: 5 additions & 7 deletions src/ArgParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <libext/cpuidex.hpp>

// Std C++.
#include <locale>
#include <algorithm>
#include <vector>
Expand Down Expand Up @@ -264,8 +265,9 @@ struct PreDescriptor


constexpr PreDescriptor(unsigned index, int type, const char *const shortopts, const char *const longopts,
const lmcppop::CheckArg c, const char *h) noexcept
: m_index(index), m_type(type), m_shortopts(shortopts), m_longopts(longopts), m_argname(""), m_check_arg(c), m_help(h)
const lmcppop::CheckArg check_arg, const char *help) noexcept
: m_index(index), m_type(type), m_shortopts(shortopts), m_longopts(longopts), m_argname(""), m_check_arg(
check_arg), m_help(help)
{
};

Expand Down Expand Up @@ -593,10 +595,6 @@ ArgParse::ArgParse(TypeManager &type_manager)
dynamic_usage.push_back(PreDescriptor::NullEntry());
}

ArgParse::~ArgParse()
{
}


/**
* Why? There's a legitimate reason, honestly:
Expand Down Expand Up @@ -991,7 +989,7 @@ void ArgParse::PrintHelpTypes() const
std::cout << std::endl;
}

void ArgParse::FindAndParseConfigFiles(std::vector<char*> */*global_argv*/, std::vector<char*> *user_argv, std::vector<char*> *project_argv)
void ArgParse::FindAndParseConfigFiles(std::vector<char*> */*global_argv*/, std::vector<char*> *user_argv, std::vector<char*> *project_argv) const
{
// Find and parse the global config file.
/// @todo
Expand Down
11 changes: 3 additions & 8 deletions src/ArgParse.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <config.h>

// Std C++.
#include <stdexcept>
#include <string>
#include <vector>
Expand Down Expand Up @@ -49,7 +50,7 @@ class ArgParse
{
public:
explicit ArgParse(TypeManager &tm);
~ArgParse();
~ArgParse() = default;

/**
* Parse the given command line.
Expand All @@ -73,12 +74,6 @@ class ArgParse
/// Reference to the TypeManager passed into the constructor.
TypeManager &m_type_manager;

/// The argp struct we'll pass to arg_parse() from the GNU argp library.
static struct argp argp;

/// The callback which receives the parsed options.
//static error_t parse_opt (int key, char *arg, struct argp_state *state);

void PrintHelpTypes() const;

[[nodiscard]] static std::string GetProjectRCFilename() ;
Expand All @@ -94,7 +89,7 @@ class ArgParse
*/
static std::vector<char *> ConvertRCFileToArgv(const File &f);

void FindAndParseConfigFiles(std::vector<char*> *global_argv, std::vector<char*> *user_argv, std::vector<char*> *project_argv);
void FindAndParseConfigFiles(std::vector<char*> *global_argv, std::vector<char*> *user_argv, std::vector<char*> *project_argv) const;

void HandleTYPELogic(std::vector<char *> *v);

Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ libsrc_la_SOURCES = \
sync_queue_impl_selector.h \
TypeManager.cpp TypeManager.h

libsrc_la_CPPFLAGS = -I $(srcdir)/../third_party/optionparser-1.4/src $(AM_CPPFLAGS)
libsrc_la_CPPFLAGS = -I $(srcdir)/../third_party/optionparser-1.7/src $(AM_CPPFLAGS)
libsrc_la_CFLAGS = $(AM_CFLAGS) $(PCRE_CFLAGS) $(PCRE2_CFLAGS)
libsrc_la_CXXFLAGS = $(AM_CXXFLAGS) $(PCRE_CFLAGS) $(PCRE2_CFLAGS)
libsrc_la_LIBADD =
Expand Down
26 changes: 14 additions & 12 deletions third_party/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,22 @@ check_LTLIBRARIES =
### The Lean Mean C++ Option Parser
###

LMCPPOP_RELEASE_NO = 1.7

# This is a header-only library. We just need to rig things up so it gets distributed.
EXTRA_DIST += \
optionparser-1.4/DoxygenLayout.xml \
optionparser-1.4/README_ARGC_ARGV \
optionparser-1.4/src/printUsage.h \
optionparser-1.4/src/example.cpp \
optionparser-1.4/src/testodr1.cc \
optionparser-1.4/src/testprintusage.cpp \
optionparser-1.4/src/example_arg.cc \
optionparser-1.4/src/testodr2.cc \
optionparser-1.4/src/testparse.cpp \
optionparser-1.4/src/Makefile \
optionparser-1.4/src/optionparser.h \
optionparser-1.4/Doxyfile
optionparser-$(LMCPPOP_RELEASE_NO)/DoxygenLayout.xml \
optionparser-$(LMCPPOP_RELEASE_NO)/README_ARGC_ARGV \
optionparser-$(LMCPPOP_RELEASE_NO)/src/printUsage.h \
optionparser-$(LMCPPOP_RELEASE_NO)/src/example.cpp \
optionparser-$(LMCPPOP_RELEASE_NO)/src/testodr1.cc \
optionparser-$(LMCPPOP_RELEASE_NO)/src/testprintusage.cpp \
optionparser-$(LMCPPOP_RELEASE_NO)/src/example_arg.cc \
optionparser-$(LMCPPOP_RELEASE_NO)/src/testodr2.cc \
optionparser-$(LMCPPOP_RELEASE_NO)/src/testparse.cpp \
optionparser-$(LMCPPOP_RELEASE_NO)/src/Makefile \
optionparser-$(LMCPPOP_RELEASE_NO)/src/optionparser.h \
optionparser-$(LMCPPOP_RELEASE_NO)/Doxyfile

###
### Google Test
Expand Down
Loading

0 comments on commit bac6682

Please sign in to comment.