vfs: check userland buffers before reading them.
[haiku.git] / headers / private / shared / ArgumentVector.h
blob0b32a8743d1fddd48840ff78ded6063a7308699d
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
9 #include <SupportDefs.h>
12 namespace BPrivate {
15 class ArgumentVector {
16 public:
17 enum ParseError {
18 NO_ERROR,
19 NO_MEMORY,
20 UNTERMINATED_QUOTED_STRING,
21 TRAILING_BACKSPACE
24 public:
25 ArgumentVector();
26 ~ArgumentVector();
28 int32 ArgumentCount() const { return fCount; }
29 const char* const* Arguments() const { return fArguments; }
31 char** DetachArguments();
32 // Caller must free() -- it's all one big allocation at the
33 // returned pointer.
35 ParseError Parse(const char* commandLine,
36 const char** _errorLocation = NULL);
38 private:
39 struct Parser;
41 private:
42 char** fArguments;
43 int32 fCount;
47 } // namespace BPrivate
50 using BPrivate::ArgumentVector;
53 #endif // _ARGUMENT_VECTOR_H