1 /*****************************************************************************
2 * StringUtility.h: MacOS X interface module
3 *****************************************************************************
4 * Copyright (C) 2002-2014 VLC authors and VideoLAN
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>
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.
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.
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 *****************************************************************************/
27 #import <Cocoa/Cocoa.h>
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]
36 #define B64DecNSStr(s) [[VLCStringUtility sharedInstance] b64Decode: s]
37 #define B64EncAndFree(s) [[VLCStringUtility sharedInstance] b64EncodeAndFree: s]
39 NSString *toNSStr(const char *str);
40 unsigned int CocoaKeyToVLC(unichar i_key);
42 @interface VLCStringUtility : NSObject
44 + (VLCStringUtility *)sharedInstance;
46 - (NSString *)localizedString:(const char *)psz;
47 - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
48 - (NSString *)getCurrentTimeAsString:(input_thread_t *)p_input negative:(BOOL)b_negative;
49 - (NSString *)stringForTime:(long long int)time;
51 - (NSString *)OSXStringKeyToString:(NSString *)theString;
52 - (NSString *)VLCKeyToString:(NSString *)theString;
53 - (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
55 - (NSString *)b64Decode:(NSString *)string;
56 - (NSString *)b64EncodeAndFree:(char *)psz_string;