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

Side by Side Diff: ppapi/cpp/dev/var_dictionary_dev.h

Issue 12387073: Add PPB_VarDictionary_Dev support - part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/c/dev/ppb_var_dictionary_dev.h ('k') | ppapi/cpp/dev/var_dictionary_dev.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_
6 #define PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_
7
8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/cpp/var.h"
10
11 /// @file
12 /// This file defines the API for interacting with dictionary vars.
13
14 namespace pp {
15
16 class VarDictionary_Dev : public Var {
17 public:
18 /// Constructs a new dictionary var.
19 VarDictionary_Dev();
20
21 /// Contructs a <code>VarDictionary_Dev</code> given a var for which
22 /// is_dictionary() is true. This will refer to the same dictionary var, but
23 /// allow you to access methods specific to dictionary.
24 ///
25 /// @param[in] var A dictionary var.
26 explicit VarDictionary_Dev(const Var& var);
27
28 /// Copy constructor.
29 VarDictionary_Dev(const VarDictionary_Dev& other);
30
31 virtual ~VarDictionary_Dev();
32
33 /// Assignment operator.
34 VarDictionary_Dev& operator=(const VarDictionary_Dev& other);
35
36 /// The <code>Var</code> assignment operator is overridden here so that we can
37 /// check for assigning a non-dictionary var to a
38 /// <code>VarDictionary_Dev</code>.
39 ///
40 /// @param[in] other The dictionary var to be assigned.
41 ///
42 /// @return The resulting <code>VarDictionary_Dev</code> (as a
43 /// <code>Var</code>&).
44 virtual Var& operator=(const Var& other);
45
46 /// Gets the value associated with the specified key.
47 ///
48 /// @param[in] key A string var.
49 ///
50 /// @return The value that is associated with <code>key</code>. If
51 /// <code>key</code> is not a string var, or it doesn't exist in the
52 /// dictionary, an undefined var is returned.
53 Var Get(const Var& key) const;
54
55 /// Sets the value associated with the specified key.
56 ///
57 /// @param[in] key A string var. If this key hasn't existed in the dictionary,
58 /// it is added and associated with <code>value</code>; otherwise, the
59 /// previous value is replaced with <code>value</code>.
60 /// @param[in] value The value to set.
61 ///
62 /// @return A <code>PP_Bool</code> indicating whether the operation succeeds.
63 PP_Bool Set(const Var& key, const Var& value);
64
65 /// Deletes the specified key and its associated value, if the key exists.
66 ///
67 /// @param[in] key A string var.
68 void Delete(const Var& key);
69
70 /// Checks whether a key exists.
71 ///
72 /// @param[in] key A string var.
73 ///
74 /// @return A <code>PP_Bool</code> indicating whether the key exists.
75 PP_Bool HasKey(const Var& key) const;
76
77 /// Gets all the keys in the dictionary.
78 ///
79 /// @return An array var which contains all the keys of the dictionary.
80 /// The elements are string vars. Returns a null var if failed.
81 /// TODO(yzshen): Change Var to VarArray_Dev once it is supported.
82 Var GetKeys() const;
83 };
84
85 } // namespace pp
86
87 #endif // PPAPI_CPP_DEV_VAR_DICTIONARY_DEV_H_
OLDNEW
« no previous file with comments | « ppapi/c/dev/ppb_var_dictionary_dev.h ('k') | ppapi/cpp/dev/var_dictionary_dev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698