OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkStream_DEFINED | 10 #ifndef SkStream_DEFINED |
11 #define SkStream_DEFINED | 11 #define SkStream_DEFINED |
12 | 12 |
13 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
14 #include "SkScalar.h" | 14 #include "SkScalar.h" |
15 | 15 |
16 class SkData; | 16 class SkData; |
17 | 17 |
18 class SK_API SkStream : public SkRefCnt { | 18 class SK_API SkStream : public SkRefCnt { |
19 public: | 19 public: |
| 20 /** |
| 21 * Attempts to open the specified file, and return a stream to it (using |
| 22 * mmap if available). On success, the caller must call unref() on the |
| 23 * returned object. On failure, returns NULL. |
| 24 */ |
| 25 static SkStream* NewFromFile(const char path[]); |
| 26 |
20 SK_DECLARE_INST_COUNT(SkStream) | 27 SK_DECLARE_INST_COUNT(SkStream) |
21 | 28 |
22 /** Called to rewind to the beginning of the stream. If this cannot be | 29 /** Called to rewind to the beginning of the stream. If this cannot be |
23 done, return false. | 30 done, return false. |
24 */ | 31 */ |
25 virtual bool rewind() = 0; | 32 virtual bool rewind() = 0; |
26 /** If this stream represents a file, this method returns the file's name. | 33 /** If this stream represents a file, this method returns the file's name. |
27 If it does not, it returns NULL (the default behavior). | 34 If it does not, it returns NULL (the default behavior). |
28 */ | 35 */ |
29 virtual const char* getFileName(); | 36 virtual const char* getFileName(); |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 virtual void newline() SK_OVERRIDE; | 380 virtual void newline() SK_OVERRIDE; |
374 | 381 |
375 private: | 382 private: |
376 typedef SkWStream INHERITED; | 383 typedef SkWStream INHERITED; |
377 }; | 384 }; |
378 | 385 |
379 // for now | 386 // for now |
380 typedef SkFILEStream SkURLStream; | 387 typedef SkFILEStream SkURLStream; |
381 | 388 |
382 #endif | 389 #endif |
OLD | NEW |