Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(523)

Side by Side Diff: include/core/SkStream.h

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkShader.h ('k') | include/core/SkTypes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkStream_DEFINED 8 #ifndef SkStream_DEFINED
9 #define SkStream_DEFINED 9 #define SkStream_DEFINED
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 //SkStreamMemory 124 //SkStreamMemory
125 /** Returns the starting address for the data. If this cannot be done, retur ns NULL. */ 125 /** Returns the starting address for the data. If this cannot be done, retur ns NULL. */
126 //TODO: replace with virtual const SkData* getData() 126 //TODO: replace with virtual const SkData* getData()
127 virtual const void* getMemoryBase() { return NULL; } 127 virtual const void* getMemoryBase() { return NULL; }
128 }; 128 };
129 129
130 /** SkStreamRewindable is a SkStream for which rewind and duplicate are required . */ 130 /** SkStreamRewindable is a SkStream for which rewind and duplicate are required . */
131 class SK_API SkStreamRewindable : public SkStream { 131 class SK_API SkStreamRewindable : public SkStream {
132 public: 132 public:
133 bool rewind() SK_OVERRIDE = 0; 133 bool rewind() override = 0;
134 SkStreamRewindable* duplicate() const SK_OVERRIDE = 0; 134 SkStreamRewindable* duplicate() const override = 0;
135 }; 135 };
136 136
137 /** SkStreamSeekable is a SkStreamRewindable for which position, seek, move, and fork are required. */ 137 /** SkStreamSeekable is a SkStreamRewindable for which position, seek, move, and fork are required. */
138 class SK_API SkStreamSeekable : public SkStreamRewindable { 138 class SK_API SkStreamSeekable : public SkStreamRewindable {
139 public: 139 public:
140 SkStreamSeekable* duplicate() const SK_OVERRIDE = 0; 140 SkStreamSeekable* duplicate() const override = 0;
141 141
142 bool hasPosition() const SK_OVERRIDE { return true; } 142 bool hasPosition() const override { return true; }
143 size_t getPosition() const SK_OVERRIDE = 0; 143 size_t getPosition() const override = 0;
144 bool seek(size_t position) SK_OVERRIDE = 0; 144 bool seek(size_t position) override = 0;
145 bool move(long offset) SK_OVERRIDE = 0; 145 bool move(long offset) override = 0;
146 SkStreamSeekable* fork() const SK_OVERRIDE = 0; 146 SkStreamSeekable* fork() const override = 0;
147 }; 147 };
148 148
149 /** SkStreamAsset is a SkStreamSeekable for which getLength is required. */ 149 /** SkStreamAsset is a SkStreamSeekable for which getLength is required. */
150 class SK_API SkStreamAsset : public SkStreamSeekable { 150 class SK_API SkStreamAsset : public SkStreamSeekable {
151 public: 151 public:
152 SkStreamAsset* duplicate() const SK_OVERRIDE = 0; 152 SkStreamAsset* duplicate() const override = 0;
153 SkStreamAsset* fork() const SK_OVERRIDE = 0; 153 SkStreamAsset* fork() const override = 0;
154 154
155 bool hasLength() const SK_OVERRIDE { return true; } 155 bool hasLength() const override { return true; }
156 size_t getLength() const SK_OVERRIDE = 0; 156 size_t getLength() const override = 0;
157 }; 157 };
158 158
159 /** SkStreamMemory is a SkStreamAsset for which getMemoryBase is required. */ 159 /** SkStreamMemory is a SkStreamAsset for which getMemoryBase is required. */
160 class SK_API SkStreamMemory : public SkStreamAsset { 160 class SK_API SkStreamMemory : public SkStreamAsset {
161 public: 161 public:
162 SkStreamMemory* duplicate() const SK_OVERRIDE = 0; 162 SkStreamMemory* duplicate() const override = 0;
163 SkStreamMemory* fork() const SK_OVERRIDE = 0; 163 SkStreamMemory* fork() const override = 0;
164 164
165 const void* getMemoryBase() SK_OVERRIDE = 0; 165 const void* getMemoryBase() override = 0;
166 }; 166 };
167 167
168 class SK_API SkWStream : SkNoncopyable { 168 class SK_API SkWStream : SkNoncopyable {
169 public: 169 public:
170 SK_DECLARE_INST_COUNT(SkWStream) 170 SK_DECLARE_INST_COUNT(SkWStream)
171 171
172 virtual ~SkWStream(); 172 virtual ~SkWStream();
173 173
174 /** Called to write bytes to a SkWStream. Returns true on success 174 /** Called to write bytes to a SkWStream. Returns true on success
175 @param buffer the address of at least size bytes to be written to the st ream 175 @param buffer the address of at least size bytes to be written to the st ream
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 virtual ~SkFILEStream(); 238 virtual ~SkFILEStream();
239 239
240 /** Returns true if the current path could be opened. */ 240 /** Returns true if the current path could be opened. */
241 bool isValid() const { return fFILE != NULL; } 241 bool isValid() const { return fFILE != NULL; }
242 242
243 /** Close the current file, and open a new file with the specified path. 243 /** Close the current file, and open a new file with the specified path.
244 * If path is NULL, just close the current file. 244 * If path is NULL, just close the current file.
245 */ 245 */
246 void setPath(const char path[]); 246 void setPath(const char path[]);
247 247
248 size_t read(void* buffer, size_t size) SK_OVERRIDE; 248 size_t read(void* buffer, size_t size) override;
249 bool isAtEnd() const SK_OVERRIDE; 249 bool isAtEnd() const override;
250 250
251 bool rewind() SK_OVERRIDE; 251 bool rewind() override;
252 SkStreamAsset* duplicate() const SK_OVERRIDE; 252 SkStreamAsset* duplicate() const override;
253 253
254 size_t getPosition() const SK_OVERRIDE; 254 size_t getPosition() const override;
255 bool seek(size_t position) SK_OVERRIDE; 255 bool seek(size_t position) override;
256 bool move(long offset) SK_OVERRIDE; 256 bool move(long offset) override;
257 SkStreamAsset* fork() const SK_OVERRIDE; 257 SkStreamAsset* fork() const override;
258 258
259 size_t getLength() const SK_OVERRIDE; 259 size_t getLength() const override;
260 260
261 const void* getMemoryBase() SK_OVERRIDE; 261 const void* getMemoryBase() override;
262 262
263 private: 263 private:
264 SkFILE* fFILE; 264 SkFILE* fFILE;
265 SkString fName; 265 SkString fName;
266 Ownership fOwnership; 266 Ownership fOwnership;
267 // fData is lazilly initialized when needed. 267 // fData is lazilly initialized when needed.
268 mutable SkAutoTUnref<SkData> fData; 268 mutable SkAutoTUnref<SkData> fData;
269 269
270 typedef SkStreamAsset INHERITED; 270 typedef SkStreamAsset INHERITED;
271 }; 271 };
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 * Use the specified data as the memory for this stream. 310 * Use the specified data as the memory for this stream.
311 * The stream will call ref() on the data (assuming it is not NULL). 311 * The stream will call ref() on the data (assuming it is not NULL).
312 * The function returns the data parameter as a convenience. 312 * The function returns the data parameter as a convenience.
313 */ 313 */
314 SkData* setData(SkData*); 314 SkData* setData(SkData*);
315 315
316 void skipToAlign4(); 316 void skipToAlign4();
317 const void* getAtPos(); 317 const void* getAtPos();
318 size_t peek() const { return fOffset; } 318 size_t peek() const { return fOffset; }
319 319
320 size_t read(void* buffer, size_t size) SK_OVERRIDE; 320 size_t read(void* buffer, size_t size) override;
321 bool isAtEnd() const SK_OVERRIDE; 321 bool isAtEnd() const override;
322 322
323 bool rewind() SK_OVERRIDE; 323 bool rewind() override;
324 SkMemoryStream* duplicate() const SK_OVERRIDE; 324 SkMemoryStream* duplicate() const override;
325 325
326 size_t getPosition() const SK_OVERRIDE; 326 size_t getPosition() const override;
327 bool seek(size_t position) SK_OVERRIDE; 327 bool seek(size_t position) override;
328 bool move(long offset) SK_OVERRIDE; 328 bool move(long offset) override;
329 SkMemoryStream* fork() const SK_OVERRIDE; 329 SkMemoryStream* fork() const override;
330 330
331 size_t getLength() const SK_OVERRIDE; 331 size_t getLength() const override;
332 332
333 const void* getMemoryBase() SK_OVERRIDE; 333 const void* getMemoryBase() override;
334 334
335 private: 335 private:
336 SkData* fData; 336 SkData* fData;
337 size_t fOffset; 337 size_t fOffset;
338 338
339 typedef SkStreamMemory INHERITED; 339 typedef SkStreamMemory INHERITED;
340 }; 340 };
341 341
342 //////////////////////////////////////////////////////////////////////////////// ///////////// 342 //////////////////////////////////////////////////////////////////////////////// /////////////
343 343
344 class SK_API SkFILEWStream : public SkWStream { 344 class SK_API SkFILEWStream : public SkWStream {
345 public: 345 public:
346 SK_DECLARE_INST_COUNT(SkFILEWStream) 346 SK_DECLARE_INST_COUNT(SkFILEWStream)
347 347
348 SkFILEWStream(const char path[]); 348 SkFILEWStream(const char path[]);
349 virtual ~SkFILEWStream(); 349 virtual ~SkFILEWStream();
350 350
351 /** Returns true if the current path could be opened. 351 /** Returns true if the current path could be opened.
352 */ 352 */
353 bool isValid() const { return fFILE != NULL; } 353 bool isValid() const { return fFILE != NULL; }
354 354
355 bool write(const void* buffer, size_t size) SK_OVERRIDE; 355 bool write(const void* buffer, size_t size) override;
356 void flush() SK_OVERRIDE; 356 void flush() override;
357 size_t bytesWritten() const SK_OVERRIDE; 357 size_t bytesWritten() const override;
358 358
359 private: 359 private:
360 SkFILE* fFILE; 360 SkFILE* fFILE;
361 361
362 typedef SkWStream INHERITED; 362 typedef SkWStream INHERITED;
363 }; 363 };
364 364
365 class SkMemoryWStream : public SkWStream { 365 class SkMemoryWStream : public SkWStream {
366 public: 366 public:
367 SK_DECLARE_INST_COUNT(SkMemoryWStream) 367 SK_DECLARE_INST_COUNT(SkMemoryWStream)
368 368
369 SkMemoryWStream(void* buffer, size_t size); 369 SkMemoryWStream(void* buffer, size_t size);
370 bool write(const void* buffer, size_t size) SK_OVERRIDE; 370 bool write(const void* buffer, size_t size) override;
371 size_t bytesWritten() const SK_OVERRIDE { return fBytesWritten; } 371 size_t bytesWritten() const override { return fBytesWritten; }
372 372
373 private: 373 private:
374 char* fBuffer; 374 char* fBuffer;
375 size_t fMaxLength; 375 size_t fMaxLength;
376 size_t fBytesWritten; 376 size_t fBytesWritten;
377 377
378 typedef SkWStream INHERITED; 378 typedef SkWStream INHERITED;
379 }; 379 };
380 380
381 class SK_API SkDynamicMemoryWStream : public SkWStream { 381 class SK_API SkDynamicMemoryWStream : public SkWStream {
382 public: 382 public:
383 SK_DECLARE_INST_COUNT(SkDynamicMemoryWStream) 383 SK_DECLARE_INST_COUNT(SkDynamicMemoryWStream)
384 384
385 SkDynamicMemoryWStream(); 385 SkDynamicMemoryWStream();
386 virtual ~SkDynamicMemoryWStream(); 386 virtual ~SkDynamicMemoryWStream();
387 387
388 bool write(const void* buffer, size_t size) SK_OVERRIDE; 388 bool write(const void* buffer, size_t size) override;
389 size_t bytesWritten() const SK_OVERRIDE { return fBytesWritten; } 389 size_t bytesWritten() const override { return fBytesWritten; }
390 // random access write 390 // random access write
391 // modifies stream and returns true if offset + size is less than or equal t o getOffset() 391 // modifies stream and returns true if offset + size is less than or equal t o getOffset()
392 bool write(const void* buffer, size_t offset, size_t size); 392 bool write(const void* buffer, size_t offset, size_t size);
393 bool read(void* buffer, size_t offset, size_t size); 393 bool read(void* buffer, size_t offset, size_t size);
394 size_t getOffset() const { return fBytesWritten; } 394 size_t getOffset() const { return fBytesWritten; }
395 395
396 // copy what has been written to the stream into dst 396 // copy what has been written to the stream into dst
397 void copyTo(void* dst) const; 397 void copyTo(void* dst) const;
398 void writeToStream(SkWStream* dst) const; 398 void writeToStream(SkWStream* dst) const;
399 399
(...skipping 25 matching lines...) Expand all
425 typedef SkWStream INHERITED; 425 typedef SkWStream INHERITED;
426 }; 426 };
427 427
428 428
429 class SK_API SkDebugWStream : public SkWStream { 429 class SK_API SkDebugWStream : public SkWStream {
430 public: 430 public:
431 SkDebugWStream() : fBytesWritten(0) {} 431 SkDebugWStream() : fBytesWritten(0) {}
432 SK_DECLARE_INST_COUNT(SkDebugWStream) 432 SK_DECLARE_INST_COUNT(SkDebugWStream)
433 433
434 // overrides 434 // overrides
435 bool write(const void* buffer, size_t size) SK_OVERRIDE; 435 bool write(const void* buffer, size_t size) override;
436 void newline() SK_OVERRIDE; 436 void newline() override;
437 size_t bytesWritten() const SK_OVERRIDE { return fBytesWritten; } 437 size_t bytesWritten() const override { return fBytesWritten; }
438 438
439 private: 439 private:
440 size_t fBytesWritten; 440 size_t fBytesWritten;
441 typedef SkWStream INHERITED; 441 typedef SkWStream INHERITED;
442 }; 442 };
443 443
444 // for now 444 // for now
445 typedef SkFILEStream SkURLStream; 445 typedef SkFILEStream SkURLStream;
446 446
447 #endif 447 #endif
OLDNEW
« no previous file with comments | « include/core/SkShader.h ('k') | include/core/SkTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698