blob: af0004f991d4d5c5beb3d84400753cc5dcd436b2 [file] [log] [blame]
yangsu@google.com1a2b4c12011-06-24 17:20:50 +00001#ifndef SkStream_NSData_DEFINED
2#define SkStream_NSData_DEFINED
3
4#import <UIKit/UIKit.h>
5#include "SkStream.h"
6
7/** Returns an NSData with a copy of the stream's data. The caller must call
8 retain if it intends to keep the data object beyond the current stack-frame
9 (i.e. internally we're calling [NSData dataWithBytes...]
10 */
11NSData* NSData_dataWithStream(SkStream* stream);
12
13/** Returns an NSData from the named resource (from main bundle).
14 The caller must call retain if it intends to keep the data object beyond
15 the current stack-frame
16 (i.e. internally we're calling [NSData dataWithContentsOfMappedFile...]
17 */
18NSData* NSData_dataFromResource(const char name[], const char suffix[]);
19
20/** Wrap a stream around NSData.
21 */
22class SkStream_NSData : public SkMemoryStream {
23public:
24 SkStream_NSData(NSData* data);
25 virtual ~SkStream_NSData();
26
27 static SkStream_NSData* CreateFromResource(const char name[],
28 const char suffix[]);
29
30private:
31 NSData* fNSData;
32};
33
34#endif