00001 00002 // Name: wxbuild.h 00003 // Purpose: wxWidgetsBuild, wxWidgetsBuildArray - wx builds management 00004 // Author: Francesco Montorsi 00005 // Modified by: 00006 // Created: 2006-06-29 00007 // RCS-ID: $Id: wxbuild.h,v 1.1.1.1 2006/12/12 09:41:00 frm Exp $ 00008 // Copyright: (c) Francesco Montorsi 00009 // Licence: wxWidgets licence 00011 00012 #ifndef _WXBUILD_H_ 00013 #define _WXBUILD_H_ 00014 00015 // Includes 00016 #include "wx/tokenzr.h" 00017 #include "wxp/wxputils.h" 00018 #include "wxp/compiler.h" 00019 #include "wxp/packageopt.h" 00020 #include "wxp/version.h" 00021 00022 // Forward declarations 00023 class wxPackageArray; 00024 class wxPackage; 00025 class wxWidgetsBuildArray; 00026 00027 00028 00029 // ---------------------------------------------------------------------------- 00030 // wxWidgetsBuild 00031 // ---------------------------------------------------------------------------- 00032 00034 class wxWidgetsBuild : public wxObject 00035 { 00036 DECLARE_DYNAMIC_CLASS(wxWidgetsBuild) 00037 00038 public: 00039 wxWidgetsBuild() 00040 { m_format=wxPCF_INVALID; m_port=wxPORT_UNKNOWN; 00041 m_bStatic=m_bDebug=m_bUnicode=true; } 00042 00043 public: // getters 00044 00045 wxString GetLocation() const 00046 { return m_strLocation; } 00047 wxVersion GetVersion() const 00048 { return m_version; } 00049 wxPortId GetPortId() const 00050 { return m_port; } 00051 00052 wxPackageCompilerFormat GetCompilerUsed() const 00053 { return m_format; } 00054 bool IsStaticBuild() const 00055 { return m_bStatic; } 00056 bool IsDebugBuild() const 00057 { return m_bDebug; } 00058 bool IsUnicodeBuild() const 00059 { return m_bUnicode; } 00060 00061 wxString GetUserFriendlyName() const; 00062 00063 static wxArrayString GetSpecialOptionNames(); 00064 void UpdateOptions(wxPackageCommandOptionArray &arr) const; 00065 00066 public: // setters 00067 00068 void SetLocation(const wxString &str) 00069 { m_strLocation=str; } 00070 void SetVersion(const wxVersion &str) 00071 { m_version=str; } 00072 void SetPortId(wxPortId n) 00073 { m_port=n; } 00074 00075 void SetCompilerUsed(wxPackageCompilerFormat n) 00076 { m_format=n; } 00077 void SetBuildProp(bool staticbuild, bool debug, bool unicode) 00078 { m_bStatic=staticbuild; m_bDebug=debug; m_bUnicode=unicode; } 00079 00080 public: // misc 00081 00082 bool IsOk() const 00083 { 00084 return !m_strLocation.IsEmpty() && 00085 m_version.IsOk() && 00086 m_port != wxPORT_UNKNOWN && 00087 m_format != wxPCF_INVALID; 00088 } 00089 00090 public: // load/save 00091 00092 bool Load(wxConfigBase *, const wxString &path); 00093 void Save(wxConfigBase *, const wxString &path) const; 00094 00095 protected: // properties of this wxWidgets build 00096 00097 wxString m_strLocation; 00098 wxVersion m_version; 00099 wxPortId m_port; 00100 00101 protected: // configuration of this build 00102 00103 wxPackageCompilerFormat m_format; 00104 bool m_bStatic, m_bDebug, m_bUnicode; 00105 }; 00106 00107 // the array 00108 WX_DECLARE_OBJARRAY(wxWidgetsBuild, wxWidgetsBuildArrayHelper); 00109 00110 00111 00112 // ---------------------------------------------------------------------------- 00113 // wxWidgetsBuildArray 00114 // ---------------------------------------------------------------------------- 00115 00116 class wxWidgetsBuildArray : public wxWidgetsBuildArrayHelper 00117 { 00118 public: 00119 00121 wxWidgetsBuildArray() {} 00122 00123 public: 00124 00125 static wxWidgetsBuildArray s_arrWxBuilds; 00126 00127 public: // miscellaneous 00128 00130 bool IsOk() const 00131 { 00132 for (size_t i=0; i<GetCount(); i++) 00133 if (!Item(i).IsOk()) 00134 return false; 00135 return true; 00136 } 00137 00138 long GetPortList() const 00139 { 00140 long ret; 00141 for (size_t i=0; i<GetCount(); i++) 00142 ret |= Item(i).GetPortId(); 00143 return ret; 00144 } 00145 00146 public: // load/save 00147 00149 static bool LoadGlobals(wxConfigBase *, const wxString &path); 00150 00152 static void SaveGlobals(wxConfigBase *, const wxString &path); 00153 }; 00154 00155 00156 #endif // _WXBUILD_H_ 00157