3 * regexpl - Console Registry Explorer
5 * Copyright (C) 2000-2005 Nedko Arnaudov <nedko@users.sourceforge.net>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 // prompt for Registry Explorer
28 #define ESCAPE_CHAR _T("\\")
29 #define CURRENT_PATH_ALIAS_CHAR _T("w")
30 #define CURRENT_PATH_ALIAS ESCAPE_CHAR CURRENT_PATH_ALIAS_CHAR
31 #define DEFAULT_PROMPT CURRENT_PATH_ALIAS _T("\n# ")
33 CPrompt::CPrompt(CRegistryTree
& rTree
, HRESULT
& rhr
):m_rTree(rTree
)
35 m_pszPrompt
= new TCHAR
[_tcslen(DEFAULT_PROMPT
)+1];
42 _tcscpy(m_pszPrompt
,DEFAULT_PROMPT
);
45 HRESULT
CPrompt::SetPrompt(LPCTSTR pszPrompt
)
53 m_pszPrompt
= new TCHAR
[_tcslen(pszPrompt
)+1];
57 _tcscpy(m_pszPrompt
,pszPrompt
);
68 void CPrompt::ShowPrompt(CConsole
&rConsole
)
70 TCHAR
*pch
= m_pszPrompt
;
71 TCHAR Buffer
[2] = " ";
73 const TCHAR
*pszCurrentPath
;
77 if (_tcsncmp(pch
,CURRENT_PATH_ALIAS
,_tcslen(CURRENT_PATH_ALIAS
)) == 0)
79 pszCurrentPath
= m_rTree
.GetCurrentPath();
80 rConsole
.Write(pszCurrentPath
?pszCurrentPath
:_T("NULL (Internal Error)"));
81 pch
+= _tcslen(CURRENT_PATH_ALIAS
);
86 rConsole
.Write(Buffer
);
91 LPCTSTR
CPrompt::GetDefaultPrompt()
93 return DEFAULT_PROMPT
;