VLCStringUtility.h 3.08 KB
Newer Older
1
/*****************************************************************************
2
 * VLCStringUtility.h: MacOS X interface module
3
 *****************************************************************************
4
 * Copyright (C) 2002-2014 VLC authors and VideoLAN
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
 * $Id$
 *
 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
 *          Christophe Massiot <massiot@via.ecp.fr>
 *          Derk-Jan Hartman <hartman at videolan dot org>
 *          Felix Paul Kühne <fkuehne at videolan dot org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#import <Cocoa/Cocoa.h>
28
#import <vlc_input.h>
29 30 31 32 33 34 35

#define _NS(s) [[VLCStringUtility sharedInstance] localizedString: s]
/* Get an alternate version of the string.
 * This string is stored as '1:string' but when displayed it only displays
 * the translated string. the translation should be '1:translatedstring' though */
#define _ANS(s) [[[VLCStringUtility sharedInstance] localizedString: _(s)] substringFromIndex:2]

36 37 38
#define B64DecNSStr(s) [[VLCStringUtility sharedInstance] b64Decode: s]
#define B64EncAndFree(s) [[VLCStringUtility sharedInstance] b64EncodeAndFree: s]

39 40 41 42 43 44 45 46 47
extern NSString *const kVLCMediaAudioCD;
extern NSString *const kVLCMediaDVD;
extern NSString *const kVLCMediaVCD;
extern NSString *const kVLCMediaSVCD;
extern NSString *const kVLCMediaBD;
extern NSString *const kVLCMediaVideoTSFolder;
extern NSString *const kVLCMediaBDMVFolder;
extern NSString *const kVLCMediaUnknown;

48
NSString *toNSStr(const char *str);
49 50
unsigned int CocoaKeyToVLC(unichar i_key);

51 52 53 54 55 56
/**
 * Gets the proper variant for an image ressource,
 * depending on the os version.
 */
NSImage *imageFromRes(NSString *o_id);

57 58 59 60
@interface VLCStringUtility : NSObject

+ (VLCStringUtility *)sharedInstance;

61
- (NSString *)localizedString:(const char *)psz NS_FORMAT_ARGUMENT(1);
62
- (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
63
- (NSString *)getCurrentTimeAsString:(input_thread_t *)p_input negative:(BOOL)b_negative;
64
- (NSString *)stringForTime:(long long int)time;
65

66
- (NSString *)OSXStringKeyToString:(NSString *)theString;
67 68 69
- (NSString *)VLCKeyToString:(NSString *)theString;
- (unsigned int)VLCModifiersToCocoa:(NSString *)theString;

70 71 72
- (NSString *)b64Decode:(NSString *)string;
- (NSString *)b64EncodeAndFree:(char *)psz_string;

73 74 75
- (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath;
- (NSString *)getBSDNodeFromMountPath:(NSString *)mountPath;

76
@end