summaryrefslogtreecommitdiff
path: root/src/pointerlist.h
blob: 7c51ca609c5186aab248849cfdd22452feb745b6 (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
// -*- c++ -*-
// Distributed under the BSD 2-Clause License.
// See accompanying file LICENSE for details.

#include <string>
#include <vector>
#include <deque>
#include <utility>

// Maintains an (owning) list of string args and converts them to argc/argv
// compatible arguments on request.
// The returned pointers are guaranteed to be valid as long as the PointerList
// object lifetime is not exceeded.
class PointerList :
	public std::deque<std::string>
{
public:
	PointerList() = default;
	PointerList(int argc, const char* argv[]);

	//! Returns argc/argv pair from the current list of args
	std::pair<int, const char**> get();

private:
	std::vector<const char*> argptrs;
};