OWLNext    7.0
Borland's Object Windows Library for the modern age
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cmdline.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1992, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Command line parsing class
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_CMDLINE_H)
10#define OWL_CMDLINE_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <owl/defs.h>
18
19
20namespace owl {
21
22#include <owl/preclass.h>
23
24/// \addtogroup utility
25/// @{
26
27
28//
29/// \class TCmdLine
30// ~~~~~ ~~~~~~~~
31/// Command line argument processing class, processes in the form:
32//
33/// <Name> | {-/}<Option>[{:=}<Value>] ...
34//
36 public:
37 enum TKind {
38 Start, ///< No tokens have been parsed yet
39 Name, ///< Name type token, has no leading / or -
40 Option, ///< Option type token. Leading / or - skipped by Token
41 Value, ///< Value for name or option. Leading : or = skipped by Token
42 Done ///< No more tokens
43 };
44 TCmdLine(const tstring& cmdLine);
45 ~TCmdLine();
46
47 TKind NextToken(bool removeCurrent=false);
48 LPCTSTR GetLine() const {return Buffer;}
49 void Reset();
50
51 tstring GetToken() const;
52 TKind GetTokenKind() const;
53
54#if defined(OWL5_COMPAT)
55 public:
56#else
57 private:
58#endif
59 TKind Kind; ///< Kind of current token
60 LPTSTR Token; ///< Ptr to current token. (Not 0-terminated, use TokenLen)
61 int TokenLen; ///< Length of current token
62
63 private:
64 LPTSTR Buffer; ///< Command line buffer
65 LPTSTR TokenStart; ///< Actual start of current token
66};
67
68/// @}
69
70#include <owl/posclass.h>
71
73{
74 return Kind;
75}
76
77
78} // OWL namespace
79
80
81
82#endif // OWL_CMDLINE_H
Command line argument processing class, processes in the form:
Definition cmdline.h:35
@ Option
Option type token. Leading / or - skipped by Token.
Definition cmdline.h:40
@ Value
Value for name or option. Leading : or = skipped by Token.
Definition cmdline.h:41
@ Start
No tokens have been parsed yet.
Definition cmdline.h:38
@ Name
Name type token, has no leading / or -.
Definition cmdline.h:39
TKind GetTokenKind() const
Definition cmdline.h:72
LPCTSTR GetLine() const
Definition cmdline.h:48
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
std::string tstring
Definition defs.h:79
General definitions used by all ObjectWindows programs.
#define _OWLCLASS
Definition defs.h:338