]> git.sesse.net Git - vlc/blob - modules/gui/macosx/StringUtility.h
Consistent strings to avoid duplications
[vlc] / modules / gui / macosx / StringUtility.h
1 /*****************************************************************************
2  * StringUtility.h: MacOS X interface module
3  *****************************************************************************
4  * Copyright (C) 2002-2014 VLC authors and VideoLAN
5  * $Id$
6  *
7  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8  *          Christophe Massiot <massiot@via.ecp.fr>
9  *          Derk-Jan Hartman <hartman at videolan dot org>
10  *          Felix Paul Kühne <fkuehne at videolan dot org>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25  *****************************************************************************/
26
27 #import <Cocoa/Cocoa.h>
28 #import <vlc_input.h>
29
30 #define _NS(s) [[VLCStringUtility sharedInstance] localizedString: s]
31 /* Get an alternate version of the string.
32  * This string is stored as '1:string' but when displayed it only displays
33  * the translated string. the translation should be '1:translatedstring' though */
34 #define _ANS(s) [[[VLCStringUtility sharedInstance] localizedString: _(s)] substringFromIndex:2]
35
36 #define B64DecNSStr(s) [[VLCStringUtility sharedInstance] b64Decode: s]
37 #define B64EncAndFree(s) [[VLCStringUtility sharedInstance] b64EncodeAndFree: s]
38
39 NSString *toNSStr(const char *str);
40 unsigned int CocoaKeyToVLC(unichar i_key);
41
42 /**
43  * Gets the proper variant for an image ressource,
44  * depending on the os version.
45  */
46 NSImage *imageFromRes(NSString *o_id);
47
48 @interface VLCStringUtility : NSObject
49
50 + (VLCStringUtility *)sharedInstance;
51
52 - (NSString *)localizedString:(const char *)psz;
53 - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
54 - (NSString *)getCurrentTimeAsString:(input_thread_t *)p_input negative:(BOOL)b_negative;
55 - (NSString *)stringForTime:(long long int)time;
56
57 - (NSString *)OSXStringKeyToString:(NSString *)theString;
58 - (NSString *)VLCKeyToString:(NSString *)theString;
59 - (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
60
61 - (NSString *)b64Decode:(NSString *)string;
62 - (NSString *)b64EncodeAndFree:(char *)psz_string;
63
64 @end