diff options
Diffstat (limited to 'wearable_src/Common/JSObjectRefWrapper.h')
-rw-r--r-- | wearable_src/Common/JSObjectRefWrapper.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/wearable_src/Common/JSObjectRefWrapper.h b/wearable_src/Common/JSObjectRefWrapper.h new file mode 100644 index 0000000..d06cb09 --- /dev/null +++ b/wearable_src/Common/JSObjectRefWrapper.h @@ -0,0 +1,64 @@ +// +// Tizen Web Device API +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file JSObjectRefWrapper.h + * @version 0.1 + * @brief + */ + +#ifndef _JS_OBJECT_REF_WRAPPER_H_ +#define _JS_OBJECT_REF_WRAPPER_H_ + +#include <JavaScriptCore/JavaScript.h> + +#include <string> + +namespace DeviceAPI { +namespace Common { + +class JSObjectRefWrapper +{ +public: + JSObjectRefWrapper(JSContextRef context, JSObjectRef object); + virtual ~JSObjectRefWrapper(); + + JSContextRef getContext() const; + JSObjectRef getObject() const; + +protected: + void protect(); + void unprotect(); + + JSValueRef getProperty(const std::string propertyName) const; + + JSObjectRef getPropertyObject(const std::string propertyName) const; + + std::string getPropertyString(const std::string propertyName) const; + +protected: + JSContextRef m_context; + JSObjectRef m_object; + +private: + int m_protectCount; +}; + +} // Common +} // DeviceAPI + +#endif // _JS_OBJECT_REF_WRAPPER_H_ |