| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PPAPI_CPP_PRIVATE_VAR_PRIVATE_H_ | 5 #ifndef PPAPI_CPP_PRIVATE_VAR_PRIVATE_H_ |
| 6 #define PPAPI_CPP_PRIVATE_VAR_PRIVATE_H_ | 6 #define PPAPI_CPP_PRIVATE_VAR_PRIVATE_H_ |
| 7 | 7 |
| 8 #include "ppapi/cpp/var.h" | 8 #include "ppapi/cpp/var.h" |
| 9 | 9 |
| 10 namespace pp { | 10 namespace pp { |
| 11 | 11 |
| 12 class InstancePrivate; |
| 13 |
| 12 // VarPrivate is a version of Var that exposes the private scripting API. | 14 // VarPrivate is a version of Var that exposes the private scripting API. |
| 13 // It's designed to be mostly interchangable with Var since most callers will | 15 // It's designed to be mostly interchangable with Var since most callers will |
| 14 // be dealing with Vars from various places. | 16 // be dealing with Vars from various places. |
| 15 class VarPrivate : public Var { | 17 class VarPrivate : public Var { |
| 16 public: | 18 public: |
| 17 VarPrivate() : Var() {} | 19 VarPrivate() : Var() {} |
| 18 VarPrivate(Null) : Var(Null()) {} | 20 VarPrivate(Null) : Var(Null()) {} |
| 19 VarPrivate(bool b) : Var(b) {} | 21 VarPrivate(bool b) : Var(b) {} |
| 20 VarPrivate(int32_t i) : Var(i) {} | 22 VarPrivate(int32_t i) : Var(i) {} |
| 21 VarPrivate(double d) : Var(d) {} | 23 VarPrivate(double d) : Var(d) {} |
| 22 VarPrivate(const char* utf8_str) : Var(utf8_str) {} | 24 VarPrivate(const char* utf8_str) : Var(utf8_str) {} |
| 23 VarPrivate(const std::string& utf8_str) : Var(utf8_str) {} | 25 VarPrivate(const std::string& utf8_str) : Var(utf8_str) {} |
| 24 VarPrivate(PassRef, PP_Var var) : Var(PassRef(), var) {} | 26 VarPrivate(PassRef, PP_Var var) : Var(PassRef(), var) {} |
| 25 VarPrivate(DontManage, PP_Var var) : Var(DontManage(), var) {} | 27 VarPrivate(DontManage, PP_Var var) : Var(DontManage(), var) {} |
| 26 VarPrivate(Instance* instance, deprecated::ScriptableObject* object); | 28 VarPrivate(InstancePrivate* instance, deprecated::ScriptableObject* object); |
| 27 VarPrivate(const Var& other) : Var(other) {} | 29 VarPrivate(const Var& other) : Var(other) {} |
| 28 | 30 |
| 29 virtual ~VarPrivate() {} | 31 virtual ~VarPrivate() {} |
| 30 | 32 |
| 31 // This assumes the object is of type object. If it's not, it will assert in | 33 // This assumes the object is of type object. If it's not, it will assert in |
| 32 // debug mode. If it is not an object or not a ScriptableObject type, returns | 34 // debug mode. If it is not an object or not a ScriptableObject type, returns |
| 33 // NULL. | 35 // NULL. |
| 34 deprecated::ScriptableObject* AsScriptableObject() const; | 36 deprecated::ScriptableObject* AsScriptableObject() const; |
| 35 | 37 |
| 36 bool HasProperty(const Var& name, Var* exception = NULL) const; | 38 bool HasProperty(const Var& name, Var* exception = NULL) const; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 private: | 110 private: |
| 109 // Prevent an arbitrary pointer argument from being implicitly converted to | 111 // Prevent an arbitrary pointer argument from being implicitly converted to |
| 110 // a bool at Var construction. If somebody makes such a mistake, (s)he will | 112 // a bool at Var construction. If somebody makes such a mistake, (s)he will |
| 111 // get a compilation error. | 113 // get a compilation error. |
| 112 VarPrivate(void* non_scriptable_object_pointer); | 114 VarPrivate(void* non_scriptable_object_pointer); |
| 113 }; | 115 }; |
| 114 | 116 |
| 115 } // namespace pp | 117 } // namespace pp |
| 116 | 118 |
| 117 #endif // PPAPI_CPP_PRIVATE_VAR_PRIVATE_H_ | 119 #endif // PPAPI_CPP_PRIVATE_VAR_PRIVATE_H_ |
| OLD | NEW |