summaryrefslogtreecommitdiff
path: root/src/pointerlist.cc
blob: e642075581565da10b570b14c4fc5e3b2be341d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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()};
}