| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 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 SkPDFTypes_DEFINED | 10 #ifndef SkPDFTypes_DEFINED |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 362 |
| 363 virtual ~SkPDFDict(); | 363 virtual ~SkPDFDict(); |
| 364 | 364 |
| 365 // The SkPDFObject interface. | 365 // The SkPDFObject interface. |
| 366 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog, | 366 virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog, |
| 367 bool indirect); | 367 bool indirect); |
| 368 virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect); | 368 virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect); |
| 369 | 369 |
| 370 /** The size of the dictionary. | 370 /** The size of the dictionary. |
| 371 */ | 371 */ |
| 372 int size() { return fValue.count(); } | 372 int size() const; |
| 373 | 373 |
| 374 /** Add the value to the dictionary with the given key. Refs value. | 374 /** Add the value to the dictionary with the given key. Refs value. |
| 375 * @param key The key for this dictionary entry. | 375 * @param key The key for this dictionary entry. |
| 376 * @param value The value for this dictionary entry. | 376 * @param value The value for this dictionary entry. |
| 377 * @return The value argument is returned. | 377 * @return The value argument is returned. |
| 378 */ | 378 */ |
| 379 SkPDFObject* insert(SkPDFName* key, SkPDFObject* value); | 379 SkPDFObject* insert(SkPDFName* key, SkPDFObject* value); |
| 380 | 380 |
| 381 /** Add the value to the dictionary with the given key. Refs value. The | 381 /** Add the value to the dictionary with the given key. Refs value. The |
| 382 * method will create the SkPDFName object. | 382 * method will create the SkPDFName object. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 * @param name The name for this dictionary entry. | 417 * @param name The name for this dictionary entry. |
| 418 */ | 418 */ |
| 419 void insertName(const char key[], const SkString& name) { | 419 void insertName(const char key[], const SkString& name) { |
| 420 this->insertName(key, name.c_str()); | 420 this->insertName(key, name.c_str()); |
| 421 } | 421 } |
| 422 | 422 |
| 423 /** Remove all entries from the dictionary. | 423 /** Remove all entries from the dictionary. |
| 424 */ | 424 */ |
| 425 void clear(); | 425 void clear(); |
| 426 | 426 |
| 427 protected: |
| 428 /** Use to remove a single key from the dictionary. |
| 429 */ |
| 430 void remove(const char key[]); |
| 431 |
| 432 /** Insert references to all of the key-value pairs from the other |
| 433 * dictionary into this one. |
| 434 */ |
| 435 void mergeFrom(const SkPDFDict& other); |
| 436 |
| 427 private: | 437 private: |
| 428 struct Rec { | 438 struct Rec { |
| 429 SkPDFName* key; | 439 SkPDFName* key; |
| 430 SkPDFObject* value; | 440 SkPDFObject* value; |
| 441 Rec(SkPDFName* k, SkPDFObject* v) : key(k), value(v) {} |
| 431 }; | 442 }; |
| 432 | 443 |
| 433 public: | |
| 434 class Iter { | |
| 435 public: | |
| 436 explicit Iter(const SkPDFDict& dict); | |
| 437 SkPDFName* next(SkPDFObject** value); | |
| 438 | |
| 439 private: | |
| 440 const Rec* fIter; | |
| 441 const Rec* fStop; | |
| 442 }; | |
| 443 | |
| 444 private: | |
| 445 static const int kMaxLen = 4095; | 444 static const int kMaxLen = 4095; |
| 446 | 445 |
| 446 mutable SkMutex fMutex; // protects modifications to fValue |
| 447 SkTDArray<struct Rec> fValue; | 447 SkTDArray<struct Rec> fValue; |
| 448 | 448 |
| 449 SkPDFObject* append(SkPDFName* key, SkPDFObject* value); |
| 450 |
| 449 typedef SkPDFObject INHERITED; | 451 typedef SkPDFObject INHERITED; |
| 450 }; | 452 }; |
| 451 | 453 |
| 452 #endif | 454 #endif |
| OLD | NEW |