]> git.saurik.com Git - wxWidgets.git/commitdiff
renamed wx/ptr_shrd.h to wx/sharedptr.h; split wx/ptr_scpd.h in wx/scopedptr.h and...
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 3 Feb 2009 12:01:46 +0000 (12:01 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 3 Feb 2009 12:01:46 +0000 (12:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58634 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

44 files changed:
Makefile.in
build/bakefiles/files.bkl
build/msw/wx_base.dsp
build/msw/wx_vc7_base.vcproj
build/msw/wx_vc8_base.vcproj
build/msw/wx_vc9_base.vcproj
docs/changes.txt
include/wx/checkeddelete.h [new file with mode: 0644]
include/wx/dataview.h
include/wx/ptr_scpd.h [deleted file]
include/wx/ptr_shrd.h [deleted file]
include/wx/scopedarray.h [new file with mode: 0644]
include/wx/scopedptr.h [new file with mode: 0644]
include/wx/sharedptr.h [new file with mode: 0644]
interface/wx/ptr_scpd.h [deleted file]
interface/wx/ptr_shrd.h [deleted file]
interface/wx/scopedarray.h [new file with mode: 0644]
interface/wx/scopedptr.h [new file with mode: 0644]
interface/wx/sharedptr.h [new file with mode: 0644]
src/common/appbase.cpp
src/common/docview.cpp
src/common/event.cpp
src/common/fs_filter.cpp
src/common/gifdecod.cpp
src/common/init.cpp
src/common/intl.cpp
src/common/rendcmn.cpp
src/common/tarstrm.cpp
src/common/zipstrm.cpp
src/gtk/clipbrd.cpp
src/gtk/dialog.cpp
src/motif/clipbrd.cpp
src/msw/dialog.cpp
src/msw/evtloop.cpp
src/msw/menu.cpp
src/msw/toolbar.cpp
src/os2/dialog.cpp
src/os2/evtloop.cpp
src/palmos/dialog.cpp
src/palmos/evtloop.cpp
src/xml/xml.cpp
wxGTK.spec
wxMotif.spec
wxX11.spec

index c6ee928f4e48899a3fac3e4db02992d0114229ea..ad2b1ce288736d4267a203de60fab88b7f30a469 100644 (file)
@@ -318,6 +318,7 @@ ALL_BASE_HEADERS =  \
        wx/buffer.h \
        wx/build.h \
        wx/chartype.h \
+       wx/checkeddelete.h \
        wx/chkconf.h \
        wx/clntdata.h \
        wx/cmdargs.h \
@@ -391,7 +392,10 @@ ALL_BASE_HEADERS =  \
        wx/ptr_shrd.h \
        wx/recguard.h \
        wx/regex.h \
+       wx/scopedarray.h \
+       wx/scopedptr.h \
        wx/scopeguard.h \
+       wx/sharedptr.h \
        wx/snglinst.h \
        wx/sstream.h \
        wx/stack.h \
@@ -471,6 +475,7 @@ ALL_PORTS_BASE_HEADERS =  \
        wx/buffer.h \
        wx/build.h \
        wx/chartype.h \
+       wx/checkeddelete.h \
        wx/chkconf.h \
        wx/clntdata.h \
        wx/cmdargs.h \
@@ -544,7 +549,10 @@ ALL_PORTS_BASE_HEADERS =  \
        wx/ptr_shrd.h \
        wx/recguard.h \
        wx/regex.h \
+       wx/scopedarray.h \
+       wx/scopedptr.h \
        wx/scopeguard.h \
+       wx/sharedptr.h \
        wx/snglinst.h \
        wx/sstream.h \
        wx/stack.h \
index a68221526b915308d0fe7aa0a853396ec29bf646..450ca53e93222695ebab696e4d857289fcce15ff 100644 (file)
@@ -399,6 +399,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     wx/buffer.h
     wx/build.h
     wx/chartype.h
+    wx/checkeddelete.h
     wx/chkconf.h
     wx/clntdata.h
     wx/cmdargs.h
@@ -472,7 +473,10 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     wx/ptr_shrd.h
     wx/recguard.h
     wx/regex.h
+    wx/scopedarray.h
+    wx/scopedptr.h
     wx/scopeguard.h
+    wx/sharedptr.h
     wx/snglinst.h
     wx/sstream.h
     wx/stack.h
index c80d3e216857752de29a9f9a7cd4501312f405cb..bc94929fdb2181828f700629d9226093e2ac3255 100644 (file)
@@ -1071,6 +1071,10 @@ SOURCE=..\..\include\wx\chartype.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\include\wx\checkeddelete.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\include\wx\chkconf.h\r
 # End Source File\r
 # Begin Source File\r
@@ -1371,10 +1375,22 @@ SOURCE=..\..\include\wx\regex.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\include\wx\scopedarray.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\..\include\wx\scopedptr.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\include\wx\scopeguard.h\r
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\include\wx\sharedptr.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\include\wx\snglinst.h\r
 # End Source File\r
 # Begin Source File\r
index 3c4d781e0f9cd7df3ff39f9839cfa3eafe0b1dc0..f8994ddb0210f0d0858ceb699c0fe73f992c6dfc 100644 (file)
                        <File\r
                                RelativePath="..\..\include\wx\chartype.h">\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\checkeddelete.h">\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\include\wx\chkconf.h">\r
                        </File>\r
                        <File\r
                                RelativePath="..\..\include\wx\regex.h">\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\scopedarray.h">\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\scopedptr.h">\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\include\wx\scopeguard.h">\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\sharedptr.h">\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\include\wx\snglinst.h">\r
                        </File>\r
index a9ae6c9abc2c2a16ca42c32fa1ec882b3f6b25e4..f2a8489fd482ef88688601b39aa9e52e028f9929 100644 (file)
                                RelativePath="..\..\include\wx\chartype.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\checkeddelete.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\include\wx\chkconf.h"\r
                                >\r
                                RelativePath="..\..\include\wx\regex.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\scopedarray.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\scopedptr.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\include\wx\scopeguard.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\sharedptr.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\include\wx\snglinst.h"\r
                                >\r
index c8a2fe2b8ba2e85d745e7c8deba78f97370ab8d4..5e214ecae5359f173c5a38571d166ff2c16045dd 100644 (file)
                                RelativePath="..\..\include\wx\chartype.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\checkeddelete.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\include\wx\chkconf.h"\r
                                >\r
                                RelativePath="..\..\include\wx\regex.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\scopedarray.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\scopedptr.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\include\wx\scopeguard.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\include\wx\sharedptr.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\include\wx\snglinst.h"\r
                                >\r
index 62aa60f58c2a5b7708ce8bef8d17786d00533c55..24dcd3449816a29a9630bc7c172068b9140cd4a9 100644 (file)
@@ -320,7 +320,9 @@ All:
   Linnakangas).
 - wxVariant::Unshare allows exclusive allocation of data that must be shared,
   if the wxVariantData::Clone function is implemented.
-- Added wxWeakRef<T>, wxScopedPtr<T>, wxScopedArray<T>, wxSharedPtr<T> templates.
+- Added wxWeakRef<T>, wxScopedPtr<T>, wxScopedArray<T>, wxSharedPtr<T> templates
+  and renamed old wx/ptr_{scpd,shrd}.h headers to wx/scoped{ptr,array}.h and
+  wx/sharedptr.h (but old headers are still provided for compatibility).
 - Added wxVector<T> class templates
 - Added wxON_BLOCK_EXIT_SET() and wxON_BLOCK_EXIT_NULL() to wx/scopeguard.h.
 - Added wxEvtHandler::QueueEvent() replacing AddPendingEvent() and
diff --git a/include/wx/checkeddelete.h b/include/wx/checkeddelete.h
new file mode 100644 (file)
index 0000000..a9e14c3
--- /dev/null
@@ -0,0 +1,54 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        wx/checkeddelete.h
+// Purpose:     wxCHECKED_DELETE() macro
+// Author:      Vadim Zeitlin
+// Created:     2009-02-03
+// RCS-ID:      $Id$
+// Copyright:   (c) 2002-2009 wxWidgets dev team
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_CHECKEDDELETE_H_
+#define _WX_CHECKEDDELETE_H_
+
+// TODO: provide wxCheckedDelete[Array]() template functions too
+
+// ----------------------------------------------------------------------------
+// wxCHECKED_DELETE and wxCHECKED_DELETE_ARRAY macros
+// ----------------------------------------------------------------------------
+
+/*
+   checked deleters are used to make sure that the type being deleted is really
+   a complete type.: otherwise sizeof() would result in a compile-time error
+
+   do { ... } while ( 0 ) construct is used to have an anonymous scope
+   (otherwise we could have name clashes between different "complete"s) but
+   still force a semicolon after the macro
+*/
+
+#ifdef __WATCOMC__
+    #define wxFOR_ONCE(name)              for(int name=0; name<1; name++)
+    #define wxPRE_NO_WARNING_SCOPE(name)  wxFOR_ONCE(wxMAKE_UNIQUE_NAME(name))
+    #define wxPOST_NO_WARNING_SCOPE(name)
+#else
+    #define wxPRE_NO_WARNING_SCOPE(name)  do
+    #define wxPOST_NO_WARNING_SCOPE(name) while ( wxFalse )
+#endif
+
+#define wxCHECKED_DELETE(ptr)                                                 \
+    wxPRE_NO_WARNING_SCOPE(scope_var1)                                        \
+    {                                                                         \
+        typedef char complete[sizeof(*ptr)];                                  \
+        delete ptr;                                                           \
+    } wxPOST_NO_WARNING_SCOPE(scope_var1)
+
+#define wxCHECKED_DELETE_ARRAY(ptr)                                           \
+    wxPRE_NO_WARNING_SCOPE(scope_var2)                                        \
+    {                                                                         \
+        typedef char complete[sizeof(*ptr)];                                  \
+        delete [] ptr;                                                        \
+    } wxPOST_NO_WARNING_SCOPE(scope_var2)
+
+
+#endif // _WX_CHECKEDDELETE_H_
+
index 2ced28401400955483614845f3dea4630f4c071e..901e3ca068daa06c1d3ab8d5259f76ce20f81b13 100644 (file)
@@ -791,7 +791,6 @@ public:
     // For drag operations
     void SetDataObject( wxDataObject *obj ) { m_dataObject = obj; }
     wxDataObject *GetDataObject() const { return m_dataObject; }
-#endif // wxUSE_DRAG_AND_DROP
 
     // For drop operations
     void SetDataFormat( const wxDataFormat &format ) { m_dataFormat = format; }
@@ -800,6 +799,7 @@ public:
     size_t GetDataSize() const { return m_dataSize; }
     void SetDataBuffer( void* buf ) { m_dataBuffer = buf;}
     void *GetDataBuffer() const { return m_dataBuffer; }
+#endif // wxUSE_DRAG_AND_DROP
 
     virtual wxEvent *Clone() const { return new wxDataViewEvent(*this); }
 
diff --git a/include/wx/ptr_scpd.h b/include/wx/ptr_scpd.h
deleted file mode 100644 (file)
index ffbb011..0000000
+++ /dev/null
@@ -1,337 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        wx/ptr_scpd.h
-// Purpose:     scoped smart pointer class
-// Author:      Jesse Lovelace <jllovela@eos.ncsu.edu>
-// Modified by: Vadim Zeitlin to add template wxScopedArray
-// Created:     06/01/02
-// RCS-ID:      $Id$
-// Copyright:   (c) Jesse Lovelace and original Boost authors (see below)
-//              (c) 2009 Vadim Zeitlin
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-//  This class closely follows the implementation of the boost
-//  library scoped_ptr and is an adaption for c++ macro's in
-//  the wxWidgets project. The original authors of the boost
-//  scoped_ptr are given below with their respective copyrights.
-
-//  (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
-//  Copyright (c) 2001, 2002 Peter Dimov
-//
-//  Permission to copy, use, modify, sell and distribute this software
-//  is granted provided this copyright notice appears in all copies.
-//  This software is provided "as is" without express or implied
-//  warranty, and with no claim as to its suitability for any purpose.
-//
-//  See http://www.boost.org/libs/smart_ptr/scoped_ptr.htm for documentation.
-//
-
-#ifndef __WX_SCOPED_POINTER__
-#define __WX_SCOPED_POINTER__
-
-#include "wx/defs.h"
-
-// ----------------------------------------------------------------------------
-// wxScopedPtr: A scoped pointer
-// ----------------------------------------------------------------------------
-
-template <class T>
-class wxScopedPtr
-{
-public:
-    typedef T element_type;
-
-    wxEXPLICIT wxScopedPtr(T * ptr = NULL) : m_ptr(ptr) { }
-
-    ~wxScopedPtr() { delete m_ptr; }
-
-    // test for pointer validity: defining conversion to unspecified_bool_type
-    // and not more obvious bool to avoid implicit conversions to integer types
-    typedef T *(wxScopedPtr<T>::*unspecified_bool_type)() const;
-    operator unspecified_bool_type() const
-    {
-        return m_ptr ? &wxScopedPtr<T>::get : NULL;
-    }
-
-    void reset(T * ptr = NULL)
-    {
-        if ( ptr != m_ptr )
-        {
-            delete m_ptr;
-            m_ptr = ptr;
-        }
-    }
-
-    T *release()
-    {
-        T *ptr = m_ptr;
-        m_ptr = NULL;
-        return ptr;
-    }
-
-    T & operator*() const
-    {
-        wxASSERT(m_ptr != NULL);
-        return *m_ptr;
-    }
-
-    T * operator->() const
-    {
-        wxASSERT(m_ptr != NULL);
-        return m_ptr;
-    }
-
-    T * get() const
-    {
-        return m_ptr;
-    }
-
-    void swap(wxScopedPtr& other)
-    {
-        T * const tmp = other.m_ptr;
-        other.m_ptr = m_ptr;
-        m_ptr = tmp;
-    }
-
-private:
-    T * m_ptr;
-
-    DECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedPtr, T)
-};
-
-// ----------------------------------------------------------------------------
-// wxScopedArray: A scoped array
-// ----------------------------------------------------------------------------
-
-template <class T>
-class wxScopedArray
-{
-public:
-    typedef T element_type;
-
-    wxEXPLICIT wxScopedArray(T * array = NULL) : m_array(array) { }
-
-    ~wxScopedArray() { delete [] m_array; }
-
-    // test for pointer validity: defining conversion to unspecified_bool_type
-    // and not more obvious bool to avoid implicit conversions to integer types
-    typedef T *(wxScopedArray<T>::*unspecified_bool_type)() const;
-    operator unspecified_bool_type() const
-    {
-        return m_array ? &wxScopedArray<T>::get : NULL;
-    }
-
-    void reset(T *array = NULL)
-    {
-        if ( array != m_array )
-        {
-            delete m_array;
-            m_array = array;
-        }
-    }
-
-    T& operator[](size_t n) const { return m_array[n]; }
-
-    T *get() const { return m_array; }
-
-    void swap(wxScopedArray &other)
-    {
-        T * const tmp = other.m_array;
-        other.m_array = m_array;
-        m_array = tmp;
-    }
-
-private:
-    T *m_array;
-
-    DECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedArray, T)
-};
-
-// ----------------------------------------------------------------------------
-// old macro based implementation
-// ----------------------------------------------------------------------------
-
-/*
-   checked deleters are used to make sure that the type being deleted is really
-   a complete type.: otherwise sizeof() would result in a compile-time error
-
-   do { ... } while ( 0 ) construct is used to have an anonymous scope
-   (otherwise we could have name clashes between different "complete"s) but
-   still force a semicolon after the macro
-*/
-
-#ifdef __WATCOMC__
-    #define wxFOR_ONCE(name)              for(int name=0; name<1; name++)
-    #define wxPRE_NO_WARNING_SCOPE(name)  wxFOR_ONCE(wxMAKE_UNIQUE_NAME(name))
-    #define wxPOST_NO_WARNING_SCOPE(name)
-#else
-    #define wxPRE_NO_WARNING_SCOPE(name)  do
-    #define wxPOST_NO_WARNING_SCOPE(name) while ( wxFalse )
-#endif
-
-#define wxCHECKED_DELETE(ptr)                                                 \
-    wxPRE_NO_WARNING_SCOPE(scope_var1)                                        \
-    {                                                                         \
-        typedef char complete[sizeof(*ptr)];                                  \
-        delete ptr;                                                           \
-    } wxPOST_NO_WARNING_SCOPE(scope_var1)
-
-#define wxCHECKED_DELETE_ARRAY(ptr)                                           \
-    wxPRE_NO_WARNING_SCOPE(scope_var2)                                        \
-    {                                                                         \
-        typedef char complete[sizeof(*ptr)];                                  \
-        delete [] ptr;                                                        \
-    } wxPOST_NO_WARNING_SCOPE(scope_var2)
-
-/* The type being used *must* be complete at the time
-   that wxDEFINE_SCOPED_* is called or a compiler error will result.
-   This is because the class checks for the completeness of the type
-   being used. */
-
-#define wxDECLARE_SCOPED_PTR(T, name) \
-class name                          \
-{                                   \
-private:                            \
-    T * m_ptr;                      \
-                                    \
-    name(name const &);             \
-    name & operator=(name const &); \
-                                    \
-public:                             \
-    wxEXPLICIT name(T * ptr = NULL) \
-    : m_ptr(ptr) { }                \
-                                    \
-    ~name();                        \
-                                    \
-    void reset(T * ptr = NULL)      \
-    {                               \
-        if (m_ptr != ptr)           \
-        {                           \
-            delete m_ptr;           \
-            m_ptr = ptr;            \
-        }                           \
-    }                               \
-                                    \
-    T *release()                    \
-    {                               \
-        T *ptr = m_ptr;             \
-        m_ptr = NULL;               \
-        return ptr;                 \
-    }                               \
-                                    \
-    T & operator*() const           \
-    {                               \
-        wxASSERT(m_ptr != NULL);    \
-        return *m_ptr;              \
-    }                               \
-                                    \
-    T * operator->() const          \
-    {                               \
-        wxASSERT(m_ptr != NULL);    \
-        return m_ptr;               \
-    }                               \
-                                    \
-    T * get() const                 \
-    {                               \
-        return m_ptr;               \
-    }                               \
-                                    \
-    void swap(name & ot)            \
-    {                               \
-        T * tmp = ot.m_ptr;         \
-        ot.m_ptr = m_ptr;           \
-        m_ptr = tmp;                \
-    }                               \
-};
-
-#define wxDEFINE_SCOPED_PTR(T, name)\
-name::~name()                       \
-{                                   \
-    wxCHECKED_DELETE(m_ptr);        \
-}
-
-// this macro can be used for the most common case when you want to declare and
-// define the scoped pointer at the same time and want to use the standard
-// naming convention: auto pointer to Foo is called FooPtr
-#define wxDEFINE_SCOPED_PTR_TYPE(T)    \
-    wxDECLARE_SCOPED_PTR(T, T ## Ptr)  \
-    wxDEFINE_SCOPED_PTR(T, T ## Ptr)
-
-// the same but for arrays instead of simple pointers
-#define wxDECLARE_SCOPED_ARRAY(T, name)\
-class name                          \
-{                                   \
-private:                            \
-    T * m_ptr;                      \
-    name(name const &);             \
-    name & operator=(name const &); \
-                                    \
-public:                             \
-    wxEXPLICIT name(T * p = NULL) : m_ptr(p) \
-    {}                              \
-                                    \
-    ~name();                        \
-    void reset(T * p = NULL);       \
-                                    \
-    T & operator[](long int i) const\
-    {                               \
-        wxASSERT(m_ptr != NULL);    \
-        wxASSERT(i >= 0);           \
-        return m_ptr[i];            \
-    }                               \
-                                    \
-    T * get() const                 \
-    {                               \
-        return m_ptr;               \
-    }                               \
-                                    \
-    void swap(name & ot)            \
-    {                               \
-        T * tmp = ot.m_ptr;         \
-        ot.m_ptr = m_ptr;           \
-        m_ptr = tmp;                \
-    }                               \
-};
-
-#define wxDEFINE_SCOPED_ARRAY(T, name)  \
-name::~name()                           \
-{                                       \
-    wxCHECKED_DELETE_ARRAY(m_ptr);      \
-}                                       \
-void name::reset(T * p){                \
-    if (m_ptr != p)                     \
-    {                                   \
-       wxCHECKED_DELETE_ARRAY(m_ptr);   \
-       m_ptr = p;                       \
-    }                                   \
-}
-
-// ----------------------------------------------------------------------------
-// "Tied" scoped pointer: same as normal one but also sets the value of
-//                        some other variable to the pointer value
-// ----------------------------------------------------------------------------
-
-#define wxDEFINE_TIED_SCOPED_PTR_TYPE(T)                                      \
-    wxDEFINE_SCOPED_PTR_TYPE(T)                                               \
-    class T ## TiedPtr : public T ## Ptr                                      \
-    {                                                                         \
-    public:                                                                   \
-        T ## TiedPtr(T **pp, T *p)                                            \
-            : T ## Ptr(p), m_pp(pp)                                           \
-        {                                                                     \
-            m_pOld = *pp;                                                     \
-            *pp = p;                                                          \
-        }                                                                     \
-                                                                              \
-        ~ T ## TiedPtr()                                                      \
-        {                                                                     \
-            *m_pp = m_pOld;                                                   \
-        }                                                                     \
-                                                                              \
-    private:                                                                  \
-        T **m_pp;                                                             \
-        T *m_pOld;                                                            \
-    };
-
-#endif // __WX_SCOPED_POINTER__
-
diff --git a/include/wx/ptr_shrd.h b/include/wx/ptr_shrd.h
deleted file mode 100644 (file)
index 71492d9..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        wx/ptr_shrd.h
-// Purpose:     Shared pointer based on the counted_ptr<> template, which
-//              is in the public domain
-// Author:      Robert Roebling, Yonat Sharon
-// RCS-ID:      $Id: object.h 47254 2007-07-09 10:09:52Z VS $
-// Copyright:   Robert Roebling
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef _WX_SHARED_PTRH__
-#define _WX_SHARED_PTRH__
-
-#include "wx/defs.h"
-#include "wx/atomic.h"
-
-// ----------------------------------------------------------------------------
-// wxSharedPtr: A smart pointer with non-intrusive reference counting.
-// ----------------------------------------------------------------------------
-
-template <class T> 
-class wxSharedPtr
-{
-public:
-    typedef T element_type;
-
-    wxEXPLICIT wxSharedPtr( T* ptr = NULL )
-        : m_ref(NULL) 
-    { 
-        if (ptr) 
-            m_ref = new reftype(ptr); 
-    }
-        
-    ~wxSharedPtr()                           { Release(); }
-    wxSharedPtr(const wxSharedPtr& tocopy)   { Acquire(tocopy.m_ref); }
-    
-    wxSharedPtr& operator=( const wxSharedPtr& tocopy )
-    {
-        if (this != &tocopy) 
-        {
-            Release();
-            Acquire(tocopy.m_ref);
-        }
-        return *this;
-    }
-
-    wxSharedPtr& operator=( T* ptr )
-    {
-        if (get() != ptr) 
-        {
-            Release();
-            if (ptr) 
-                m_ref = new reftype(ptr); 
-        }
-        return *this;
-    }
-
-    // test for pointer validity: defining conversion to unspecified_bool_type
-    // and not more obvious bool to avoid implicit conversions to integer types
-    typedef T *(wxSharedPtr<T>::*unspecified_bool_type)() const;
-    operator unspecified_bool_type() const
-    {
-        if (m_ref && m_ref->m_ptr)
-           return  &wxSharedPtr<T>::get;
-        else
-           return NULL;
-    }
-
-    T& operator*() const
-    { 
-        wxASSERT(m_ref != NULL);    
-        wxASSERT(m_ref->m_ptr != NULL);    
-        return *(m_ref->m_ptr);
-    }
-    
-    T* operator->() const
-    { 
-        wxASSERT(m_ref != NULL);    
-        wxASSERT(m_ref->m_ptr != NULL);    
-        return m_ref->m_ptr;
-    }
-    
-    T* get() const    
-    { 
-        return m_ref ? m_ref->m_ptr : NULL; 
-    }
-    
-    void reset( T* ptr = NULL )
-    {
-        Release();
-        if (ptr) 
-            m_ref = new reftype(ptr); 
-    }
-    
-    bool unique()   const    { return (m_ref ? m_ref->m_count == 1 : true); }
-    long use_count() const   { return (m_ref ? (long)m_ref->m_count : 0); }
-
-private:
-
-    struct reftype 
-    {
-        reftype( T* ptr = NULL, unsigned count = 1 ) : m_ptr(ptr), m_count(count) {}
-        T*          m_ptr;
-        wxAtomicInt m_count;
-    }* m_ref;
-
-    void Acquire(reftype* ref) 
-    {
-        m_ref = ref;
-        if (ref) 
-            wxAtomicInc( ref->m_count );
-    }
-
-    void Release()
-    {
-        if (m_ref) 
-        {
-            wxAtomicDec( m_ref->m_count );
-            if (m_ref->m_count == 0) 
-            {
-                delete m_ref->m_ptr;
-                delete m_ref;
-            }
-            m_ref = NULL;
-        }
-    }
-};
-
-template <class T, class U>
-bool operator == (wxSharedPtr<T> const &a, wxSharedPtr<U> const &b )
-{
-    return a.get() == b.get();
-}
-
-template <class T, class U>
-bool operator != (wxSharedPtr<T> const &a, wxSharedPtr<U> const &b )
-{
-    return a.get() != b.get();
-}
-
-
-
-#endif // _WX_SHARED_PTRH__
diff --git a/include/wx/scopedarray.h b/include/wx/scopedarray.h
new file mode 100644 (file)
index 0000000..4175fce
--- /dev/null
@@ -0,0 +1,120 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/scopedarray.h
+// Purpose:     scoped smart pointer class
+// Author:      Vadim Zeitlin
+// Created:     2009-02-03
+// RCS-ID:      $Id$
+// Copyright:   (c) Jesse Lovelace and original Boost authors (see below)
+//              (c) 2009 Vadim Zeitlin
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SCOPED_ARRAY_H_
+#define _WX_SCOPED_ARRAY_H_
+
+#include "wx/defs.h"
+#include "wx/checkeddelete.h"
+
+// ----------------------------------------------------------------------------
+// wxScopedArray: A scoped array
+// ----------------------------------------------------------------------------
+
+template <class T>
+class wxScopedArray
+{
+public:
+    typedef T element_type;
+
+    wxEXPLICIT wxScopedArray(T * array = NULL) : m_array(array) { }
+
+    ~wxScopedArray() { delete [] m_array; }
+
+    // test for pointer validity: defining conversion to unspecified_bool_type
+    // and not more obvious bool to avoid implicit conversions to integer types
+    typedef T *(wxScopedArray<T>::*unspecified_bool_type)() const;
+    operator unspecified_bool_type() const
+    {
+        return m_array ? &wxScopedArray<T>::get : NULL;
+    }
+
+    void reset(T *array = NULL)
+    {
+        if ( array != m_array )
+        {
+            delete m_array;
+            m_array = array;
+        }
+    }
+
+    T& operator[](size_t n) const { return m_array[n]; }
+
+    T *get() const { return m_array; }
+
+    void swap(wxScopedArray &other)
+    {
+        T * const tmp = other.m_array;
+        other.m_array = m_array;
+        m_array = tmp;
+    }
+
+private:
+    T *m_array;
+
+    DECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedArray, T)
+};
+
+// ----------------------------------------------------------------------------
+// old macro based implementation
+// ----------------------------------------------------------------------------
+
+// the same but for arrays instead of simple pointers
+#define wxDECLARE_SCOPED_ARRAY(T, name)\
+class name                          \
+{                                   \
+private:                            \
+    T * m_ptr;                      \
+    name(name const &);             \
+    name & operator=(name const &); \
+                                    \
+public:                             \
+    wxEXPLICIT name(T * p = NULL) : m_ptr(p) \
+    {}                              \
+                                    \
+    ~name();                        \
+    void reset(T * p = NULL);       \
+                                    \
+    T & operator[](long int i) const\
+    {                               \
+        wxASSERT(m_ptr != NULL);    \
+        wxASSERT(i >= 0);           \
+        return m_ptr[i];            \
+    }                               \
+                                    \
+    T * get() const                 \
+    {                               \
+        return m_ptr;               \
+    }                               \
+                                    \
+    void swap(name & ot)            \
+    {                               \
+        T * tmp = ot.m_ptr;         \
+        ot.m_ptr = m_ptr;           \
+        m_ptr = tmp;                \
+    }                               \
+};
+
+#define wxDEFINE_SCOPED_ARRAY(T, name)  \
+name::~name()                           \
+{                                       \
+    wxCHECKED_DELETE_ARRAY(m_ptr);      \
+}                                       \
+void name::reset(T * p){                \
+    if (m_ptr != p)                     \
+    {                                   \
+       wxCHECKED_DELETE_ARRAY(m_ptr);   \
+       m_ptr = p;                       \
+    }                                   \
+}
+
+#endif // _WX_SCOPED_ARRAY_H_
+
diff --git a/include/wx/scopedptr.h b/include/wx/scopedptr.h
new file mode 100644 (file)
index 0000000..a27b8db
--- /dev/null
@@ -0,0 +1,208 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/scopedptr.h
+// Purpose:     scoped smart pointer class
+// Author:      Jesse Lovelace <jllovela@eos.ncsu.edu>
+// Created:     06/01/02
+// RCS-ID:      $Id$
+// Copyright:   (c) Jesse Lovelace and original Boost authors (see below)
+//              (c) 2009 Vadim Zeitlin
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+//  This class closely follows the implementation of the boost
+//  library scoped_ptr and is an adaption for c++ macro's in
+//  the wxWidgets project. The original authors of the boost
+//  scoped_ptr are given below with their respective copyrights.
+
+//  (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+//  Copyright (c) 2001, 2002 Peter Dimov
+//
+//  Permission to copy, use, modify, sell and distribute this software
+//  is granted provided this copyright notice appears in all copies.
+//  This software is provided "as is" without express or implied
+//  warranty, and with no claim as to its suitability for any purpose.
+//
+//  See http://www.boost.org/libs/smart_ptr/scoped_ptr.htm for documentation.
+//
+
+#ifndef _WX_SCOPED_PTR_H_
+#define _WX_SCOPED_PTR_H_
+
+#include "wx/defs.h"
+#include "wx/checkeddelete.h"
+
+// ----------------------------------------------------------------------------
+// wxScopedPtr: A scoped pointer
+// ----------------------------------------------------------------------------
+
+template <class T>
+class wxScopedPtr
+{
+public:
+    typedef T element_type;
+
+    wxEXPLICIT wxScopedPtr(T * ptr = NULL) : m_ptr(ptr) { }
+
+    ~wxScopedPtr() { delete m_ptr; }
+
+    // test for pointer validity: defining conversion to unspecified_bool_type
+    // and not more obvious bool to avoid implicit conversions to integer types
+    typedef T *(wxScopedPtr<T>::*unspecified_bool_type)() const;
+    operator unspecified_bool_type() const
+    {
+        return m_ptr ? &wxScopedPtr<T>::get : NULL;
+    }
+
+    void reset(T * ptr = NULL)
+    {
+        if ( ptr != m_ptr )
+        {
+            delete m_ptr;
+            m_ptr = ptr;
+        }
+    }
+
+    T *release()
+    {
+        T *ptr = m_ptr;
+        m_ptr = NULL;
+        return ptr;
+    }
+
+    T & operator*() const
+    {
+        wxASSERT(m_ptr != NULL);
+        return *m_ptr;
+    }
+
+    T * operator->() const
+    {
+        wxASSERT(m_ptr != NULL);
+        return m_ptr;
+    }
+
+    T * get() const
+    {
+        return m_ptr;
+    }
+
+    void swap(wxScopedPtr& other)
+    {
+        T * const tmp = other.m_ptr;
+        other.m_ptr = m_ptr;
+        m_ptr = tmp;
+    }
+
+private:
+    T * m_ptr;
+
+    DECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedPtr, T)
+};
+
+// ----------------------------------------------------------------------------
+// old macro based implementation
+// ----------------------------------------------------------------------------
+
+/* The type being used *must* be complete at the time
+   that wxDEFINE_SCOPED_* is called or a compiler error will result.
+   This is because the class checks for the completeness of the type
+   being used. */
+
+#define wxDECLARE_SCOPED_PTR(T, name) \
+class name                          \
+{                                   \
+private:                            \
+    T * m_ptr;                      \
+                                    \
+    name(name const &);             \
+    name & operator=(name const &); \
+                                    \
+public:                             \
+    wxEXPLICIT name(T * ptr = NULL) \
+    : m_ptr(ptr) { }                \
+                                    \
+    ~name();                        \
+                                    \
+    void reset(T * ptr = NULL)      \
+    {                               \
+        if (m_ptr != ptr)           \
+        {                           \
+            delete m_ptr;           \
+            m_ptr = ptr;            \
+        }                           \
+    }                               \
+                                    \
+    T *release()                    \
+    {                               \
+        T *ptr = m_ptr;             \
+        m_ptr = NULL;               \
+        return ptr;                 \
+    }                               \
+                                    \
+    T & operator*() const           \
+    {                               \
+        wxASSERT(m_ptr != NULL);    \
+        return *m_ptr;              \
+    }                               \
+                                    \
+    T * operator->() const          \
+    {                               \
+        wxASSERT(m_ptr != NULL);    \
+        return m_ptr;               \
+    }                               \
+                                    \
+    T * get() const                 \
+    {                               \
+        return m_ptr;               \
+    }                               \
+                                    \
+    void swap(name & ot)            \
+    {                               \
+        T * tmp = ot.m_ptr;         \
+        ot.m_ptr = m_ptr;           \
+        m_ptr = tmp;                \
+    }                               \
+};
+
+#define wxDEFINE_SCOPED_PTR(T, name)\
+name::~name()                       \
+{                                   \
+    wxCHECKED_DELETE(m_ptr);        \
+}
+
+// this macro can be used for the most common case when you want to declare and
+// define the scoped pointer at the same time and want to use the standard
+// naming convention: auto pointer to Foo is called FooPtr
+#define wxDEFINE_SCOPED_PTR_TYPE(T)    \
+    wxDECLARE_SCOPED_PTR(T, T ## Ptr)  \
+    wxDEFINE_SCOPED_PTR(T, T ## Ptr)
+
+// ----------------------------------------------------------------------------
+// "Tied" scoped pointer: same as normal one but also sets the value of
+//                        some other variable to the pointer value
+// ----------------------------------------------------------------------------
+
+#define wxDEFINE_TIED_SCOPED_PTR_TYPE(T)                                      \
+    wxDEFINE_SCOPED_PTR_TYPE(T)                                               \
+    class T ## TiedPtr : public T ## Ptr                                      \
+    {                                                                         \
+    public:                                                                   \
+        T ## TiedPtr(T **pp, T *p)                                            \
+            : T ## Ptr(p), m_pp(pp)                                           \
+        {                                                                     \
+            m_pOld = *pp;                                                     \
+            *pp = p;                                                          \
+        }                                                                     \
+                                                                              \
+        ~ T ## TiedPtr()                                                      \
+        {                                                                     \
+            *m_pp = m_pOld;                                                   \
+        }                                                                     \
+                                                                              \
+    private:                                                                  \
+        T **m_pp;                                                             \
+        T *m_pOld;                                                            \
+    };
+
+#endif // _WX_SCOPED_PTR_H_
+
diff --git a/include/wx/sharedptr.h b/include/wx/sharedptr.h
new file mode 100644 (file)
index 0000000..5bfd215
--- /dev/null
@@ -0,0 +1,141 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/sharedptr.h
+// Purpose:     Shared pointer based on the counted_ptr<> template, which
+//              is in the public domain
+// Author:      Robert Roebling, Yonat Sharon
+// RCS-ID:      $Id: object.h 47254 2007-07-09 10:09:52Z VS $
+// Copyright:   Robert Roebling
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SHAREDPTR_H_
+#define _WX_SHAREDPTR_H_
+
+#include "wx/defs.h"
+#include "wx/atomic.h"
+
+// ----------------------------------------------------------------------------
+// wxSharedPtr: A smart pointer with non-intrusive reference counting.
+// ----------------------------------------------------------------------------
+
+template <class T>
+class wxSharedPtr
+{
+public:
+    typedef T element_type;
+
+    wxEXPLICIT wxSharedPtr( T* ptr = NULL )
+        : m_ref(NULL)
+    {
+        if (ptr)
+            m_ref = new reftype(ptr);
+    }
+
+    ~wxSharedPtr()                           { Release(); }
+    wxSharedPtr(const wxSharedPtr& tocopy)   { Acquire(tocopy.m_ref); }
+
+    wxSharedPtr& operator=( const wxSharedPtr& tocopy )
+    {
+        if (this != &tocopy)
+        {
+            Release();
+            Acquire(tocopy.m_ref);
+        }
+        return *this;
+    }
+
+    wxSharedPtr& operator=( T* ptr )
+    {
+        if (get() != ptr)
+        {
+            Release();
+            if (ptr)
+                m_ref = new reftype(ptr);
+        }
+        return *this;
+    }
+
+    // test for pointer validity: defining conversion to unspecified_bool_type
+    // and not more obvious bool to avoid implicit conversions to integer types
+    typedef T *(wxSharedPtr<T>::*unspecified_bool_type)() const;
+    operator unspecified_bool_type() const
+    {
+        if (m_ref && m_ref->m_ptr)
+           return  &wxSharedPtr<T>::get;
+        else
+           return NULL;
+    }
+
+    T& operator*() const
+    {
+        wxASSERT(m_ref != NULL);
+        wxASSERT(m_ref->m_ptr != NULL);
+        return *(m_ref->m_ptr);
+    }
+
+    T* operator->() const
+    {
+        wxASSERT(m_ref != NULL);
+        wxASSERT(m_ref->m_ptr != NULL);
+        return m_ref->m_ptr;
+    }
+
+    T* get() const
+    {
+        return m_ref ? m_ref->m_ptr : NULL;
+    }
+
+    void reset( T* ptr = NULL )
+    {
+        Release();
+        if (ptr)
+            m_ref = new reftype(ptr);
+    }
+
+    bool unique()   const    { return (m_ref ? m_ref->m_count == 1 : true); }
+    long use_count() const   { return (m_ref ? (long)m_ref->m_count : 0); }
+
+private:
+
+    struct reftype
+    {
+        reftype( T* ptr = NULL, unsigned count = 1 ) : m_ptr(ptr), m_count(count) {}
+        T*          m_ptr;
+        wxAtomicInt m_count;
+    }* m_ref;
+
+    void Acquire(reftype* ref)
+    {
+        m_ref = ref;
+        if (ref)
+            wxAtomicInc( ref->m_count );
+    }
+
+    void Release()
+    {
+        if (m_ref)
+        {
+            wxAtomicDec( m_ref->m_count );
+            if (m_ref->m_count == 0)
+            {
+                delete m_ref->m_ptr;
+                delete m_ref;
+            }
+            m_ref = NULL;
+        }
+    }
+};
+
+template <class T, class U>
+bool operator == (wxSharedPtr<T> const &a, wxSharedPtr<U> const &b )
+{
+    return a.get() == b.get();
+}
+
+template <class T, class U>
+bool operator != (wxSharedPtr<T> const &a, wxSharedPtr<U> const &b )
+{
+    return a.get() != b.get();
+}
+
+#endif // _WX_SHAREDPTR_H_
diff --git a/interface/wx/ptr_scpd.h b/interface/wx/ptr_scpd.h
deleted file mode 100644 (file)
index 7e0caa3..0000000
+++ /dev/null
@@ -1,438 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        ptr_scpd.h
-// Purpose:     interface of wxScopedPtr
-// Author:      wxWidgets team
-// RCS-ID:      $Id$
-// Licence:     wxWindows license
-/////////////////////////////////////////////////////////////////////////////
-
-/**
-    @class wxScopedPtr
-
-    This is a simple scoped smart pointer implementation that is similar to
-    the Boost smart pointers (see http://www.boost.org) but rewritten
-    to use macros instead.
-
-    Since wxWidgets 2.9.0 there is also a templated version of this class
-    with the same name. See wxScopedPtr<T>.
-
-    A smart pointer holds a pointer to an object. The memory used by the object is
-    deleted when the smart pointer goes out of scope. This class is different from
-    the @c std::auto_ptr<> in so far as it doesn't provide copy constructor
-    nor assignment operator. This limits what you can do with it but is much less
-    surprizing than the "destructive copy" behaviour of the standard class.
-
-    @b Example:
-
-    Below is an example of using a wxWidgets scoped smart pointer and pointer array.
-
-    @code
-    class MyClass{ ... };
-
-    // declare a smart pointer to a MyClass called wxMyClassPtr
-    wxDECLARE_SCOPED_PTR(MyClass, wxMyClassPtr)
-    // declare a smart pointer to an array of chars
-    wxDECLARE_SCOPED_ARRAY(char, wxCharArray)
-
-    ...
-
-    // define the first pointer class, must be complete
-    wxDEFINE_SCOPED_PTR(MyClass, wxMyClassPtr)
-    // define the second pointer class
-    wxDEFINE_SCOPED_ARRAY(char, wxCharArray)
-
-    // create an object with a new pointer to MyClass
-    wxMyClassPtr theObj(new MyClass());
-    // reset the pointer (deletes the previous one)
-    theObj.reset(new MyClass());
-
-    // access the pointer
-    theObj->MyFunc();
-
-    // create an object with a new array of chars
-    wxCharArray theCharObj(new char[100]);
-
-    // access the array
-    theCharObj[0] = "!";
-    @endcode
-
-    @section scopedptr_newpointers Declaring new smart pointer types
-
-    To declare the smart pointer class @c CLASSNAME containing pointes to
-    a (possibly incomplete) type @c TYPE you should use
-    @code
-        wxDECLARE_SCOPED_PTR( TYPE,        // type of the values
-                              CLASSNAME ); // name of the class
-    @endcode
-    And later, when @c TYPE is fully defined, you must also use
-    @code
-        wxDEFINE_SCOPED_PTR( TYPE, CLASSNAME );
-    @endcode
-    to implement the scoped pointer class.
-
-    The first argument of these macro is the pointer type, the second is the name
-    of the new smart pointer class being created. Below we will use wxScopedPtr
-    to represent the scoped pointer class, but the user may create the class with
-    any legal name.
-
-    Alternatively, if you don't have to separate the point of declaration and
-    definition of this class and if you accept the standard naming convention,
-    that is that the scoped pointer for the class @c Foo is called @c FooPtr,
-    you can use a single macro which replaces two macros above:
-    @code
-        wxDEFINE_SCOPED_PTR_TYPE( TYPE );
-    @endcode
-    Once again, in this cass @c CLASSNAME will be @c TYPEPtr.
-
-    @library{wxbase}
-    @category{smartpointers}
-
-    @see wxScopedArray
-*/
-class wxScopedPtr
-{
-public:
-    /**
-        Creates the smart pointer with the given pointer or none if @NULL.
-
-        On compilers that support it, this uses the explicit keyword.
-    */
-    explicit wxScopedPtr(type* T = NULL);
-
-    /**
-        Destructor frees the pointer help by this object if it is not @NULL.
-    */
-    ~wxScopedPtr();
-
-    /**
-        This operator gets the pointer stored in the smart pointer or returns
-        @NULL if there is none.
-    */
-    const T* get();
-
-    /**
-        This operator works like the standard C++ pointer operator to return the object
-        being pointed to by the pointer.
-
-        @note
-        If the pointer is @NULL or invalid this will crash.
-    */
-    const T& operator *();
-
-    /**
-        This operator works like the standard C++ pointer operator to return the pointer
-        in the smart pointer or @NULL if it is empty.
-    */
-    const T* operator ->();
-
-    /**
-        Returns the currently hold pointer and resets the smart pointer object to
-        @NULL.
-
-        @remarks
-        After a call to this function the caller is responsible for deleting the
-        pointer.
-    */
-    T* release();
-
-    /**
-        Deletes the currently held pointer and sets it to @a p or to @NULL if no
-        arguments are specified.
-
-        @note
-        This function does check to make sure that the pointer you are assigning
-        is not the same pointer that is already stored.
-    */
-    reset(T* p  = NULL);
-
-    /**
-        Swap the pointer inside the smart pointer with @a other. The pointer being
-        swapped must be of the same type (hence the same class name).
-    */
-    swap(wxScopedPtr& other);
-};
-
-
-
-/**
-    @class wxScopedArray
-
-    This is a simple scoped smart pointer array implementation that is similar to
-    the Boost smart pointers (see http://www.boost.org/) but rewritten to
-    use macros instead.
-
-    @b Example:
-
-    Below is an example of using a wxWidgets scoped smart pointer and pointer array.
-
-    @code
-    class MyClass { ... };
-
-    // declare a smart pointer to a MyClass called wxMyClassPtr
-    wxDECLARE_SCOPED_PTR(MyClass, wxMyClassPtr)
-    // declare a smart pointer to an array of chars
-    wxDECLARE_SCOPED_ARRAY(char, wxCharArray)
-
-    ...
-
-    // define the first pointer class, must be complete
-    wxDEFINE_SCOPED_PTR(MyClass, wxMyClassPtr)
-    // define the second pointer class
-    wxDEFINE_SCOPED_ARRAY(char, wxCharArray)
-
-    // create an object with a new pointer to MyClass
-    wxMyClassPtr theObj(new MyClass());
-    // reset the pointer (deletes the previous one)
-    theObj.reset(new MyClass());
-
-    // access the pointer
-    theObj->MyFunc();
-
-    // create an object with a new array of chars
-    wxCharArray theCharObj(new char[100]);
-
-    // access the array
-    theCharObj[0] = "!";
-    @endcode
-
-    <b>Declaring new smart pointer types:</b>
-    @code
-    wxDECLAR_SCOPED_ARRAY( TYPE,        // type of the values
-                           CLASSNAME ); // name of the class
-    @endcode
-
-    A smart pointer holds a pointer to an object (which must be complete when
-    wxDEFINE_SCOPED_ARRAY() is called).
-
-    The memory used by the object is deleted when the smart pointer goes out of
-    scope. The first argument of the macro is the pointer type, the second is the
-    name of the new smart pointer class being created. Below we will use wxScopedArray
-    to represent the scoped pointer array class, but the user may create the class with
-    any legal name.
-
-    @library{wxbase}
-    @category{smartpointers}
-
-    @see wxScopedPtr
-*/
-class wxScopedArray
-{
-public:
-    /**
-        Creates the smart pointer with the given pointer or none if @NULL.  On
-        compilers that support it, this uses the explicit keyword.
-    */
-    wxScopedArray(type*  T = NULL);
-
-    /**
-        This operator gets the pointer stored in the smart pointer or returns @NULL if
-        there is none.
-    */
-    const T* get();
-
-    /**
-        This operator acts like the standard [] indexing operator for C++ arrays.  The
-        function does not do bounds checking.
-    */
-    const T& operator [](long int i);
-
-    /**
-        Deletes the currently held pointer and sets it to 'p' or to @NULL if no
-        arguments are specified. This function does check to make sure that the
-        pointer you are assigning is not the same pointer that is already stored.
-    */
-    reset(T* p  = NULL);
-
-    /**
-        Swap the pointer inside the smart pointer with @a ot. The pointer being swapped
-        must be of the same type (hence the same class name).
-    */
-    swap(wxScopedPtr& ot);
-};
-
-
-
-/**
-    @class wxScopedTiedPtr
-
-    This is a variation on the topic of wxScopedPtr. This class is also a smart pointer
-    but in addition it "ties" the pointer value to another variable. In other words,
-    during the life time of this class the value of that variable is set to be the same
-    as the value of the pointer itself and it is reset to its old value when the object
-    is destroyed. This class is especially useful when converting the existing code
-    (which may already store the pointers value in some variable) to the smart pointers.
-
-    @library{wxbase}
-    @category{smartpointers}
-*/
-class wxScopedTiedPtr : public wxScopedPtr
-{
-public:
-    /**
-        Constructor creates a smart pointer initialized with @a ptr and stores
-        @a ptr in the location specified by @a ppTie which must not be @NULL.
-    */
-    wxScopedTiedPtr(T** ppTie, T* ptr);
-
-    /**
-        Destructor frees the pointer help by this object and restores the value
-        stored at the tied location (as specified in the @ref wxScopedTiedPtr() constructor)
-        to the old value.
-
-        @warning
-        This location may now contain an uninitialized value if it hadn't been
-        initialized previously, in particular don't count on it magically being @NULL!
-    */
-    ~wxScopedTiedPtr();
-};
-
-
-
-/**
-
-    A scoped pointer template class.
-
-    It is the template version of the old-style @ref wxScopedPtr "scoped pointer macros".
-
-    Notice that objects of this class intentionally cannot be copied.
-
-    @library{wxbase}
-    @category{smartpointers}
-
-    @see wxSharedPtr<T>, wxWeakRef<T>
-*/
-template<typename T>
-class wxScopedPtr<T>
-{
-public:
-    /**
-        Constructor takes ownership of the pointer.
-
-        @param ptr
-            Pointer allocated with @c new or @NULL.
-    */
-    wxScopedPtr(T* ptr = NULL);
-
-    /**
-        Destructor deletes the pointer.
-    */
-    ~wxScopedPtr();
-
-    /**
-        Returns pointer to object or @NULL.
-    */
-    T* get() const;
-
-    /**
-        Conversion to a boolean expression (in a variant which is not
-        convertible to anything but a boolean expression).
-
-        If this class contains a valid pointer it will return @true, if it contains
-        a @NULL pointer it will return @false.
-    */
-    operator unspecified_bool_type() const;
-
-    /**
-        Returns a reference to the object.
-
-        @note
-        If the internal pointer is @NULL this method will cause an assert
-        in debug mode.
-    */
-    T operator*() const;
-
-    /**
-        Returns pointer to object. If the pointer is @NULL this method will
-        cause an assert in debug mode.
-    */
-    T* operator->() const;
-
-    /**
-        Releases the current pointer and returns it.
-
-        @remarks
-        Afterwards the caller is responsible for deleting
-        the data contained in the scoped pointer before.
-    */
-    T* release();
-
-    /**
-        Reset pointer to the value of @a ptr.
-        The previous pointer will be deleted.
-    */
-    void reset(T* ptr = NULL);
-
-    /**
-        Swaps pointers.
-    */
-    void swap(wxScopedPtr<T>& ot);
-};
-
-/**
-    A scoped array template class.
-
-    This class is similar to boost scoped_array class:
-    http://www.boost.org/doc/libs/1_37_0/libs/smart_ptr/scoped_array.htm
-
-    Notice that objects of this class intentionally cannot be copied.
-
-    @library{wxbase}
-    @category{smartpointers}
- */
-template <class T>
-class wxScopedArray
-{
-public:
-    /// The type of the array elements.
-    typedef T element_type;
-
-    /**
-        Constructor takes ownership of the given array.
-
-        If @a array is @NULL, reset() must presumably be called later.
-
-        @param array
-            An array allocated using @c new[] or @NULL.
-     */
-    explicit wxScopedArray(T * array = NULL);
-
-    /// Destructor destroy the array.
-    ~wxScopedArray();
-
-    /**
-        Conversion to a boolean expression (in a variant which is not
-        convertible to anything but a boolean expression).
-
-        If this class contains a valid array it will return @true, if it contains
-        a @NULL pointer it will return @false.
-    */
-    operator unspecified_bool_type() const;
-
-    /**
-        Change the array pointer stored.
-
-        The previously stored array is deleted.
-
-        @param array
-            An array allocated using @c new[] or @NULL.
-     */
-    void reset(T *array = NULL);
-
-    /**
-        Return the n-th element of the array.
-
-        Must not be called if the array has no valid pointer.
-     */
-    T& operator[](size_t n) const;
-
-    /**
-        Return the array pointer.
-
-        The returned pointer may be @NULL. It must not be deleted by the
-        caller, call @c reset(NULL) instead.
-     */
-    T *get() const;
-
-    /// Swaps the contents of this array with another one.
-    void swap(wxScopedArray &other);
-};
diff --git a/interface/wx/ptr_shrd.h b/interface/wx/ptr_shrd.h
deleted file mode 100644 (file)
index 718e452..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        ptr_shrd.h
-// Purpose:     interface of wxSharedPtr<T>
-// Author:      wxWidgets team
-// RCS-ID:      $Id$
-// Licence:     wxWindows license
-/////////////////////////////////////////////////////////////////////////////
-
-/**
-
-    A smart pointer with non-intrusive reference counting. It is modeled after
-    @c boost::shared_ptr<> and can be used with STL containers and wxVector<T> -
-    unlike @c std::auto_ptr<> and wxScopedPtr<T>.
-
-    @library{wxbase}
-    @category{smartpointers}
-
-    @see wxScopedPtr<T>, wxWeakRef<T>, wxObjectDataPtr<T>
-*/
-
-template<typename T>
-class wxSharedPtr<T>
-{
-public:
-    /**
-        Constructor.
-
-        Creates shared pointer from the raw pointer @a ptr and takes ownership
-        of it.
-    */
-    wxEXPLICIT wxSharedPtr(T* ptr = NULL);
-
-    /**
-        Copy constructor.
-    */
-    wxSharedPtr(const wxSharedPtr<T>& tocopy);
-
-    /**
-        Destructor.
-    */
-    ~wxSharedPtr();
-
-    /**
-        Returns pointer to its object or @NULL.
-    */
-    T* get() const;
-
-    /**
-        Conversion to a boolean expression (in a variant which is not
-        convertable to anything but a boolean expression).
-
-        If this class contains a valid pointer it will return @true, if it contains
-        a @NULL pointer it will return @false.
-    */
-    operator unspecified_bool_type() const;
-
-    /**
-        Returns a reference to the object.
-
-        If the internal pointer is @NULL this method will cause an assert in debug mode.
-    */
-    T operator*() const;
-
-    /**
-        Returns pointer to its object or @NULL.
-    */
-    T* operator->() const;
-
-    /**
-        Assignment operator.
-
-        Releases any previously held pointer and creates a reference to @a ptr.
-    */
-    wxSharedPtr<T>& operator=(T* ptr);
-
-    /**
-        Assignment operator.
-
-        Releases any previously held pointer and creates a reference to the
-        same object as @a topcopy.
-    */
-    wxSharedPtr<T>& operator=(const wxSharedPtr<T>& tocopy);
-
-    /**
-        Reset pointer to @a ptr.
-
-        If the reference count of the previously owned pointer was 1 it will be deleted.
-    */
-    void reset(T* ptr = NULL);
-
-    /**
-        Returns @true if this is the only pointer pointing to its object.
-    */
-    bool unique() const;
-
-    /**
-        Returns the number of pointers pointing to its object.
-    */
-    long use_count() const;
-};
-
diff --git a/interface/wx/scopedarray.h b/interface/wx/scopedarray.h
new file mode 100644 (file)
index 0000000..1582f3c
--- /dev/null
@@ -0,0 +1,172 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/scopedarray.h
+// Purpose:     interface of wxScopedArray
+// Author:      wxWidgets team
+// RCS-ID:      $Id$
+// Licence:     wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+    @class wxScopedArray
+
+    This is a simple scoped smart pointer array implementation that is similar to
+    the Boost smart pointers (see http://www.boost.org/) but rewritten to
+    use macros instead.
+
+    @b Example:
+
+    Below is an example of using a wxWidgets scoped smart pointer and pointer array.
+
+    @code
+    class MyClass { ... };
+
+    // declare a smart pointer to a MyClass called wxMyClassPtr
+    wxDECLARE_SCOPED_PTR(MyClass, wxMyClassPtr)
+    // declare a smart pointer to an array of chars
+    wxDECLARE_SCOPED_ARRAY(char, wxCharArray)
+
+    ...
+
+    // define the first pointer class, must be complete
+    wxDEFINE_SCOPED_PTR(MyClass, wxMyClassPtr)
+    // define the second pointer class
+    wxDEFINE_SCOPED_ARRAY(char, wxCharArray)
+
+    // create an object with a new pointer to MyClass
+    wxMyClassPtr theObj(new MyClass());
+    // reset the pointer (deletes the previous one)
+    theObj.reset(new MyClass());
+
+    // access the pointer
+    theObj->MyFunc();
+
+    // create an object with a new array of chars
+    wxCharArray theCharObj(new char[100]);
+
+    // access the array
+    theCharObj[0] = "!";
+    @endcode
+
+    <b>Declaring new smart pointer types:</b>
+    @code
+    wxDECLAR_SCOPED_ARRAY( TYPE,        // type of the values
+                           CLASSNAME ); // name of the class
+    @endcode
+
+    A smart pointer holds a pointer to an object (which must be complete when
+    wxDEFINE_SCOPED_ARRAY() is called).
+
+    The memory used by the object is deleted when the smart pointer goes out of
+    scope. The first argument of the macro is the pointer type, the second is the
+    name of the new smart pointer class being created. Below we will use wxScopedArray
+    to represent the scoped pointer array class, but the user may create the class with
+    any legal name.
+
+    @library{wxbase}
+    @category{smartpointers}
+
+    @see wxScopedPtr
+*/
+class wxScopedArray
+{
+public:
+    /**
+        Creates the smart pointer with the given pointer or none if @NULL.  On
+        compilers that support it, this uses the explicit keyword.
+    */
+    wxScopedArray(type*  T = NULL);
+
+    /**
+        This operator gets the pointer stored in the smart pointer or returns @NULL if
+        there is none.
+    */
+    const T* get();
+
+    /**
+        This operator acts like the standard [] indexing operator for C++ arrays.  The
+        function does not do bounds checking.
+    */
+    const T& operator [](long int i);
+
+    /**
+        Deletes the currently held pointer and sets it to 'p' or to @NULL if no
+        arguments are specified. This function does check to make sure that the
+        pointer you are assigning is not the same pointer that is already stored.
+    */
+    reset(T* p  = NULL);
+
+    /**
+        Swap the pointer inside the smart pointer with @a ot. The pointer being swapped
+        must be of the same type (hence the same class name).
+    */
+    swap(wxScopedArray& ot);
+};
+
+/**
+    A scoped array template class.
+
+    This class is similar to boost scoped_array class:
+    http://www.boost.org/doc/libs/1_37_0/libs/smart_ptr/scoped_array.htm
+
+    Notice that objects of this class intentionally cannot be copied.
+
+    @library{wxbase}
+    @category{smartpointers}
+ */
+template <class T>
+class wxScopedArray
+{
+public:
+    /// The type of the array elements.
+    typedef T element_type;
+
+    /**
+        Constructor takes ownership of the given array.
+
+        If @a array is @NULL, reset() must presumably be called later.
+
+        @param array
+            An array allocated using @c new[] or @NULL.
+     */
+    explicit wxScopedArray(T * array = NULL);
+
+    /// Destructor destroy the array.
+    ~wxScopedArray();
+
+    /**
+        Conversion to a boolean expression (in a variant which is not
+        convertible to anything but a boolean expression).
+
+        If this class contains a valid array it will return @true, if it contains
+        a @NULL pointer it will return @false.
+    */
+    operator unspecified_bool_type() const;
+
+    /**
+        Change the array pointer stored.
+
+        The previously stored array is deleted.
+
+        @param array
+            An array allocated using @c new[] or @NULL.
+     */
+    void reset(T *array = NULL);
+
+    /**
+        Return the n-th element of the array.
+
+        Must not be called if the array has no valid pointer.
+     */
+    T& operator[](size_t n) const;
+
+    /**
+        Return the array pointer.
+
+        The returned pointer may be @NULL. It must not be deleted by the
+        caller, call @c reset(NULL) instead.
+     */
+    T *get() const;
+
+    /// Swaps the contents of this array with another one.
+    void swap(wxScopedArray &other);
+};
diff --git a/interface/wx/scopedptr.h b/interface/wx/scopedptr.h
new file mode 100644 (file)
index 0000000..53d1eb4
--- /dev/null
@@ -0,0 +1,269 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/scopedptr.h
+// Purpose:     interface of wxScopedPtr
+// Author:      wxWidgets team
+// RCS-ID:      $Id$
+// Licence:     wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+    @class wxScopedPtr
+
+    This is a simple scoped smart pointer implementation that is similar to
+    the Boost smart pointers (see http://www.boost.org) but rewritten
+    to use macros instead.
+
+    Since wxWidgets 2.9.0 there is also a templated version of this class
+    with the same name. See wxScopedPtr<T>.
+
+    A smart pointer holds a pointer to an object. The memory used by the object is
+    deleted when the smart pointer goes out of scope. This class is different from
+    the @c std::auto_ptr<> in so far as it doesn't provide copy constructor
+    nor assignment operator. This limits what you can do with it but is much less
+    surprizing than the "destructive copy" behaviour of the standard class.
+
+    @b Example:
+
+    Below is an example of using a wxWidgets scoped smart pointer and pointer array.
+
+    @code
+    class MyClass{ ... };
+
+    // declare a smart pointer to a MyClass called wxMyClassPtr
+    wxDECLARE_SCOPED_PTR(MyClass, wxMyClassPtr)
+    // declare a smart pointer to an array of chars
+    wxDECLARE_SCOPED_ARRAY(char, wxCharArray)
+
+    ...
+
+    // define the first pointer class, must be complete
+    wxDEFINE_SCOPED_PTR(MyClass, wxMyClassPtr)
+    // define the second pointer class
+    wxDEFINE_SCOPED_ARRAY(char, wxCharArray)
+
+    // create an object with a new pointer to MyClass
+    wxMyClassPtr theObj(new MyClass());
+    // reset the pointer (deletes the previous one)
+    theObj.reset(new MyClass());
+
+    // access the pointer
+    theObj->MyFunc();
+
+    // create an object with a new array of chars
+    wxCharArray theCharObj(new char[100]);
+
+    // access the array
+    theCharObj[0] = "!";
+    @endcode
+
+    @section scopedptr_newpointers Declaring new smart pointer types
+
+    To declare the smart pointer class @c CLASSNAME containing pointes to
+    a (possibly incomplete) type @c TYPE you should use
+    @code
+        wxDECLARE_SCOPED_PTR( TYPE,        // type of the values
+                              CLASSNAME ); // name of the class
+    @endcode
+    And later, when @c TYPE is fully defined, you must also use
+    @code
+        wxDEFINE_SCOPED_PTR( TYPE, CLASSNAME );
+    @endcode
+    to implement the scoped pointer class.
+
+    The first argument of these macro is the pointer type, the second is the name
+    of the new smart pointer class being created. Below we will use wxScopedPtr
+    to represent the scoped pointer class, but the user may create the class with
+    any legal name.
+
+    Alternatively, if you don't have to separate the point of declaration and
+    definition of this class and if you accept the standard naming convention,
+    that is that the scoped pointer for the class @c Foo is called @c FooPtr,
+    you can use a single macro which replaces two macros above:
+    @code
+        wxDEFINE_SCOPED_PTR_TYPE( TYPE );
+    @endcode
+    Once again, in this cass @c CLASSNAME will be @c TYPEPtr.
+
+    @library{wxbase}
+    @category{smartpointers}
+
+    @see wxScopedArray
+*/
+class wxScopedPtr
+{
+public:
+    /**
+        Creates the smart pointer with the given pointer or none if @NULL.
+
+        On compilers that support it, this uses the explicit keyword.
+    */
+    explicit wxScopedPtr(type* T = NULL);
+
+    /**
+        Destructor frees the pointer help by this object if it is not @NULL.
+    */
+    ~wxScopedPtr();
+
+    /**
+        This operator gets the pointer stored in the smart pointer or returns
+        @NULL if there is none.
+    */
+    const T* get();
+
+    /**
+        This operator works like the standard C++ pointer operator to return the object
+        being pointed to by the pointer.
+
+        @note
+        If the pointer is @NULL or invalid this will crash.
+    */
+    const T& operator *();
+
+    /**
+        This operator works like the standard C++ pointer operator to return the pointer
+        in the smart pointer or @NULL if it is empty.
+    */
+    const T* operator ->();
+
+    /**
+        Returns the currently hold pointer and resets the smart pointer object to
+        @NULL.
+
+        @remarks
+        After a call to this function the caller is responsible for deleting the
+        pointer.
+    */
+    T* release();
+
+    /**
+        Deletes the currently held pointer and sets it to @a p or to @NULL if no
+        arguments are specified.
+
+        @note
+        This function does check to make sure that the pointer you are assigning
+        is not the same pointer that is already stored.
+    */
+    reset(T* p  = NULL);
+
+    /**
+        Swap the pointer inside the smart pointer with @a other. The pointer being
+        swapped must be of the same type (hence the same class name).
+    */
+    swap(wxScopedPtr& other);
+};
+
+/**
+    @class wxScopedTiedPtr
+
+    This is a variation on the topic of wxScopedPtr. This class is also a smart pointer
+    but in addition it "ties" the pointer value to another variable. In other words,
+    during the life time of this class the value of that variable is set to be the same
+    as the value of the pointer itself and it is reset to its old value when the object
+    is destroyed. This class is especially useful when converting the existing code
+    (which may already store the pointers value in some variable) to the smart pointers.
+
+    @library{wxbase}
+    @category{smartpointers}
+*/
+class wxScopedTiedPtr : public wxScopedPtr
+{
+public:
+    /**
+        Constructor creates a smart pointer initialized with @a ptr and stores
+        @a ptr in the location specified by @a ppTie which must not be @NULL.
+    */
+    wxScopedTiedPtr(T** ppTie, T* ptr);
+
+    /**
+        Destructor frees the pointer help by this object and restores the value
+        stored at the tied location (as specified in the @ref wxScopedTiedPtr() constructor)
+        to the old value.
+
+        @warning
+        This location may now contain an uninitialized value if it hadn't been
+        initialized previously, in particular don't count on it magically being @NULL!
+    */
+    ~wxScopedTiedPtr();
+};
+
+
+
+/**
+    A scoped pointer template class.
+
+    It is the template version of the old-style @ref wxScopedPtr "scoped pointer macros".
+
+    Notice that objects of this class intentionally cannot be copied.
+
+    @library{wxbase}
+    @category{smartpointers}
+
+    @see wxSharedPtr<T>, wxWeakRef<T>
+*/
+template<typename T>
+class wxScopedPtr<T>
+{
+public:
+    /**
+        Constructor takes ownership of the pointer.
+
+        @param ptr
+            Pointer allocated with @c new or @NULL.
+    */
+    wxScopedPtr(T* ptr = NULL);
+
+    /**
+        Destructor deletes the pointer.
+    */
+    ~wxScopedPtr();
+
+    /**
+        Returns pointer to object or @NULL.
+    */
+    T* get() const;
+
+    /**
+        Conversion to a boolean expression (in a variant which is not
+        convertible to anything but a boolean expression).
+
+        If this class contains a valid pointer it will return @true, if it contains
+        a @NULL pointer it will return @false.
+    */
+    operator unspecified_bool_type() const;
+
+    /**
+        Returns a reference to the object.
+
+        @note
+        If the internal pointer is @NULL this method will cause an assert
+        in debug mode.
+    */
+    T operator*() const;
+
+    /**
+        Returns pointer to object. If the pointer is @NULL this method will
+        cause an assert in debug mode.
+    */
+    T* operator->() const;
+
+    /**
+        Releases the current pointer and returns it.
+
+        @remarks
+        Afterwards the caller is responsible for deleting
+        the data contained in the scoped pointer before.
+    */
+    T* release();
+
+    /**
+        Reset pointer to the value of @a ptr.
+        The previous pointer will be deleted.
+    */
+    void reset(T* ptr = NULL);
+
+    /**
+        Swaps pointers.
+    */
+    void swap(wxScopedPtr<T>& ot);
+};
+
diff --git a/interface/wx/sharedptr.h b/interface/wx/sharedptr.h
new file mode 100644 (file)
index 0000000..7e7f43d
--- /dev/null
@@ -0,0 +1,100 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        sharedptr.h
+// Purpose:     interface of wxSharedPtr<T>
+// Author:      wxWidgets team
+// RCS-ID:      $Id$
+// Licence:     wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+    A smart pointer with non-intrusive reference counting.
+
+    It is modeled after @c boost::shared_ptr<> and can be used with STL
+    containers and wxVector<T> unlike @c std::auto_ptr<> and wxScopedPtr<T>.
+
+    @library{wxbase}
+    @category{smartpointers}
+
+    @see wxScopedPtr<T>, wxWeakRef<T>, wxObjectDataPtr<T>
+*/
+template<typename T>
+class wxSharedPtr<T>
+{
+public:
+    /**
+        Constructor.
+
+        Creates shared pointer from the raw pointer @a ptr and takes ownership
+        of it.
+    */
+    wxEXPLICIT wxSharedPtr(T* ptr = NULL);
+
+    /**
+        Copy constructor.
+    */
+    wxSharedPtr(const wxSharedPtr<T>& tocopy);
+
+    /**
+        Destructor.
+    */
+    ~wxSharedPtr();
+
+    /**
+        Returns pointer to its object or @NULL.
+    */
+    T* get() const;
+
+    /**
+        Conversion to a boolean expression (in a variant which is not
+        convertible to anything but a boolean expression).
+
+        If this class contains a valid pointer it will return @true, if it contains
+        a @NULL pointer it will return @false.
+    */
+    operator unspecified_bool_type() const;
+
+    /**
+        Returns a reference to the object.
+
+        If the internal pointer is @NULL this method will cause an assert in debug mode.
+    */
+    T operator*() const;
+
+    /**
+        Returns pointer to its object or @NULL.
+    */
+    T* operator->() const;
+
+    /**
+        Assignment operator.
+
+        Releases any previously held pointer and creates a reference to @a ptr.
+    */
+    wxSharedPtr<T>& operator=(T* ptr);
+
+    /**
+        Assignment operator.
+
+        Releases any previously held pointer and creates a reference to the
+        same object as @a topcopy.
+    */
+    wxSharedPtr<T>& operator=(const wxSharedPtr<T>& tocopy);
+
+    /**
+        Reset pointer to @a ptr.
+
+        If the reference count of the previously owned pointer was 1 it will be deleted.
+    */
+    void reset(T* ptr = NULL);
+
+    /**
+        Returns @true if this is the only pointer pointing to its object.
+    */
+    bool unique() const;
+
+    /**
+        Returns the number of pointers pointing to its object.
+    */
+    long use_count() const;
+};
+
index 740deebb2b4b221369d1e0e38b48c13061ae7fd6..30c7f093b2eeb4649610622bdcfc8c685659f2fd 100644 (file)
@@ -42,7 +42,7 @@
 #include "wx/evtloop.h"
 #include "wx/filename.h"
 #include "wx/msgout.h"
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 #include "wx/tokenzr.h"
 #include "wx/thread.h"
 
index 9c5118b3c19acae80011be9fa9e6868a06f73bcc..dc2704999528206eea55859739eaafcc8a677bc4 100644 (file)
@@ -58,7 +58,8 @@
 #include "wx/filename.h"
 #include "wx/stdpaths.h"
 #include "wx/vector.h"
-#include "wx/ptr_scpd.h"
+#include "wx/scopedarray.h"
+#include "wx/scopedptr.h"
 
 #if wxUSE_STD_IOSTREAM
     #include "wx/ioswrap.h"
index 6a878fd4601561017f111d9b124906a9e67a8dd2..a3cce6f3f38dfb114129b7c8680bfd21247074eb 100644 (file)
@@ -47,7 +47,7 @@
 #include "wx/thread.h"
 
 #if wxUSE_BASE
-    #include "wx/ptr_scpd.h"
+    #include "wx/scopedptr.h"
 
     wxDECLARE_SCOPED_PTR(wxEvent, wxEventPtr)
     wxDEFINE_SCOPED_PTR(wxEvent, wxEventPtr)
index 621fed3a233a36b0f5896a00da631e40f3f36cbd..628a34af0e6f3c191592a9291bae76840a560872 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef WX_PRECOMP
 #endif
 
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 
 wxDEFINE_SCOPED_PTR_TYPE(wxFSFile)
 wxDEFINE_SCOPED_PTR_TYPE(wxInputStream)
index 0a2dad27244465b6811980ccb722e872c247b656..fb55baac1b19d930a42fc4cb81dc62f0f68db1f0 100644 (file)
@@ -24,7 +24,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "wx/gifdecod.h"
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 #include "wx/scopeguard.h"
 
 
index d9d3cf0dc70d01f147b5cead787a978fcc8d22d1..91e0abaf70e25e6e35a2732dd968a71e67625ab9 100644 (file)
@@ -34,7 +34,7 @@
 #include "wx/init.h"
 #include "wx/thread.h"
 
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 #include "wx/except.h"
 
 #if defined(__WXMSW__) && defined(__WXDEBUG__)
index d0a11eac2f7ce58beb5092ffe0e2af015e988c28..2284a724906607fe5a4163252e7a237bf8c15ff6 100644 (file)
@@ -66,7 +66,7 @@
 #include "wx/tokenzr.h"
 #include "wx/fontmap.h"
 #include "wx/encconv.h"
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 #include "wx/apptrait.h"
 #include "wx/stdpaths.h"
 #include "wx/hashset.h"
index b44fcf3a7528fdbfa17decda0034a570e0b5c320..1206b78fa0b30584a574c6c06a01ebdd24198954 100644 (file)
@@ -32,7 +32,7 @@
 #include "wx/apptrait.h"
 #include "wx/renderer.h"
 
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 
 #if wxUSE_DYNLIB_CLASS
     #include "wx/dynlib.h"
index 7eb827582e3f499dcd1d4b7ca6d3bedf4f0cde5d..033c34cf093a688d52a79b04effb627fb884304c 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "wx/buffer.h"
 #include "wx/datetime.h"
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 #include "wx/filename.h"
 #include "wx/thread.h"
 
index 0bb02d568ddbae1ff00b51664bbcbb5960857cd9..8461c744228224b38b40d055cabb6853532903e1 100644 (file)
@@ -28,7 +28,7 @@
 #include "wx/datstrm.h"
 #include "wx/zstream.h"
 #include "wx/mstream.h"
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 #include "wx/wfstream.h"
 #include "zlib.h"
 
index 15ffd8be44b703f29bcbc00688f0697544092cff..3ab24136a84f1e78611bc05d136b5548817814ca 100644 (file)
     #include "wx/dataobj.h"
 #endif
 
-#include "wx/ptr_scpd.h"
+#include "wx/scopedarray.h"
 #include "wx/scopeguard.h"
 
 #include "wx/gtk/private.h"
 
-wxDECLARE_SCOPED_ARRAY(wxDataFormat, wxDataFormatArray)
-wxDEFINE_SCOPED_ARRAY(wxDataFormat, wxDataFormatArray)
+typedef wxScopedArray<wxDataFormat> wxDataFormatArray;
 
 // ----------------------------------------------------------------------------
 // data
index 01006829141fda0983f87c7cb485457855bbc336..2a2e83a0e00fd90db3079fe7ea92588dbdc8200a 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "wx/evtloop.h"
 
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 
 #include <gtk/gtk.h>
 
index 936328d7cf1f12aa418c45344309396cdd9fd92f..6a383909435d4c22d8952223db9571747e082bb0 100644 (file)
@@ -32,7 +32,9 @@
     #include "wx/dataobj.h"
 #endif
 
-#include "wx/ptr_scpd.h"
+#include "wx/scopedarray.h"
+
+typedef wxScopedArray<wxDataFormat> wxDataFormatScopedArray;
 
 #ifdef __VMS__
 #pragma message disable nosimpint
@@ -233,9 +235,6 @@ bool wxClipboard::SetData( wxDataObject *data )
     return AddData( data );
 }
 
-wxDECLARE_SCOPED_ARRAY( wxDataFormat, wxDataFormatScopedArray )
-wxDEFINE_SCOPED_ARRAY( wxDataFormat, wxDataFormatScopedArray )
-
 #if wxCHECK_LESSTIF()
 void wxClipboardCallback( Widget xwidget, int* data_id,
                           int* priv, int* WXUNUSED(reason) )
index 55bd004088e09c714de08b0ffa72fc15d5b4b32f..1f9459d57d3d024d33ae6e14721f142bf6bdcb06 100644 (file)
@@ -40,7 +40,7 @@
 
 #include "wx/msw/private.h"
 #include "wx/evtloop.h"
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 
 #if defined(__SMARTPHONE__) && defined(__WXWINCE__)
     #include "wx/msw/wince/resources.h"
index d09faae69f8a00b25b74cac953c4ed126f114c9c..78d4ee212e3f026fa314a7d87f72a2a6439d01a3 100644 (file)
@@ -34,7 +34,6 @@
 #include "wx/evtloop.h"
 #include "wx/thread.h"
 #include "wx/except.h"
-#include "wx/ptr_scpd.h"
 #include "wx/msw/private.h"
 
 #if wxUSE_GUI
index 46346acca8a8482e1b29167ad43b1156c613f609..b7c688c171ed54f9f3b083a705076be5a71c4797 100644 (file)
@@ -39,7 +39,7 @@
     #include "wx/ownerdrw.h"
 #endif
 
-#include "wx/ptr_scpd.h"
+#include "wx/scopedarray.h"
 
 #include "wx/msw/private.h"
 #include "wx/msw/wrapcctl.h" // include <commctrl.h> "properly"
index 140831106f7a9ec6dcaf16a79b5ede90b65bd057..b5d1b6ef2faf514af68eb5bd3bfa67fa7fa709b7 100644 (file)
@@ -46,7 +46,7 @@
 #include "wx/artprov.h"
 #include "wx/sysopt.h"
 #include "wx/dcclient.h"
-#include "wx/ptr_scpd.h"
+#include "wx/scopedarray.h"
 
 #include "wx/msw/private.h"
 #include "wx/msw/dc.h"
index 0f299aaff56194660df7e6f42a1d398955dd63fe..d7da58b4687b8107b98a6a846cb8ff11418845d4 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "wx/os2/private.h"
 #include "wx/evtloop.h"
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 
 #define wxDIALOG_DEFAULT_X 300
 #define wxDIALOG_DEFAULT_Y 300
index da4a396c41d8e82ff57e67f05a0807366988301c..b054bfce488b331ce75910771848b08c0fd354d6 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "wx/evtloop.h"
 #include "wx/tooltip.h"
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 
 #include "wx/os2/private.h"
 #include "wx/os2/private/timer.h"       // for wxTimerProc
index 971d771aae7cdfbecef30ff1383179b4afa20024..32989e6eef7546ab125d4fc938e86da7c2b238ee 100644 (file)
@@ -36,7 +36,7 @@
 #endif
 
 #include "wx/evtloop.h"
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 
 // ----------------------------------------------------------------------------
 // wxWin macros
index 5dc164d1574eebfa0d5e890302ef85b442a50da6..5835fb3df8e3f9f21ee216c6058b7f504361edae 100644 (file)
@@ -33,7 +33,6 @@
 
 #include "wx/tooltip.h"
 #include "wx/except.h"
-#include "wx/ptr_scpd.h"
 
 #if wxUSE_THREADS
     #include "wx/thread.h"
index 1555d29b726810f2d062b5204dcaef0b7e578cc9..0f5e61d83cc943082540b8aeb504f6fd88a618f3 100644 (file)
@@ -29,7 +29,7 @@
 #include "wx/datstrm.h"
 #include "wx/zstream.h"
 #include "wx/strconv.h"
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
 
 #include "expat.h" // from Expat
 
index 4736b7dcb6ab7f7557b0641109086ada6842ac33..7bd321f1ff3a3b2ddfdfe42be33f4e193c131ea4 100644 (file)
@@ -217,6 +217,7 @@ wx/beforestd.h
 wx/buffer.h
 wx/build.h
 wx/chartype.h
+wx/checkeddelete.h
 wx/chkconf.h
 wx/clntdata.h
 wx/cmdargs.h
@@ -290,7 +291,10 @@ wx/ptr_scpd.h
 wx/ptr_shrd.h
 wx/recguard.h
 wx/regex.h
+wx/scopedarray.h
+wx/scopedptr.h
 wx/scopeguard.h
+wx/sharedptr.h
 wx/snglinst.h
 wx/sstream.h
 wx/stack.h
@@ -341,8 +345,6 @@ wx/meta/convertible.h
 wx/meta/if.h
 wx/meta/int2type.h
 wx/meta/movable.h
-wx/private/fdiodispatcher.h
-wx/private/selectdispatcher.h
 wx/unix/app.h
 wx/unix/apptbase.h
 wx/unix/apptrait.h
index b08d11074eafd1973bd59303868337e34c12fc62..d1c674579bf407535fda9c3a76ba894e03c7519b 100644 (file)
@@ -122,6 +122,7 @@ wx/beforestd.h
 wx/buffer.h
 wx/build.h
 wx/chartype.h
+wx/checkeddelete.h
 wx/chkconf.h
 wx/clntdata.h
 wx/cmdargs.h
@@ -195,7 +196,10 @@ wx/ptr_scpd.h
 wx/ptr_shrd.h
 wx/recguard.h
 wx/regex.h
+wx/scopedarray.h
+wx/scopedptr.h
 wx/scopeguard.h
+wx/sharedptr.h
 wx/snglinst.h
 wx/sstream.h
 wx/stack.h
@@ -246,8 +250,6 @@ wx/meta/convertible.h
 wx/meta/if.h
 wx/meta/int2type.h
 wx/meta/movable.h
-wx/private/fdiodispatcher.h
-wx/private/selectdispatcher.h
 wx/unix/app.h
 wx/unix/apptbase.h
 wx/unix/apptrait.h
index ab1b782d297bec385008e2b4f7f93ab3f5864da0..5a532f693fe6748599aa6618e2b67e55b57f8aa3 100644 (file)
@@ -146,6 +146,7 @@ wx/beforestd.h
 wx/buffer.h
 wx/build.h
 wx/chartype.h
+wx/checkeddelete.h
 wx/chkconf.h
 wx/clntdata.h
 wx/cmdargs.h
@@ -219,7 +220,10 @@ wx/ptr_scpd.h
 wx/ptr_shrd.h
 wx/recguard.h
 wx/regex.h
+wx/scopedarray.h
+wx/scopedptr.h
 wx/scopeguard.h
+wx/sharedptr.h
 wx/snglinst.h
 wx/sstream.h
 wx/stack.h
@@ -270,8 +274,6 @@ wx/meta/convertible.h
 wx/meta/if.h
 wx/meta/int2type.h
 wx/meta/movable.h
-wx/private/fdiodispatcher.h
-wx/private/selectdispatcher.h
 wx/unix/app.h
 wx/unix/apptbase.h
 wx/unix/apptrait.h