2005-04-19 19:53:18 +00:00
|
|
|
//
|
|
|
|
// ResourceManager.h
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Oolite
|
|
|
|
*
|
|
|
|
* Created by Giles Williams on Sat Apr 03 2004.
|
|
|
|
* Copyright (c) 2004 for aegidian.org. All rights reserved.
|
|
|
|
*
|
|
|
|
|
|
|
|
Copyright (c) 2004, Giles C Williams
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License.
|
|
|
|
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.0/
|
|
|
|
or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
|
|
|
|
|
|
|
You are free:
|
|
|
|
|
|
|
|
• to copy, distribute, display, and perform the work
|
|
|
|
• to make derivative works
|
|
|
|
|
|
|
|
Under the following conditions:
|
|
|
|
|
|
|
|
• Attribution. You must give the original author credit.
|
|
|
|
|
|
|
|
• Noncommercial. You may not use this work for commercial purposes.
|
|
|
|
|
|
|
|
• Share Alike. If you alter, transform, or build upon this work,
|
|
|
|
you may distribute the resulting work only under a license identical to this one.
|
|
|
|
|
|
|
|
For any reuse or distribution, you must make clear to others the license terms of this work.
|
|
|
|
|
|
|
|
Any of these conditions can be waived if you get permission from the copyright holder.
|
|
|
|
|
|
|
|
Your fair use and other rights are in no way affected by the above.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef GNUSTEP
|
2005-10-01 16:32:46 +00:00
|
|
|
#include "oolite-linux.h"
|
2005-04-19 19:53:18 +00:00
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import <AppKit/AppKit.h>
|
2005-05-23 11:57:23 +00:00
|
|
|
#include <SDL.h>
|
|
|
|
#include <SDL_image.h>
|
2005-05-04 20:49:56 +00:00
|
|
|
#import "OOMusic.h"
|
2005-05-23 11:57:23 +00:00
|
|
|
#import "SDLImage.h"
|
2005-04-19 19:53:18 +00:00
|
|
|
#else
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#endif
|
|
|
|
|
2005-07-09 22:42:39 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
NSString* tag; // name of the tag
|
|
|
|
NSObject* content; // content of tag
|
|
|
|
} OOXMLElement;
|
|
|
|
|
2005-04-19 19:53:18 +00:00
|
|
|
extern int debug;
|
|
|
|
|
|
|
|
BOOL always_include_addons;
|
|
|
|
|
|
|
|
@interface ResourceManager : NSObject
|
|
|
|
{
|
|
|
|
NSMutableArray *paths;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initIncludingAddOns: (BOOL) include_addons;
|
|
|
|
|
|
|
|
+ (NSString *) errors;
|
|
|
|
+ (NSMutableArray *) paths;
|
|
|
|
+ (NSMutableArray *) pathsUsingAddOns:(BOOL) include_addons;
|
2005-05-21 08:15:49 +00:00
|
|
|
+ (BOOL) areRequirementsFulfilled:(NSDictionary*) requirements;
|
|
|
|
+ (void) addExternalPath:(NSString *)filename;
|
2005-07-05 11:59:46 +00:00
|
|
|
|
2005-04-19 19:53:18 +00:00
|
|
|
+ (NSDictionary *) dictionaryFromFilesNamed:(NSString *)filename inFolder:(NSString *)foldername andMerge:(BOOL) mergeFiles;
|
|
|
|
+ (NSArray *) arrayFromFilesNamed:(NSString *)filename inFolder:(NSString *)foldername andMerge:(BOOL) mergeFiles;
|
2005-07-05 11:59:46 +00:00
|
|
|
|
2005-04-19 19:53:18 +00:00
|
|
|
+ (NSSound *) soundNamed:(NSString *)filename inFolder:(NSString *)foldername;
|
|
|
|
+ (NSImage *) imageNamed:(NSString *)filename inFolder:(NSString *)foldername;
|
|
|
|
+ (NSString *) stringFromFilesNamed:(NSString *)filename inFolder:(NSString *)foldername;
|
2005-05-04 20:49:56 +00:00
|
|
|
#ifdef GNUSTEP
|
|
|
|
// This method name looks bizarre, but it's just that on OS X the music
|
|
|
|
// is played by QuickTime which calls everything 'movie', even though in
|
|
|
|
// this case it isn't.
|
|
|
|
+ (OOMusic *) movieFromFilesNamed:(NSString *)filename inFolder:(NSString *)foldername;
|
2005-05-23 11:57:23 +00:00
|
|
|
+ (SDLImage *) surfaceNamed:(NSString *)filename inFolder:(NSString *)foldername;
|
2005-05-04 20:49:56 +00:00
|
|
|
#else
|
2005-04-19 19:53:18 +00:00
|
|
|
+ (NSMovie *) movieFromFilesNamed:(NSString *)filename inFolder:(NSString *)foldername;
|
|
|
|
#endif
|
|
|
|
|
2005-07-09 22:00:55 +00:00
|
|
|
+ (NSMutableArray *) scanTokensFromString:(NSString*) values;
|
|
|
|
+ (NSString *) decodeString:(NSString*) encodedString;
|
|
|
|
+ (OOXMLElement) parseOOXMLElement:(NSScanner*) scanner upTo:(NSString*)closingTag;
|
|
|
|
+ (NSObject*) parseXMLPropertyList:(NSString*)xmlString;
|
|
|
|
+ (NSObject*) objectFromXMLElement:(NSArray*) xmlElement;
|
|
|
|
+ (NSNumber*) trueFromXMLContent:(NSObject*) xmlContent;
|
|
|
|
+ (NSNumber*) falseFromXMLContent:(NSObject*) xmlContent;
|
|
|
|
+ (NSNumber*) realFromXMLContent:(NSObject*) xmlContent;
|
|
|
|
+ (NSNumber*) integerFromXMLContent:(NSObject*) xmlContent;
|
|
|
|
+ (NSString*) stringFromXMLContent:(NSObject*) xmlContent;
|
|
|
|
+ (NSDate*) dateFromXMLContent:(NSObject*) xmlContent;
|
|
|
|
+ (NSData*) dataFromXMLContent:(NSObject*) xmlContent;
|
|
|
|
+ (NSArray*) arrayFromXMLContent:(NSObject*) xmlContent;
|
|
|
|
+ (NSDictionary*) dictionaryFromXMLContent:(NSObject*) xmlContent;
|
|
|
|
|
2005-10-01 16:32:46 +00:00
|
|
|
+ (NSString*) stringFromGLFloats: (GLfloat*) float_array : (int) n_floats;
|
|
|
|
+ (void) GLFloatsFromString: (NSString*) float_string: (GLfloat*) float_array;
|
|
|
|
|
|
|
|
+ (NSString*) stringFromNSPoint: (NSPoint) point;
|
|
|
|
+ (NSPoint) NSPointFromString: (NSString*) point_string;
|
|
|
|
|
2005-04-19 19:53:18 +00:00
|
|
|
@end
|