ReactOS  0.4.14-dev-50-g13bb5e2
CArgumentParser Class Reference

#include <ArgumentParser.h>

Public Member Functions

void SetArgumentList (TCHAR *pchArguments)
 
void ResetArgumentIteration ()
 
TCHARGetNextArgument ()
 
 CArgumentParser ()
 
virtual ~CArgumentParser ()
 

Private Attributes

TCHARm_pchArgumentList
 
const TCHARm_pchArgumentListEnd
 
TCHARm_pchArgument
 

Detailed Description

Definition at line 10 of file ArgumentParser.h.

Constructor & Destructor Documentation

◆ CArgumentParser()

CArgumentParser::CArgumentParser ( )

Definition at line 33 of file ArgumentParser.cpp.

34 {
38 }
TCHAR * m_pchArgument
const TCHAR * m_pchArgumentListEnd
smooth NULL
Definition: ftsmooth.c:416
TCHAR * m_pchArgumentList

◆ ~CArgumentParser()

CArgumentParser::~CArgumentParser ( )
virtual

Definition at line 40 of file ArgumentParser.cpp.

41 {
42 }

Member Function Documentation

◆ GetNextArgument()

TCHAR * CArgumentParser::GetNextArgument ( )

Definition at line 75 of file ArgumentParser.cpp.

76 {
77  ASSERT(m_pchArgumentList); // call SetArgumentList() before calling this function
78  ASSERT(m_pchArgumentListEnd); // call SetArgumentList() before calling this function
80 
81  // if this is begin of iteration
82  if (!m_pchArgument)
84 
85  while(m_pchArgument)
86  {
88  { // if end of arguments list reached
90  break;
91  }
92 
93  TCHAR *pchArg = m_pchArgument;
94 
95  // Next argument
97 
98  if(*pchArg)
99  { // if argument is not an empty string
100  return pchArg;
101  }
102  }
103 
104  return NULL;
105 }
TCHAR * m_pchArgument
const TCHAR * m_pchArgumentListEnd
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
TCHAR * m_pchArgumentList

Referenced by CShellCommandChangeKey::Execute(), CShellCommandValue::Execute(), CShellCommandDACL::Execute(), CShellCommandSetValue::Execute(), CShellCommandSACL::Execute(), CShellCommandOwner::Execute(), CShellCommandNewKey::Execute(), CShellCommandDOKA::Execute(), CShellCommandHelp::Execute(), CShellCommandDir::Execute(), CShellCommandDeleteValue::Execute(), CShellCommandDeleteKey::Execute(), CShellCommandConnect::Execute(), CShellCommandsLinkedList::Execute(), and main().

◆ ResetArgumentIteration()

◆ SetArgumentList()

void CArgumentParser::SetArgumentList ( TCHAR pchArguments)

Definition at line 44 of file ArgumentParser.cpp.

45 {
46  TCHAR *pch = m_pchArgumentList = pchArguments;
47  m_pchArgumentListEnd = pchArguments + _tcslen(pchArguments);
48 
49  BOOL blnLongArg = FALSE;
50  while (*pch)
51  {
52  switch(*pch)
53  {
54  case _T('^'): // argument parser ignores escape sequences
55  if (pch[1])
56  pch++;
57  break;
58  case _T('\"'):
59  blnLongArg = !blnLongArg;
60  break;
61  case _T(' '):
62  case _T('\t'):
63  case _T('\r'):
64  case _T('\n'):
65  if (!blnLongArg)
66  *pch = 0;
67  break;
68  }
69  pch++;
70  }
71 
73 }
#define pch(ap)
Definition: match.c:418
unsigned int BOOL
Definition: ntddk_ex.h:94
const TCHAR * m_pchArgumentListEnd
void ResetArgumentIteration()
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
if(!(yy_init))
Definition: macro.lex.yy.c:714
TCHAR * m_pchArgumentList

Referenced by main().

Member Data Documentation

◆ m_pchArgument

TCHAR* CArgumentParser::m_pchArgument
private

Definition at line 38 of file ArgumentParser.h.

Referenced by CArgumentParser(), GetNextArgument(), and ResetArgumentIteration().

◆ m_pchArgumentList

TCHAR* CArgumentParser::m_pchArgumentList
private

Definition at line 36 of file ArgumentParser.h.

Referenced by CArgumentParser(), GetNextArgument(), and SetArgumentList().

◆ m_pchArgumentListEnd

const TCHAR* CArgumentParser::m_pchArgumentListEnd
private

Definition at line 37 of file ArgumentParser.h.

Referenced by CArgumentParser(), GetNextArgument(), and SetArgumentList().


The documentation for this class was generated from the following files: