comparison host/tools/Utils/win32/CTUtils.h @ 76:435cced73e2f ecos-v1_3_1-release

eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
author jlarmour
date Tue, 28 Mar 2000 14:10:45 +0000
parents
children 74dbf4c3f2e1
comparison
equal deleted inserted replaced
75:41bf073c0c32 76:435cced73e2f
1 //####COPYRIGHTBEGIN####
2 //
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 //
6 // This program is part of the eCos host tools.
7 //
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
11 // any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 // more details.
17 //
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 //
22 // ----------------------------------------------------------------------------
23 //
24 //####COPYRIGHTEND####
25 //===========================================================================
26 //#####DESCRIPTIONBEGIN####
27 //
28 // Author(s): sdf
29 // Contact(s): sdf
30 // Date: 1998/08/11
31 // Version: 0.01
32 // Purpose:
33 // Description: Interface to various global utility functions. Everything in this
34 // class is static (there are no instances).
35 // Requires:
36 // Provides:
37 // See also:
38 // Known bugs:
39 // Usage:
40 //
41 //####DESCRIPTIONEND####
42 //
43 //===========================================================================
44 #ifndef _UTILS_H
45 #define _UTILS_H
46 #include "FileName.h"
47 #define INCLUDEFILE <string>
48 #include "IncludeSTL.h"
49 #include <stdarg.h> // vsnprintf
50
51 class CUtils {
52 public:
53 static bool Launch (const CFileName &strFileName,const CFileName &strViewer);
54 static CString GetLastErrorMessageString ();
55
56 static bool AddToPath (const CFileName &strFolder, bool bAtFront=true);
57 static const CString LoadString (UINT id);
58
59 // Messagebox functions
60
61 // Vararg message box compositor
62 static int MessageBoxF (LPCTSTR pszFormat, ...);
63 // Same, with type
64 static int MessageBoxFT (UINT nType, LPCTSTR pszFormat, ...);
65 // As above but with resource
66 static int MessageBoxFR (UINT nID, UINT nType, LPCTSTR pszFormat, ...);
67 // Same, with type
68 static int MessageBoxFR (UINT nID, LPCTSTR pszFormat, ...);
69 // vararg form
70 static int vMessageBox(UINT nType, LPCTSTR pszFormat, va_list marker);
71
72 // String functions
73
74 // Chop the string into pieces using separator cSep.
75 // The Boolean controls whether " and \ make a difference
76 static int Chop(LPCTSTR psz,CStringArray &ar,TCHAR cSep=_TCHAR(' '),bool bObserveStrings=false,bool bBackslashQuotes=false);
77 static int Chop(LPCTSTR psz,CStringArray &ar,LPCTSTR pszSep, bool bObserveStrings=false,bool bBackslashQuotes=false);
78 // String -> Integer, observing the current hex/decimal setting
79 static BOOL StrToItemIntegerType(const CString &str,__int64 &d);
80 static BOOL StrToDouble (const CString &strValue, double &dValue);
81 // Integer -> String, observing the current hex/decimal setting
82 static const CString IntToStr(__int64 d,bool bHex=false);
83 static const CString DoubleToStr (double dValue);
84 static CString StripExtraWhitespace (const CString & strInput);
85
86 // Provide a failure explanation for what just went wrong
87 static const CString Explanation (CFileException &exc);
88 static void UnicodeToCStr(LPCTSTR str,char *&psz);
89 static std::string UnicodeToStdStr(LPCTSTR str);
90 static CFileName WPath(const std::string &str);
91 static bool CopyFile (LPCTSTR pszSource,LPCTSTR pszDest);
92
93 };
94
95 #endif