ReactOS 0.4.15-dev-8145-ga541a46
CPrompt Class Reference

#include <Prompt.h>

Collaboration diagram for CPrompt:

Public Member Functions

 CPrompt (CRegistryTree &rTree, HRESULT &rhr)
 
 ~CPrompt ()
 
HRESULT SetPrompt (LPCTSTR pszPrompt)
 
void ShowPrompt (CConsole &rConsole)
 

Static Public Member Functions

static LPCTSTR GetDefaultPrompt ()
 

Private Attributes

CRegistryTreem_rTree
 
LPTSTR m_pszPrompt
 

Detailed Description

Definition at line 7 of file Prompt.h.

Constructor & Destructor Documentation

◆ CPrompt()

CPrompt::CPrompt ( CRegistryTree rTree,
HRESULT rhr 
)

Definition at line 32 of file Prompt.cpp.

32 :m_rTree(rTree)
33{
34 m_pszPrompt = new (std::nothrow) TCHAR[_tcslen(DEFAULT_PROMPT)+1];
35 if (!m_pszPrompt)
36 {
37 rhr = E_OUTOFMEMORY;
38 return;
39 }
40
42}
#define DEFAULT_PROMPT
Definition: Prompt.cpp:30
CRegistryTree & m_rTree
Definition: Prompt.h:17
LPTSTR m_pszPrompt
Definition: Prompt.h:18
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define _tcscpy
Definition: tchar.h:623
char TCHAR
Definition: xmlstorage.h:189
#define _tcslen
Definition: xmlstorage.h:198

◆ ~CPrompt()

CPrompt::~CPrompt ( )

Definition at line 61 of file Prompt.cpp.

62{
63 if (m_pszPrompt)
64 delete[] m_pszPrompt;
65}

Member Function Documentation

◆ GetDefaultPrompt()

LPCTSTR CPrompt::GetDefaultPrompt ( )
static

Definition at line 90 of file Prompt.cpp.

91{
92 return DEFAULT_PROMPT;
93}

Referenced by CSettings::GetPrompt().

◆ SetPrompt()

HRESULT CPrompt::SetPrompt ( LPCTSTR  pszPrompt)

Definition at line 44 of file Prompt.cpp.

45{
46 if (!pszPrompt)
47 {
49 return E_UNEXPECTED;
50 }
51
52 m_pszPrompt = new (std::nothrow) TCHAR[_tcslen(pszPrompt)+1];
53 if (!m_pszPrompt)
54 return E_OUTOFMEMORY;
55
56 _tcscpy(m_pszPrompt,pszPrompt);
57
58 return S_OK;
59}
#define FALSE
Definition: types.h:117
#define S_OK
Definition: intsafe.h:52
#define ASSERT(a)
Definition: mode.c:44
#define E_UNEXPECTED
Definition: winerror.h:2456

Referenced by main().

◆ ShowPrompt()

void CPrompt::ShowPrompt ( CConsole rConsole)

Definition at line 67 of file Prompt.cpp.

68{
70 TCHAR Buffer[2] = " ";
71
72 const TCHAR *pszCurrentPath;
73
74 while (*pch)
75 {
77 {
78 pszCurrentPath = m_rTree.GetCurrentPath();
79 rConsole.Write(pszCurrentPath?pszCurrentPath:_T("NULL (Internal Error)"));
81 }
82 else
83 {
84 Buffer[0] = *pch++;
85 rConsole.Write(Buffer);
86 }
87 }
88}
#define CURRENT_PATH_ALIAS
Definition: Prompt.cpp:29
Definition: bufpool.h:45
BOOL Write(const TCHAR *p, DWORD dwChars=0)
Definition: Console.cpp:90
const TCHAR * GetCurrentPath() const
#define _tcsncmp
Definition: tchar.h:1428
#define pch(ap)
Definition: match.c:418
#define _T(x)
Definition: vfdio.h:22

Referenced by main().

Member Data Documentation

◆ m_pszPrompt

LPTSTR CPrompt::m_pszPrompt
private

Definition at line 18 of file Prompt.h.

Referenced by CPrompt(), SetPrompt(), ShowPrompt(), and ~CPrompt().

◆ m_rTree

CRegistryTree& CPrompt::m_rTree
private

Definition at line 17 of file Prompt.h.

Referenced by ShowPrompt().


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