1 #ifndef __DALI_SCOPED_POINTER_H__
2 #define __DALI_SCOPED_POINTER_H__
4 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
24 * @brief Deletes the object pointed-to when it goes out of scope.
26 * A simple template class to call delete on an owned pointer when it goes
27 * out of scope, whether that be by ordinary return or stack unwind for
30 template<typename Owned>
36 * @brief Construct a ScopedPointer guarding a new Owned*.
38 ScopedPointer( Owned * const owned ) :
43 * @brief Destroy the ScopedPointer and clean up its Owned*.
55 * @brief Getter for the underlying pointer.
56 * @return The Owned* guarded by this object.
64 * @brief Give up ownership of the object guarded by this pointer.
65 * @return The Owned* previously guarded by this object.
69 Owned* const owned = mOwned;
75 * @brief Dereference this pointer.
77 Owned& operator*() const
83 * @brief Allow member access through arrow notation.
85 Owned * operator->() const
93 ScopedPointer( const ScopedPointer& rhs );
94 ScopedPointer& operator = ( const ScopedPointer& rhs );
99 } /* namespace Dali */
101 #endif /* __DALI_SCOPED_POINTER_H__ */