ReactOS 0.4.16-dev-338-g34e76ad
CShellCommandsLinkedList Class Reference

#include <ShellCommandsLinkedList.h>

Collaboration diagram for CShellCommandsLinkedList:

Classes

struct  SNode
 

Public Member Functions

 CShellCommandsLinkedList (CConsole &rConsole)
 
virtual ~CShellCommandsLinkedList ()
 
void AddCommand (CShellCommand *pCommand)
 
int Execute (CArgumentParser &rArgumentParser, int &nReturnValue)
 
CShellCommandMatch (const TCHAR *pchCommand)
 
POSITION GetFirstCommandPosition ()
 
CShellCommandGetNextCommand (POSITION &rPos)
 

Private Attributes

struct CShellCommandsLinkedList::SNodem_pRoot
 
CConsolem_rConsole
 

Detailed Description

Definition at line 14 of file ShellCommandsLinkedList.h.

Constructor & Destructor Documentation

◆ CShellCommandsLinkedList()

CShellCommandsLinkedList::CShellCommandsLinkedList ( CConsole rConsole)

Definition at line 33 of file ShellCommandsLinkedList.cpp.

33 :m_rConsole(rConsole)
34{
35 m_pRoot = NULL;
36}
struct CShellCommandsLinkedList::SNode * m_pRoot
#define NULL
Definition: types.h:112

◆ ~CShellCommandsLinkedList()

CShellCommandsLinkedList::~CShellCommandsLinkedList ( )
virtual

Definition at line 38 of file ShellCommandsLinkedList.cpp.

39{
40}

Member Function Documentation

◆ AddCommand()

void CShellCommandsLinkedList::AddCommand ( CShellCommand pCommand)

Definition at line 42 of file ShellCommandsLinkedList.cpp.

43{
44 // Create new node
45 SNode *pNewNode = new (std::nothrow) SNode;
46 if (pNewNode == NULL)
47 return;
48
49 pNewNode->m_pData = pCommand;
50
51 // add new node to the end
52 if (m_pRoot)
53 {
54 SNode *pLastNode = m_pRoot;
55
56 while (pLastNode->m_pNext)
57 pLastNode = pLastNode->m_pNext;
58
59 pLastNode->m_pNext = pNewNode;
60 }
61 else
62 {
63 m_pRoot = pNewNode;
64 }
65}

Referenced by main().

◆ Execute()

int CShellCommandsLinkedList::Execute ( CArgumentParser rArgumentParser,
int nReturnValue 
)

Definition at line 67 of file ShellCommandsLinkedList.cpp.

68{
69 rArgumentParser.ResetArgumentIteration();
70
71 const TCHAR *pchCommand = rArgumentParser.GetNextArgument();
72
73 if (pchCommand == NULL) // empty command line
74 return -2;
75
76 int i = -1;
77
78 SNode *pNode = m_pRoot;
79
80 while(pNode)
81 {
82 i++;
83 if (pNode->m_pData->Match(pchCommand))
84 {
85 nReturnValue = pNode->m_pData->Execute(m_rConsole,rArgumentParser);
86 return i;
87 }
88 pNode = pNode->m_pNext;
89 }
90
91 return -1;
92}
void ResetArgumentIteration()
TCHAR * GetNextArgument()
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
char TCHAR
Definition: xmlstorage.h:189

Referenced by main().

◆ GetFirstCommandPosition()

POSITION CShellCommandsLinkedList::GetFirstCommandPosition ( )

Definition at line 108 of file ShellCommandsLinkedList.cpp.

109{
110 return (POSITION)m_pRoot;
111}

Referenced by CShellCommandHelp::Execute().

◆ GetNextCommand()

CShellCommand * CShellCommandsLinkedList::GetNextCommand ( POSITION rPos)

Definition at line 113 of file ShellCommandsLinkedList.cpp.

114{
115 CShellCommand * pCommand = ((SNode *)rPos)->m_pData;
116 rPos = (POSITION)(((SNode *)rPos)->m_pNext);
117 return pCommand;
118}
#define POSITION

Referenced by CShellCommandHelp::Execute().

◆ Match()

CShellCommand * CShellCommandsLinkedList::Match ( const TCHAR pchCommand)

Definition at line 94 of file ShellCommandsLinkedList.cpp.

95{
96 SNode *pNode = m_pRoot;
97
98 while(pNode)
99 {
100 if (pNode->m_pData->Match(pchCommand))
101 return pNode->m_pData;
102 pNode = pNode->m_pNext;
103 }
104
105 return NULL;
106}

Referenced by CShellCommandHelp::Execute().

Member Data Documentation

◆ m_pRoot

◆ m_rConsole

CConsole& CShellCommandsLinkedList::m_rConsole
private

Definition at line 31 of file ShellCommandsLinkedList.h.

Referenced by Execute().


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