| 1 | /* |
| 2 | * Copyright (C) 2006 Apple Computer, Inc. |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Library General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Library General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Library General Public License |
| 15 | * along with this library; see the file COPYING.LIB. If not, write to |
| 16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #ifndef WTF_OwnArrayPtr_h |
| 22 | #define WTF_OwnArrayPtr_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/OwnArrayPtr.h:22:9`! |
| 23 | |
| 24 | #include <algorithm> |
| 25 | #include <wtf/Assertions.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h`/ |
| 26 | #include <wtf/Noncopyable.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Noncopyable.h`/ |
| 27 | |
| 28 | namespace WTFcxx . . $ `<built-in>:467:9`! { |
| 29 | |
| 30 | template <typename T> class OwnArrayPtrcxx . . $ QTWTF/OwnArrayPtr# : public Noncopyablecxx . . $ Noncopyable# { |
| 31 | public: |
| 32 | explicit OwnArrayPtrcxx . . $ QTWTF/OwnArrayPtr#`OwnArrayPtr<T>`(ebd0a1552f8ce24f).(T* ptr = 0) : m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr.(ptr) { } |
| 33 | ~cxx . . $ QTWTF/OwnArrayPtr#`~OwnArrayPtr<T>`(49f6e7a06ebc5aa8).OwnArrayPtr() { safeDeletecxx . . $ QTWTF/OwnArrayPtr#safeDelete(49f6e7a06ebc5aa8).(); } |
| 34 | |
| 35 | T* getcxx . . $ QTWTF/OwnArrayPtr#get(5a2a78a048fb49a8).() const { return m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr.; } |
| 36 | T* releasecxx . . $ QTWTF/OwnArrayPtr#release(155dc7f103cdb9db).() { T* ptr = m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr.; m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr. = 0; return ptr; } |
| 37 | |
| 38 | void setcxx . . $ QTWTF/OwnArrayPtr#set(ebd0a1552f8ce24f).(T* ptr) { ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(m_ptr != ptr); safeDeletecxx . . $ QTWTF/OwnArrayPtr#safeDelete(49f6e7a06ebc5aa8).(); m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr. = ptr; } |
| 39 | void clearcxx . . $ QTWTF/OwnArrayPtr#clear(49f6e7a06ebc5aa8).() { safeDeletecxx . . $ QTWTF/OwnArrayPtr#safeDelete(49f6e7a06ebc5aa8).(); m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr. = 0; } |
| 40 | |
| 41 | T& operatorcxx . . $ QTWTF/OwnArrayPtr#`operator*`(c93303b41ac66b6d).*() const { ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(m_ptr); return *m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr.; } |
| 42 | T* operatorcxx . . $ QTWTF/OwnArrayPtr#`operator->`(5a2a78a048fb49a8).->() const { ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(m_ptr); return m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr.; } |
| 43 | |
| 44 | T& operatorcxx . . $ QTWTF/OwnArrayPtr#`operator[]`(8a4599b8835d1ce1).[](stdcxx . . $ std/::ptrdiff_tcxx . . $ std/ptrdiff_t# i) const { ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(m_ptr); ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(i >= 0); return m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr.[i]; } |
| 45 | |
| 46 | bool operatorcxx . . $ QTWTF/OwnArrayPtr#`operator!`(50ce9a9e25b4a850).!() const { return !m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr.; } |
| 47 | |
| 48 | // This conversion operator allows implicit conversion to bool but not to other integer types. |
| 49 | #if COMPILERcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:39:9`!(WINSCW) |
| 50 | operator bool() const { return m_ptr; } |
| 51 | #else |
| 52 | typedef T* OwnArrayPtrcxx . . $ QTWTF/OwnArrayPtr#::*UnspecifiedBoolTypecxx . . $ QTWTF/OwnArrayPtr#UnspecifiedBoolType#; |
| 53 | operatorcxx . . $ QTWTF/OwnArrayPtr#`operator type-parameter-0-0 *OwnArrayPtr<T>::*`(5c69ffd3e968fe63). UnspecifiedBoolTypecxx . . $ QTWTF/OwnArrayPtr#UnspecifiedBoolType#() const { return m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr. ? &OwnArrayPtrcxx . . $ QTWTF/OwnArrayPtr#::m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr. : 0; } |
| 54 | #endif |
| 55 | |
| 56 | void swapcxx . . $ QTWTF/OwnArrayPtr#swap(383ad6814a3b6290).(OwnArrayPtr& o) { stdcxx . . $ std/::swapcxx . . $ std/swap(e9aa9b1aa62dbcf6).(m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr., o.m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr.); } |
| 57 | |
| 58 | private: |
| 59 | void safeDeletecxx . . $ QTWTF/OwnArrayPtr#safeDelete(49f6e7a06ebc5aa8).() { typedef char knowncxx . . $ QTWTF/OwnArrayPtr#safeDelete(49f6e7a06ebc5aa8).known#[sizeof(T) ? 1 : -1]; if (sizeof(knowncxx . . $ QTWTF/OwnArrayPtr#safeDelete(49f6e7a06ebc5aa8).known#)) delete [] m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr.; } |
| 60 | |
| 61 | T* m_ptrcxx . . $ QTWTF/OwnArrayPtr#m_ptr.; |
| 62 | }; |
| 63 | |
| 64 | template <typename T> inline void swapcxx . . $ QTWTF/swap(e2b935b350edbf08).(OwnArrayPtrcxx . . $ QTWTF/OwnArrayPtr#<T>& a, OwnArrayPtrcxx . . $ QTWTF/OwnArrayPtr#<T>& b) { a.swapcxx . . $ QTWTF/OwnArrayPtr#swap(383ad6814a3b6290).(b); } |
| 65 | |
| 66 | template <typename T> inline T* getPtrcxx . . $ QTWTF/getPtr(ce1b55cff23a2963).(const OwnArrayPtrcxx . . $ QTWTF/OwnArrayPtr#<T>& p) |
| 67 | { |
| 68 | return p.getcxx . . $ QTWTF/OwnArrayPtr#get(5a2a78a048fb49a8).(); |
| 69 | } |
| 70 | |
| 71 | } // namespace WTF |
| 72 | |
| 73 | using WTFcxx . . $ QTWTF/::OwnArrayPtrcxx . . $ QTWTF/OwnArrayPtr#; |
| 74 | |
| 75 | #endif // WTF_OwnArrayPtr_h |