#ifndef PPAPI_SHARED_IMPL_DICTIONARY_VAR_H_
#define PPAPI_SHARED_IMPL_DICTIONARY_VAR_H_
#include <map>
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
#include "ppapi/shared_impl/scoped_pp_var.h"
#include "ppapi/shared_impl/var.h"
namespace ppapi {
class PPAPI_SHARED_EXPORT DictionaryVar : public Var {
public:
typedef std::map<std::string, ScopedPPVar> KeyValueMap;
DictionaryVar();
static DictionaryVar* FromPPVar(const PP_Var& var);
virtual DictionaryVar* AsDictionaryVar() OVERRIDE;
virtual PP_VarType GetType() const OVERRIDE;
PP_Var Get(const PP_Var& key) const;
PP_Bool Set(const PP_Var& key, const PP_Var& value);
void Delete(const PP_Var& key);
PP_Bool HasKey(const PP_Var& key) const;
PP_Var GetKeys() const;
bool SetWithStringKey(const std::string& utf8_key, const PP_Var& value);
void DeleteWithStringKey(const std::string& utf8_key);
const KeyValueMap& key_value_map() const { return key_value_map_; }
protected:
virtual ~DictionaryVar();
private:
KeyValueMap key_value_map_;
DISALLOW_COPY_AND_ASSIGN(DictionaryVar);
};
}
#endif