ReactOS 0.4.15-dev-7906-g1b85a5f
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
TCHAR * m_pchArgumentList
#define NULL
Definition: types.h:112

◆ ~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}
#define ASSERT(a)
Definition: mode.c:44
char TCHAR
Definition: xmlstorage.h:189
#define _tcslen
Definition: xmlstorage.h:198

Referenced by CShellCommandsLinkedList::Execute(), CShellCommandChangeKey::Execute(), CShellCommandConnect::Execute(), CShellCommandDACL::Execute(), CShellCommandDeleteKey::Execute(), CShellCommandDeleteValue::Execute(), CShellCommandDir::Execute(), CShellCommandDOKA::Execute(), CShellCommandHelp::Execute(), CShellCommandNewKey::Execute(), CShellCommandOwner::Execute(), CShellCommandSACL::Execute(), CShellCommandSetValue::Execute(), CShellCommandValue::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}
void ResetArgumentIteration()
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
if(dx< 0)
Definition: linetemp.h:194
#define pch(ap)
Definition: match.c:418
#define _T(x)
Definition: vfdio.h:22

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: