![]() |
00001 // Copyright (c) 2002-2003 Luca Clivio <luca.clivio@maiaproject.org> 00002 // Tel. +39-347-2538040 00003 // via B.Croce 2, 20037 Paderno Dugnano (Milano) - Italy 00004 // 00005 // Developers: 00006 // Simone Mangano <simone.mangano@maiaproject.org> 00007 // Andrea Tosato <andrea.tosato@maiaproject.org> 00008 // 00009 // ----------------------------------------------------------------------------- 00010 // This program is free software; This program is free software; 00011 // you can redistribute it and/or modify it under the terms of the 00012 // GNU General Public License as published by the Free Software Foundation; 00013 // either version 2 of the License, or (at your option) any later version. 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // You should have received a copy of the GNU General Public License 00018 // along with this program; if not, write to the Free Software 00019 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00021 00022 #ifndef _omFunctions_ 00023 #define _omFunctions_ 00024 00025 00026 #include <wx/wx.h> 00027 #include <wx/dir.h> 00028 #include <wx/file.h> 00029 #include <iostream> 00030 00031 #include <unistd.h> 00032 #include <stdlib.h> 00033 #include <errno.h> 00034 #include <sys/types.h> 00035 #include <pwd.h> 00036 00037 #include <openmaia/config.h> 00038 #include <openmaia/omXMLTags.h> 00039 #include <openmaia/omemukeys.h> 00040 00041 #ifdef __WXMAC__ 00042 #include <sys/types.h> 00043 #include <sys/socket.h> 00044 #include <netinet/in.h> 00045 #include <arpa/inet.h> 00046 #include <netdb.h> 00047 #else 00048 #include <arpa/inet.h> 00049 #include <netdb.h> 00050 #include <unistd.h> 00051 #endif 00052 00053 00054 00060 class omFunctions { 00061 public: 00062 static void InitializeSimulationChars( long *) ; 00063 00064 // misc utilities 00065 static wxString GetUnixString(wxString) ; 00066 static wxString GetWindowsString(wxString) ; 00067 static wxString ConvertToLower(wxString) ; 00068 static wxString ConvertToUpper(wxString) ; 00069 static int ArrayFind(wxArrayString *, wxString); 00070 static int ArrayFindNoCase(wxArrayString *, wxString); 00071 00072 // path handling 00073 static void SetBasePath(wxString); 00074 static bool TestPersonalInstallation(wxString, wxString, wxString) ; 00075 static bool CreateDefaultInstallation(wxString, wxString); 00076 static bool TestFolder(wxString); 00077 static void CreateFolder(wxString, wxString); 00078 static bool TestFile(wxString) ; 00079 static wxString GetCurrentPath(); 00080 static wxString GetSharedPath(wxString); 00081 static wxString GetInstallationPath(wxString); 00082 static wxString GetUserDataPath(wxString); 00083 static void CopyFile(wxString,wxString, wxString); 00084 00085 // message handling 00086 static wxString GetCurrentIP() ; 00087 static wxString Encode(wxString); 00088 static wxString Decode(wxString); 00089 static int FindFirstNBChar(wxString, int t); 00090 static int FindLastNBChar(wxString); 00091 static int FindNotEncodedChar(wxString, char, int); 00092 00093 // conversion utilities 00094 static int Literal2Value(wxString); 00095 static long GetMaiaKeycodeFromXML( wxString) ; 00096 static wxArrayString SplitTextLine(wxString, wxString); 00097 static wxString Value2Literal(int); 00098 static bool String2Boolean(wxString); 00099 static wxString Boolean2String(bool); 00100 static wxString Boolean2String(int); 00101 static int String2Int(wxString); 00102 00103 // check utilities 00104 static bool IsBoolean(wxString); 00105 static bool IsInt(wxString); 00106 00107 00108 private: 00109 static void SetBasePathSD(wxString); 00111 static bool CreateDefaultInstallationSD(wxString,wxString); 00113 static bool TestPersonalInstallationSD(wxString, wxString, wxString); 00115 static wxString GetSharedPathSD(wxString); 00117 static wxString GetInstallationPathSD(wxString); 00119 static wxString GetUserDataPathSD(wxString); 00121 static void CopyFileSD(wxString,wxString, wxString); 00123 static void CreateFolderSD(wxString, wxString); 00125 } ; 00126 00127 #endif // _omFunctions_
Copyright © by Luca Clivio |