diff options
Diffstat (limited to 'src/pointerlist.cc')
-rw-r--r-- | src/pointerlist.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/pointerlist.cc b/src/pointerlist.cc new file mode 100644 index 0000000..e642075 --- /dev/null +++ b/src/pointerlist.cc @@ -0,0 +1,28 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. +#include "pointerlist.h" + +PointerList::PointerList(int argc, const char* argv[]) +{ + for(int i = 0; i < argc; ++i) + { + push_back(argv[i]); + } +} + +std::pair<int, const char**> PointerList::get() +{ + argptrs.clear(); + for(const auto& arg : *this) + { + argptrs.push_back(arg.data()); + } + + if(argptrs.size() == 0) + { + return {0, nullptr}; + } + + return {argptrs.size(), argptrs.data()}; +} |