2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef WRTDEVICEAPIS_COMMONSJAVASCRIPT_SCOPEDJSSTRINGREF_H_
17 #define WRTDEVICEAPIS_COMMONSJAVASCRIPT_SCOPEDJSSTRINGREF_H_
19 #include <JavaScriptCore/JavaScript.h>
20 #include <dpl/noncopyable.h>
22 namespace WrtDeviceApis {
23 namespace CommonsJavaScript {
25 * Takes ownership over JSStringRef object to call JSSTringRelease on it
26 * when this object goes out of scope.
28 class ScopedJSStringRef : private DPL::Noncopyable
32 * Creates this class instance.
33 * @param ref JSStringRef to take ownership.
34 * @remarks Takes ownership.
36 ScopedJSStringRef(JSStringRef ref);
40 * @remarks Releases stored JSStringRef.
45 * Gets stored JSStringRef.
46 * @return JSStringRef object.
47 * @remarks Doesn't pass ownership to caller.
49 JSStringRef get() const;
54 } // CommonsJavaScript
57 #endif /* WRTDEVICEAPIS_COMMONSJAVASCRIPT_SCOPEDJSSTRINGREF_H_ */