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     #define FUN_MOZ_TRANSPORT_AGENT  5
00056 
00057     /* Autodetect target system based on compiler automatic macros */
00058     #if defined(__unix__) || defined(__linux__)
00059     /* This is a generic unix system */
00060     #define POSIX 1
00061 
00062     #if !defined(FUN_TRANSPORT_AGENT)
00063     #define FUN_TRANSPORT_AGENT FUN_CURL_TRANSPORT_AGENT
00064     #endif
00065 
00066     #elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
00067     /* This is an iPhone */
00068     #define FUN_IPHONE   1
00069     #define POSIX 1
00070 
00071     #if !defined(FUN_TRANSPORT_AGENT)
00072     #define FUN_TRANSPORT_AGENT FUN_MAC_TRANSPORT_AGENT
00073     #endif
00074 
00075     #elif defined(__APPLE__) && defined(__MACH__)
00076     /* This is a MacOSx. If needed we could use __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
00077      * to discriminate on the OS version (e.g. 10.5 vs 10.4)
00078      */
00079     #define POSIX 1
00080     #define MAC   1
00081 
00082     #if !defined(FUN_TRANSPORT_AGENT)
00083     #define FUN_TRANSPORT_AGENT FUN_MAC_TRANSPORT_AGENT
00084     #endif
00085 
00086     #elif defined(_WIN32_WCE) || defined(WIN32)
00087     /* This is windows or windows mobile, in this case we don't have our
00088      * own macro.
00089      */
00090 
00091     #if !defined(FUN_TRANSPORT_AGENT)
00092     #define FUN_TRANSPORT_AGENT FUN_WIN_TRANSPORT_AGENT
00093     #endif
00094 
00095 
00096     #elif defined(__SYMBIAN32__)
00097     /* This is Symbian. Other macros allow to discriminate the version, but at
00098      * the moment we don't need it
00099      */
00100     #define SYMBIAN 1
00101 
00102     #if !defined(FUN_TRANSPORT_AGENT)
00103     #define FUN_TRANSPORT_AGENT FUN_SYM_TRANSPORT_AGENT
00104     #endif
00105 
00106     #else
00107     #error "Unrecognized platform, cannot proceed"
00108     #endif
00109 
00110     /* Include the proper files */
00111     #ifdef MAC
00112         #ifndef MSG_NOSIGNAL
00113             #define MSG_NOSIGNAL SO_NOSIGPIPE
00114         #endif
00115     #endif
00116     
00117     #ifdef POSIX
00118         #include "base/posixadapter.h"
00119     #elif SYMBIAN
00120         #include "base/symbianadapter.h"
00121     #elif defined(_WIN32_WCE) || defined(WIN32)
00122         // Windows common stuff
00123         #define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
00124 
00125         #include <windows.h>
00126         #include "base/winadapter.h"
00127 
00128         #if defined(WIN32)
00129             #include "wininet.h"
00130         #endif
00131 
00132         #if defined(WIN32) && !defined(_WIN32_WCE)
00133             #include <sys/stat.h>
00134             #include "shlobj.h"        
00135             #include <wchar.h>
00136             #include <time.h>
00137             #include <stdlib.h>
00138         #endif
00139 
00140         #ifdef _WIN32_WCE
00141             #include "base/time.h"
00142         #endif
00143     #endif
00144 
00145     #ifdef MALLOC_DEBUG
00146       #pragma warning(disable:4291)
00147       extern size_t dbgcounter;
00148       void *operator new(size_t s);
00149       void *operator new[](size_t s);
00150       void *operator new(size_t s, char* file, int line);
00151       void *operator new[](size_t s, char* file, int line);
00152       void operator delete(void* p);
00153       void operator delete[] (void* p);
00154 
00155       #define new new(__FILE__, __LINE__)
00156     #endif
00157 
00158     #ifndef SYNC4J_LINEBREAK
00159     // default encoding of line break in native strings,
00160     // may be overridden by adapter header files above
00161     # define SYNC4J_LINEBREAK TEXT("\r\n")
00162     #endif
00163 
00164     #ifndef WCHAR_PRINTF
00165 
00166     # define WCHAR_PRINTF "ls"
00167     #endif
00168 
00169     #if !defined(PLATFORM_VA_LIST)
00170     #define PLATFORM_VA_LIST va_list
00171     #endif
00172 
00173     #if !defined(PLATFORM_VA_START)
00174     #define PLATFORM_VA_START va_start
00175     #endif
00176 
00177     #if !defined(PLATFORM_VA_END)
00178     #define PLATFORM_VA_END  va_end
00179     #endif
00180 
00181     #if !defined(PLATFORM_VA_COPY)
00182     #define PLATFORM_VA_COPY va_copy
00183     #endif
00184 
00185     #if !defined(PLATFORM_VA_ARG)
00186     #define PLATFORM_VA_ARG va_arg
00187     #endif
00188 
00189 
00206     #include <assert.h>
00207 
00208     #ifdef HAVE_STDARG_H
00209         #include <stdarg.h>
00210     #endif
00211  
00212     #include "base/errors.h"
00213 
00215 #endif
00216 
00217 

Generated on Wed Jan 14 17:15:36 2009 for Funambol C++ Client Library by  doxygen 1.5.2