libxspf  1.2.0
XspfDefines.h
Go to the documentation of this file.
00001 /*
00002  * libxspf - XSPF playlist handling library
00003  *
00004  * Copyright (C) 2006-2008, Sebastian Pipping / Xiph.Org Foundation
00005  * All rights reserved.
00006  *
00007  * Redistribution  and use in source and binary forms, with or without
00008  * modification,  are permitted provided that the following conditions
00009  * are met:
00010  *
00011  *     * Redistributions   of  source  code  must  retain  the   above
00012  *       copyright  notice, this list of conditions and the  following
00013  *       disclaimer.
00014  *
00015  *     * Redistributions  in  binary  form must  reproduce  the  above
00016  *       copyright  notice, this list of conditions and the  following
00017  *       disclaimer   in  the  documentation  and/or  other  materials
00018  *       provided with the distribution.
00019  *
00020  *     * Neither  the name of the Xiph.Org Foundation nor the names of
00021  *       its  contributors may be used to endorse or promote  products
00022  *       derived  from  this software without specific  prior  written
00023  *       permission.
00024  *
00025  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00026  * "AS  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT  NOT
00027  * LIMITED  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND  FITNESS
00028  * FOR  A  PARTICULAR  PURPOSE ARE DISCLAIMED. IN NO EVENT  SHALL  THE
00029  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00030  * INCIDENTAL,    SPECIAL,   EXEMPLARY,   OR   CONSEQUENTIAL   DAMAGES
00031  * (INCLUDING,  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00032  * SERVICES;  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00033  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00034  * STRICT  LIABILITY,  OR  TORT (INCLUDING  NEGLIGENCE  OR  OTHERWISE)
00035  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00036  * OF THE POSSIBILITY OF SUCH DAMAGE.
00037  *
00038  * Sebastian Pipping, sping@xiph.org
00039  */
00040 
00045 #ifndef XSPF_DEFINES_H
00046 #define XSPF_DEFINES_H
00047 
00048 
00049 #include "XspfVersion.h"
00050 
00051 
00052 // Namespace handling
00053 #define XSPF_NS_HOME        _PT("http://xspf.org/ns/0/")  ///< XSPF namespace URI
00054 #define XSPF_NS_HOME_LEN    21                            ///< XSPF namespace URI string length
00055 #define XSPF_NS_SEP_CHAR    _PT(' ')                      ///< Namespace separator as character
00056 #define XSPF_NS_SEP_STRING  _PT(" ")                      ///< Namespace separator as string
00057 #define XML_NS_HOME          _PT("http://www.w3.org/XML/1998/namespace") ///< XML namespace URI
00058 #define XML_NS_HOME_LEN      36                            ///< XML namespace URI string length
00059 
00060 
00061 // Expat 1.95.8 or later
00062 #include <expat.h>
00063 #if (!defined(XML_MAJOR_VERSION) || !defined(XML_MINOR_VERSION) \
00064                 || !defined(XML_MICRO_VERSION) || (XML_MAJOR_VERSION < 1) \
00065                 || ((XML_MAJOR_VERSION == 1) && ((XML_MINOR_VERSION < 95) \
00066                 || ((XML_MINOR_VERSION == 95) && (XML_MICRO_VERSION < 8)))))
00067 # error Expat 1.95.8 or later is required
00068 #endif
00069 
00070 
00075 #define XSPF_MAX_BLOCK_SIZE 100000
00076 
00077 
00079 
00080 // Deny overriding from outside
00081 #undef XSPF_OS_WINDOWS
00082 #undef XSPF_OS_UNIX
00083 
00084 
00085 // Portability defines
00086 #if (defined(__WIN32__) || defined(_WIN32) || defined(WIN32))
00087 
00088 // Windows =========================
00089 #include <windows.h>
00090 #include <tchar.h>
00091 
00092 #define XSPF_OS_WINDOWS 1
00093 // =================================
00094 
00095 # ifdef UNICODE
00096 #  ifndef _UNICODE
00097 #   error _UNICODE not defined
00098 #  endif
00099 # else
00100 #  ifdef _UNICODE
00101 #   error UNICODE not defined
00102 #  endif
00103 # endif
00104 #else
00105 
00106 // Unix, ANSI ======================
00107 #define XSPF_OS_UNIX 1
00108 // =================================
00109 
00110 #endif
00111 
00112 
00113 // OS-specific selection macro
00114 #ifdef XSPF_OS_WINDOWS
00115 # define XSPF_OS_SELECT(windows, unix) windows
00116 #else
00117 # ifdef XSPF_OS_UNIX
00118 #  define XSPF_OS_SELECT(windows, unix) unix
00119 # endif
00120 #endif
00121 
00122 
00123 #define PORT_ATOI      XSPF_OS_SELECT(_ttoi,      atoi)
00124 #define PORT_FOPEN     XSPF_OS_SELECT(_tfopen,    fopen)
00125 #define PORT_MAIN      XSPF_OS_SELECT(_tmain,     main)
00126 #define PORT_PRINTF    XSPF_OS_SELECT(_tprintf,   printf)
00127 
00128 #ifdef UNICODE
00129 # define PORT_SNPRINTF  XSPF_OS_SELECT(_snwprintf,  snprintf)
00130 #else
00131 # define PORT_SNPRINTF  XSPF_OS_SELECT(_snprintf,  snprintf)
00132 #endif
00133 
00134 #define PORT_STRCMP    XSPF_OS_SELECT(_tcscmp,    strcmp)
00135 #define PORT_STRCPY    XSPF_OS_SELECT(_tcscpy,    strcpy)
00136 #define PORT_STRLEN    XSPF_OS_SELECT(_tcslen,    strlen)
00137 #define PORT_STRNCMP   XSPF_OS_SELECT(_tcsncmp,   strncmp)
00138 #define PORT_STRNCPY   XSPF_OS_SELECT(_tcsncpy,   strncpy)
00139 #define PORT_STRNICMP  XSPF_OS_SELECT(_tcsnicmp,  strnicmp)
00140 #define _PT(x)         XSPF_OS_SELECT(_T(x),      x)
00141 
00143 
00144 
00145 #endif // XSPF_DEFINES_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines