]> git.sesse.net Git - vlc/blob - include/vlc_strings.h
Some initial work for streaming profiles
[vlc] / include / vlc_strings.h
1 /*****************************************************************************
2  * vlc_strings.h: String functions
3  *****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Antoine Cellerier <dionoea at videolan dot org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef _VLC_STRINGS_H
25 #define _VLC_STRINGS_H 1
26
27 #include <vlc/vlc.h>
28
29 /**
30  * \defgroup strings Strings
31  * @{
32  */
33
34 VLC_EXPORT( void, resolve_xml_special_chars, ( char *psz_value ) );
35 VLC_EXPORT( char *, convert_xml_special_chars, ( const char *psz_content ) );
36
37 struct localized_string_t 
38 {
39     char *psz_lang;
40     char *psz_text;
41 };
42
43 struct i18n_string_t
44 {
45     int i_langs;
46     localized_string_t **pp_langs;
47 };
48
49 static inline void i18n_AddLang( i18n_string_t *p_src,
50                                  char *psz_lang, char *psz_text )
51 {
52     DECMALLOC_VOID( pl10n, localized_string_t );
53     pl10n->psz_lang = strdup( psz_lang );
54     pl10n->psz_text = strdup( psz_text );
55     INSERT_ELEM( p_src->pp_langs, p_src->i_langs, p_src->i_langs, pl10n );
56 };
57
58 static inline char *i18n_Get( i18n_string_t *p_src, char *psz_lang )
59 {
60     int i;
61     for( i = 0 ; i < p_src->i_langs; i++ )
62     {
63         if( !strcmp( p_src->pp_langs[i]->psz_lang, psz_lang ) )
64             return p_src->pp_langs[i]->psz_text;
65     }
66     return strdup( "" );
67 };
68
69 /**
70  * @}
71  */
72
73 #endif