src/include/common/base/fscapi.h

00001 /*
00002  * Funambol is a mobile platform developed by Funambol, Inc. 
00003  * Copyright (C) 2003 - 2007 Funambol, Inc.
00004  * 
00005  * This program is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Affero General Public License version 3 as published by
00007  * the Free Software Foundation with the addition of the following permission 
00008  * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
00009  * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE 
00010  * WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS.
00011  * 
00012  * This program is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00015  * details.
00016  * 
00017  * You should have received a copy of the GNU Affero General Public License 
00018  * along with this program; if not, see http://www.gnu.org/licenses or write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00020  * MA 02110-1301 USA.
00021  * 
00022  * You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite 
00023  * 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
00024  * 
00025  * The interactive user interfaces in modified source and object code versions
00026  * of this program must display Appropriate Legal Notices, as required under
00027  * Section 5 of the GNU Affero General Public License version 3.
00028  * 
00029  * In accordance with Section 7(b) of the GNU Affero General Public License
00030  * version 3, these Appropriate Legal Notices must retain the display of the
00031  * "Powered by Funambol" logo. If the display of the logo is not reasonably 
00032  * feasible for technical reasons, the Appropriate Legal Notices must display
00033  * the words "Powered by Funambol".
00034  */
00035 
00044 #ifndef INCL_FSCAPI
00045     #define INCL_FSCAPI
00046 
00048     /* This is the list of possible transport agents (some are available on
00049      * different platforms, while other ones are available on a single platform)
00050      **/
00051     #define FUN_CURL_TRANSPORT_AGENT 1
00052     #define FUN_MAC_TRANSPORT_AGENT  2
00053     #define FUN_WIN_TRANSPORT_AGENT  3
00054     #define FUN_SYM_TRANSPORT_AGENT  4
00055 
00056     /* Autodetect target system based on compiler automatic macros */
00057     #if defined(__unix__) || defined(__linux__)
00058     /* This is a generic unix system */
00059     #define POSIX 1
00060 
00061     #if !defined(FUN_TRANSPORT_AGENT)
00062     #define FUN_TRANSPORT_AGENT FUN_CURL_TRANSPORT_AGENT
00063     #endif
00064 
00065     #elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
00066     /* This is an iPhone */
00067     #define FUN_IPHONE   1
00068     #define POSIX 1
00069 
00070     #if !defined(FUN_TRANSPORT_AGENT)
00071     #define FUN_TRANSPORT_AGENT FUN_MAC_TRANSPORT_AGENT
00072     #endif
00073 
00074     #elif defined(__APPLE__) && defined(__MACH__)
00075     /* This is a MacOSx. If needed we could use __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
00076      * to discriminate on the OS version (e.g. 10.5 vs 10.4)
00077      */
00078     #define POSIX 1
00079     #define MAC   1
00080 
00081     #if !defined(FUN_TRANSPORT_AGENT)
00082     #define FUN_TRANSPORT_AGENT FUN_MAC_TRANSPORT_AGENT
00083     #endif
00084 
00085     #elif defined(_WIN32_WCE) || defined(WIN32)
00086     /* This is windows or windows mobile, in this case we don't have our
00087      * own macro.
00088      */
00089 
00090     #if !defined(FUN_TRANSPORT_AGENT)
00091     #define FUN_TRANSPORT_AGENT FUN_WIN_TRANSPORT_AGENT
00092     #endif
00093 
00094 
00095     #elif defined(__SYMBIAN32__)
00096     /* This is Symbian. Other macros allow to discriminate the version, but at
00097      * the moment we don't need it
00098      */
00099     #define SYMBIAN 1
00100 
00101     #if !defined(FUN_TRANSPORT_AGENT)
00102     #define FUN_TRANSPORT_AGENT FUN_SYM_TRANSPORT_AGENT
00103     #endif
00104 
00105     #else
00106     #error "Unrecognized platform, cannot proceed"
00107     #endif
00108 
00109     /* Include the proper files */
00110     #ifdef MAC
00111         #ifndef MSG_NOSIGNAL
00112             #define MSG_NOSIGNAL SO_NOSIGPIPE
00113         #endif
00114     #endif
00115     
00116     #ifdef POSIX
00117         #include "base/posixadapter.h"
00118     #elif SYMBIAN
00119         #include "base/symbianadapter.h"
00120     #elif defined(_WIN32_WCE) || defined(WIN32)
00121         // Windows common stuff
00122         #define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
00123 
00124         #include <windows.h>
00125         #include "base/winadapter.h"
00126 
00127         #if defined(WIN32)
00128             #include "wininet.h"
00129         #endif
00130 
00131         #if defined(WIN32) && !defined(_WIN32_WCE)
00132             #include <sys/stat.h>
00133             #include "shlobj.h"        
00134             #include <wchar.h>
00135             #include <time.h>
00136             #include <stdlib.h>
00137         #endif
00138 
00139         #ifdef _WIN32_WCE
00140             #include "base/time.h"
00141         #endif
00142     #endif
00143 
00144     #ifdef MALLOC_DEBUG
00145       #pragma warning(disable:4291)
00146       extern size_t dbgcounter;
00147       void *operator new(size_t s);
00148       void *operator new[](size_t s);
00149       void *operator new(size_t s, char* file, int line);
00150       void *operator new[](size_t s, char* file, int line);
00151       void operator delete(void* p);
00152       void operator delete[] (void* p);
00153 
00154       #define new new(__FILE__, __LINE__)
00155     #endif
00156 
00157     #ifndef SYNC4J_LINEBREAK
00158     // default encoding of line break in native strings,
00159     // may be overridden by adapter header files above
00160     # define SYNC4J_LINEBREAK TEXT("\r\n")
00161     #endif
00162 
00163     #ifndef WCHAR_PRINTF
00164 
00165     # define WCHAR_PRINTF "ls"
00166     #endif
00167 
00168     #if !defined(PLATFORM_VA_LIST)
00169     #define PLATFORM_VA_LIST va_list
00170     #endif
00171 
00172     #if !defined(PLATFORM_VA_START)
00173     #define PLATFORM_VA_START va_start
00174     #endif
00175 
00176     #if !defined(PLATFORM_VA_END)
00177     #define PLATFORM_VA_END  va_end
00178     #endif
00179 
00180     #if !defined(PLATFORM_VA_COPY)
00181     #define PLATFORM_VA_COPY va_copy
00182     #endif
00183 
00184     #if !defined(PLATFORM_VA_ARG)
00185     #define PLATFORM_VA_ARG va_arg
00186     #endif
00187 
00188 
00205     #include <assert.h>
00206 
00207     #ifdef HAVE_STDARG_H
00208         #include <stdarg.h>
00209     #endif
00210  
00211     #include "base/errors.h"
00212 
00214 #endif
00215 
00216 

Generated on Fri Jul 25 15:04:15 2008 for Funambol C++ Client Library by  doxygen 1.5.1