1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
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)
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
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.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
25 //=================================================================
29 // platform information header
31 //=================================================================
32 //=================================================================
33 //#####DESCRIPTIONBEGIN####
38 // Description: eCosTestPlatform
41 //####DESCRIPTIONEND####
43 #ifndef _CeCosTestPlatform_H
44 #define _CeCosTestPlatform_H
47 #include "Collections.h"
48 #include "Properties.h"
51 //=================================================================
52 // This class holds properties associated with a platform type (i.e. common to all instances of that platform)
53 // The information is read from a .eCosrc file or from the registry.
54 // An instance of a platform corresponds to the class CTestResource.
55 //=================================================================
57 class CeCosTestPlatform {
58 class CeCosTestPlatformProperties : public CProperties {
60 CeCosTestPlatformProperties(CeCosTestPlatform *pti);
61 virtual ~CeCosTestPlatformProperties(){}
64 friend class CeCosTestPlatformProperties;
70 bool IsValid() const { return NULL!=Get(m_strName); }
71 LPCTSTR Name() const { return m_strName.c_str(); }
72 LPCTSTR Prefix() const { return m_strPrefix.c_str(); }
73 LPCTSTR GdbCmds() const { return m_strCommands.c_str(); }
74 LPCTSTR Prompt() const { return m_strPrompt.c_str(); }
75 LPCTSTR Inferior()const { return m_strInferior.c_str(); }
76 bool ServerSideGdb() const { return 0!=m_nServerSideGdb; }
77 CeCosTestPlatform():m_nServerSideGdb(0){}
78 bool LoadFromCommandString(LPCTSTR psz);
79 CeCosTestPlatform(LPCTSTR pszIm,LPCTSTR pszPre,LPCTSTR pszPrompt,LPCTSTR pszGdb,bool bServerSideGdb,LPCTSTR pszInferior):
82 m_strCommands(pszGdb),
83 m_strPrompt(pszPrompt),
84 m_nServerSideGdb(bServerSideGdb),
85 m_strInferior(pszInferior)
87 static int Add (const CeCosTestPlatform &t);
89 static unsigned int Count() { return (unsigned)arPlatforms.size(); }
91 // Get a platform by name:
92 static const CeCosTestPlatform *Get(LPCTSTR t);
94 // This is only used to enumerate the available platforms:
95 static const CeCosTestPlatform *Get(unsigned int i) { return (i<Count())?&arPlatforms[i]:0; }
97 static void RemoveAllPlatforms();
99 static bool IsValid (LPCTSTR pszTarget) { return NULL!=Get(pszTarget); }
102 static bool LoadFromDir (LPCTSTR pszDir);
103 static bool SaveToDir (LPCTSTR pszDir);
105 bool LoadFromRegistry(HKEY hKey,LPCTSTR pszKey);
106 static const String GetGreatestSubkey (LPCTSTR pszKey);
107 static bool SaveToRegistry(HKEY hKey,LPCTSTR pszKey);
111 String m_strCommands;
113 int m_nServerSideGdb;
114 String m_strInferior;
115 static std::vector<CeCosTestPlatform> arPlatforms;