- add WTF::getPtr, a function template that makes it possible to write
generic code that gets a raw pointer out of any of our pointer types
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/GetPtr.h: Added.
* wtf/ListRefPtr.h: (WTF::getPtr): Added.
* wtf/OwnArrayPtr.h: (WTF::getPtr): Added.
* wtf/OwnPtr.h: (WTF::getPtr): Added.
* wtf/PassRefPtr.h: (WTF::getPtr): Added.
* wtf/RefPtr.h: (WTF::getPtr): Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16133
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-08-30 Darin Adler <darin@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ - add WTF::getPtr, a function template that makes it possible to write
+ generic code that gets a raw pointer out of any of our pointer types
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/GetPtr.h: Added.
+ * wtf/ListRefPtr.h: (WTF::getPtr): Added.
+ * wtf/OwnArrayPtr.h: (WTF::getPtr): Added.
+ * wtf/OwnPtr.h: (WTF::getPtr): Added.
+ * wtf/PassRefPtr.h: (WTF::getPtr): Added.
+ * wtf/RefPtr.h: (WTF::getPtr): Added.
+
2006-08-29 waylonis <waylonis@google.com>
Reviewed, tweaked by ggaren.
935AF46E09E9D9DB00ACD1D8 /* UnusedParam.h in Headers */ = {isa = PBXBuildFile; fileRef = 935AF46B09E9D9DB00ACD1D8 /* UnusedParam.h */; };
935F69FE08245057003D1A45 /* dftables.c in Sources */ = {isa = PBXBuildFile; fileRef = 6541720E039E08B90058BFEB /* dftables.c */; };
93AA4F780957251F0084B3A7 /* AlwaysInline.h in Headers */ = {isa = PBXBuildFile; fileRef = 93AA4F770957251F0084B3A7 /* AlwaysInline.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 93B6A0DF0AA64DA40076DE27 /* GetPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B6A0DE0AA64DA40076DE27 /* GetPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
93E26BCA08B1511900F85226 /* pcre_ord2utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = 93E26BC908B1511900F85226 /* pcre_ord2utf8.c */; };
93E26BCE08B1512600F85226 /* pcre_ucp_findchar.c in Sources */ = {isa = PBXBuildFile; fileRef = 93E26BCD08B1512600F85226 /* pcre_ucp_findchar.c */; };
93E26BD108B1513800F85226 /* pcre_try_flipped.c in Sources */ = {isa = PBXBuildFile; fileRef = 93E26BD008B1513800F85226 /* pcre_try_flipped.c */; };
937B63CC09E766D200A671DD /* DerivedSources.make */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = DerivedSources.make; sourceTree = "<group>"; usesTabs = 1; };
938772E5038BFE19008635CE /* array_instance.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = array_instance.h; sourceTree = "<group>"; tabWidth = 8; };
93AA4F770957251F0084B3A7 /* AlwaysInline.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = AlwaysInline.h; sourceTree = "<group>"; tabWidth = 8; };
+ 93B6A0DE0AA64DA40076DE27 /* GetPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GetPtr.h; sourceTree = "<group>"; };
93E26BC908B1511900F85226 /* pcre_ord2utf8.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; name = pcre_ord2utf8.c; path = pcre/pcre_ord2utf8.c; sourceTree = "<group>"; tabWidth = 8; };
93E26BCD08B1512600F85226 /* pcre_ucp_findchar.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; name = pcre_ucp_findchar.c; path = pcre/pcre_ucp_findchar.c; sourceTree = "<group>"; tabWidth = 8; };
93E26BD008B1513800F85226 /* pcre_try_flipped.c */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.c; name = pcre_try_flipped.c; path = pcre/pcre_try_flipped.c; sourceTree = "<group>"; tabWidth = 8; };
65E217BA08E7EECC0023E5F6 /* FastMalloc.h */,
65D7D19B08F10B5B0015ABD8 /* FastMallocInternal.h */,
935AF46909E9D9DB00ACD1D8 /* Forward.h */,
+ 93B6A0DE0AA64DA40076DE27 /* GetPtr.h */,
657EEBBF094E445E008C9C7B /* HashCountedSet.h */,
65DFC92A08EA173A00F7300B /* HashFunctions.h */,
65DFC92B08EA173A00F7300B /* HashMap.h */,
65400C120A69BAF200509887 /* PropertyNameArray.h in Headers */,
1CAF34890A6C421700ABE06E /* WebScriptObject.h in Headers */,
65C7A1740A8EAACB00FA37EA /* JSWrapperObject.h in Headers */,
+ 93B6A0DF0AA64DA40076DE27 /* GetPtr.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
mainGroup = 0867D691FE84028FC02AAC07 /* JavaScriptCore */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
- projectRoot = "";
targets = (
932F5B3E0822A1C700736975 /* JavaScriptCore */,
935F69F508244FEA003D1A45 /* dftables */,
--- /dev/null
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_GET_PTR_H
+#define WTF_GET_PTR_H
+
+namespace WTF {
+
+ template <typename T> inline T* getPtr(T* p)
+ {
+ return p;
+ }
+
+} // namespace WTF
+
+#endif // WTF_GET_PTR_H
// -*- mode: c++; c-basic-offset: 4 -*-
/*
- * This file is part of the KDE libraries
- * Copyright (C) 2005 Apple Computer, Inc.
+ * Copyright (C) 2005, 2006 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
// Specialized version of RefPtr desgined for use in singly-linked lists.
// Derefs the list iteratively to avoid recursive derefing that can overflow the stack.
- template <typename T> class ListRefPtr : public RefPtr<T>
- {
+ template <typename T> class ListRefPtr : public RefPtr<T> {
public:
ListRefPtr() : RefPtr<T>() {}
- ListRefPtr(T *ptr) : RefPtr<T>(ptr) {}
+ ListRefPtr(T* ptr) : RefPtr<T>(ptr) {}
ListRefPtr(const RefPtr<T>& o) : RefPtr<T>(o) {}
// see comment in PassRefPtr.h for why this takes const reference
template <typename U> ListRefPtr(const PassRefPtr<U>& o) : RefPtr<T>(o) {}
reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper
}
- ListRefPtr& operator=(T *optr) { RefPtr<T>::operator=(optr); return *this; }
+ ListRefPtr& operator=(T* optr) { RefPtr<T>::operator=(optr); return *this; }
ListRefPtr& operator=(const RefPtr<T>& o) { RefPtr<T>::operator=(o); return *this; }
ListRefPtr& operator=(const PassRefPtr<T>& o) { RefPtr<T>::operator=(o); return *this; }
template <typename U> ListRefPtr& operator=(const RefPtr<U>& o) { RefPtr<T>::operator=(o); return *this; }
template <typename U> ListRefPtr& operator=(const PassRefPtr<U>& o) { RefPtr<T>::operator=(o); return *this; }
};
+ template <typename T> inline T* getPtr(const ListRefPtr<T>& p)
+ {
+ return p.get();
+ }
+
} // namespace WTF
using WTF::ListRefPtr;
template <typename T> inline void swap(OwnArrayPtr<T>& a, OwnArrayPtr<T>& b) { a.swap(b); }
+ template <typename T> inline T* getPtr(const OwnArrayPtr<T>& p)
+ {
+ return p.get();
+ }
+
} // namespace WTF
using WTF::OwnArrayPtr;
template <typename T> inline void swap(OwnPtr<T>& a, OwnPtr<T>& b) { a.swap(b); }
+ template <typename T> inline T* getPtr(const OwnPtr<T>& p)
+ {
+ return p.get();
+ }
+
} // namespace WTF
using WTF::OwnPtr;
return adoptRef(const_cast<T *>(p.release()));
}
+ template <typename T> inline T* getPtr(const PassRefPtr<T>& p)
+ {
+ return p.get();
+ }
+
} // namespace WTF
using WTF::PassRefPtr;
return RefPtr<T>(const_cast<T *>(p.get()));
}
+ template <typename T> inline T* getPtr(const RefPtr<T>& p)
+ {
+ return p.get();
+ }
+
} // namespace WTF
using WTF::RefPtr;