vlc_charset.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * charset.h: Unicode UTF-8 wrappers function
00003  *****************************************************************************
00004  * Copyright (C) 2003-2005 the VideoLAN team
00005  * Copyright © 2005-2006 Rémi Denis-Courmont
00006  * $Id$
00007  *
00008  * Author: Rémi Denis-Courmont <rem # videolan,org>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef VLC_CHARSET_H
00026 #define VLC_CHARSET_H 1
00027 
00028 #include <stdarg.h>
00029 #include <sys/types.h>
00030 #include <dirent.h>
00031 
00032 VLC_EXPORT( void, LocaleFree, ( const char * ) );
00033 VLC_EXPORT( char *, FromLocale, ( const char * ) );
00034 VLC_EXPORT( char *, FromLocaleDup, ( const char * ) );
00035 VLC_EXPORT( char *, ToLocale, ( const char * ) );
00036 VLC_EXPORT( char *, ToLocaleDup, ( const char * ) );
00037 
00038 /* TODO: move all of this to "vlc_fs.h" or something like that */
00039 VLC_EXPORT( int, utf8_open, ( const char *filename, int flags, mode_t mode ) );
00040 VLC_EXPORT( FILE *, utf8_fopen, ( const char *filename, const char *mode ) );
00041 VLC_EXPORT( DIR *, utf8_opendir, ( const char *dirname ) );
00042 VLC_EXPORT( char *, utf8_readdir, ( DIR *dir ) );
00043 VLC_EXPORT( int, utf8_loaddir, ( DIR *dir, char ***namelist, int (*select)( const char * ), int (*compar)( const char **, const char ** ) ) );
00044 VLC_EXPORT( int, utf8_scandir, ( const char *dirname, char ***namelist, int (*select)( const char * ), int (*compar)( const char **, const char ** ) ) );
00045 VLC_EXPORT( int, utf8_mkdir, ( const char *filename, mode_t mode ) );
00046 VLC_EXPORT( int, utf8_unlink, ( const char *filename ) );
00047 
00048 #ifdef WIN32
00049 # define stat _stati64
00050 #endif
00051 
00052 VLC_EXPORT( int, utf8_stat, ( const char *filename, struct stat *buf ) );
00053 VLC_EXPORT( int, utf8_lstat, ( const char *filename, struct stat *buf ) );
00054 
00055 VLC_EXPORT( int, utf8_vfprintf, ( FILE *stream, const char *fmt, va_list ap ) );
00056 VLC_EXPORT( int, utf8_fprintf, ( FILE *, const char *, ... ) LIBVLC_FORMAT( 2, 3 ) );
00057 
00058 VLC_EXPORT( char *, EnsureUTF8, ( char * ) );
00059 VLC_EXPORT( const char *, IsUTF8, ( const char * ) );
00060 
00061 #ifdef WIN32
00062 static inline char *FromWide (const wchar_t *wide)
00063 {
00064     size_t len = WideCharToMultiByte (CP_UTF8, 0, wide, -1, NULL, 0, NULL, NULL);
00065     if (len == 0)
00066         return NULL;
00067 
00068     char *out = (char *)malloc (len);
00069 
00070     WideCharToMultiByte (CP_UTF8, 0, wide, -1, out, len, NULL, NULL);
00071     return out;
00072 }
00073 #endif
00074 
00075 VLC_EXPORT( const char *, GetFallbackEncoding, ( void ) );
00076 
00077 VLC_EXPORT( double, us_strtod, ( const char *, char ** ) );
00078 VLC_EXPORT( double, us_atof, ( const char * ) );
00079 
00080 #endif

Generated on Wed Aug 13 08:02:37 2008 for VLC by  doxygen 1.5.1