gfx/skia/trunk/src/core/SkRefDict.h

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1
michael@0 2 /*
michael@0 3 * Copyright 2011 Google Inc.
michael@0 4 *
michael@0 5 * Use of this source code is governed by a BSD-style license that can be
michael@0 6 * found in the LICENSE file.
michael@0 7 */
michael@0 8
michael@0 9
michael@0 10 #ifndef SkRefDict_DEFINED
michael@0 11 #define SkRefDict_DEFINED
michael@0 12
michael@0 13 #include "SkRefCnt.h"
michael@0 14
michael@0 15 /**
michael@0 16 * A dictionary of string,refcnt pairs. The dictionary is also an owner of the
michael@0 17 * refcnt objects while they are contained.
michael@0 18 */
michael@0 19 class SK_API SkRefDict : SkNoncopyable {
michael@0 20 public:
michael@0 21 SkRefDict();
michael@0 22 ~SkRefDict();
michael@0 23
michael@0 24 /**
michael@0 25 * Return the data associated with name[], or NULL if no matching entry
michael@0 26 * is found. The reference-count of the entry is not affected.
michael@0 27 */
michael@0 28 SkRefCnt* find(const char name[]) const;
michael@0 29
michael@0 30 /**
michael@0 31 * If data is NULL, remove (if present) the entry matching name and call
michael@0 32 * prev_data->unref() on the data for the matching entry.
michael@0 33 * If data is not-NULL, replace the existing entry matching name and
michael@0 34 * call (prev_data->unref()), or add a new one. In either case,
michael@0 35 * data->ref() is called.
michael@0 36 */
michael@0 37 void set(const char name[], SkRefCnt* data);
michael@0 38
michael@0 39 /**
michael@0 40 * Remove the matching entry (if found) and unref its data.
michael@0 41 */
michael@0 42 void remove(const char name[]) { this->set(name, NULL); }
michael@0 43
michael@0 44 /**
michael@0 45 * Remove all entries, and unref() their associated data.
michael@0 46 */
michael@0 47 void removeAll();
michael@0 48
michael@0 49 private:
michael@0 50 struct Impl;
michael@0 51 Impl* fImpl;
michael@0 52 };
michael@0 53
michael@0 54 #endif

mercurial