1/*
2 * Copyright 2007-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _ARGUMENT_VECTOR_H
6#define _ARGUMENT_VECTOR_H
7
8
9#include <SupportDefs.h>
10
11
12namespace BPrivate {
13
14
15class ArgumentVector {
16public:
17	enum ParseError {
18		NO_ERROR,
19		NO_MEMORY,
20		UNTERMINATED_QUOTED_STRING,
21		TRAILING_BACKSPACE
22	};
23
24public:
25								ArgumentVector();
26								~ArgumentVector();
27
28			int32				ArgumentCount() const	{ return fCount; }
29			const char* const*	Arguments() const		{ return fArguments; }
30
31			char**				DetachArguments();
32				// Caller must free() -- it's all one big allocation at the
33				// returned pointer.
34
35			ParseError			Parse(const char* commandLine,
36									const char** _errorLocation = NULL);
37
38private:
39			struct Parser;
40
41private:
42			char**				fArguments;
43			int32				fCount;
44};
45
46
47} // namespace BPrivate
48
49
50using BPrivate::ArgumentVector;
51
52
53#endif	// _ARGUMENT_VECTOR_H
54