ReactOS  0.4.13-dev-247-g0f29b3f
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
LPTSTR m_pszPrompt
Definition: Prompt.h:18
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
CRegistryTree & m_rTree
Definition: Prompt.h:17
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
char TCHAR
Definition: xmlstorage.h:189

◆ ~CPrompt()

CPrompt::~CPrompt ( )

Definition at line 61 of file Prompt.cpp.

62 {
63  if (m_pszPrompt)
64  delete[] m_pszPrompt;
65 }
LPTSTR m_pszPrompt
Definition: Prompt.h:18

Member Function Documentation

◆ GetDefaultPrompt()

LPCTSTR CPrompt::GetDefaultPrompt ( )
static

Definition at line 90 of file Prompt.cpp.

91 {
92  return DEFAULT_PROMPT;
93 }
#define DEFAULT_PROMPT
Definition: Prompt.cpp:30

Referenced by CSettings::GetPrompt().

◆ SetPrompt()

HRESULT CPrompt::SetPrompt ( LPCTSTR  pszPrompt)

Definition at line 44 of file Prompt.cpp.

45 {
46  if (!pszPrompt)
47  {
48  ASSERT(FALSE);
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 }
LPTSTR m_pszPrompt
Definition: Prompt.h:18
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
char TCHAR
Definition: xmlstorage.h:189
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define S_OK
Definition: intsafe.h:59
#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 }
const TCHAR * GetCurrentPath() const
LPTSTR m_pszPrompt
Definition: Prompt.h:18
#define pch(ap)
Definition: match.c:418
#define CURRENT_PATH_ALIAS
Definition: Prompt.cpp:29
CRegistryTree & m_rTree
Definition: Prompt.h:17
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
Definition: bufpool.h:45
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
BOOL Write(const TCHAR *p, DWORD dwChars=0)
Definition: Console.cpp:90
int _tcsncmp(const _TCHAR *s1, const _TCHAR *s2, size_t n)
Definition: tcsncmp.h:9

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: