diff options
author | OBATA Akio <obache@wizdas.com> | 2022-01-22 14:34:09 +0900 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2022-01-22 19:00:03 +0100 |
commit | 0baef91f719d24223b99ebe18aa071aa5212208f (patch) | |
tree | fa1ce92099fe9d5ec8978149aa29265200d0ee6f /kghostview/dscparse | |
parent | 6388395cd3959459662a93cd3f2ca0576a4f3a5a (diff) | |
download | tdegraphics-0baef91f719d24223b99ebe18aa071aa5212208f.tar.gz tdegraphics-0baef91f719d24223b99ebe18aa071aa5212208f.zip |
Change to use c++11 unique_ptr instead of deprecated auto_ptr
Signed-off-by: OBATA Akio <obache@wizdas.com>
(cherry picked from commit 0d168f7ecdd875e739d7e3fb0df7348bc5d7deb0)
Diffstat (limited to 'kghostview/dscparse')
-rw-r--r-- | kghostview/dscparse/dscparse_adapter.cpp | 16 | ||||
-rw-r--r-- | kghostview/dscparse/dscparse_adapter.h | 54 |
2 files changed, 10 insertions, 60 deletions
diff --git a/kghostview/dscparse/dscparse_adapter.cpp b/kghostview/dscparse/dscparse_adapter.cpp index 11596c63..5aae47b8 100644 --- a/kghostview/dscparse/dscparse_adapter.cpp +++ b/kghostview/dscparse/dscparse_adapter.cpp @@ -282,20 +282,20 @@ const CDSCMEDIA* KDSC::page_media() const return _cdsc->page_media; } -auto_ptr<KDSCBBOX> KDSC::bbox() const +unique_ptr<KDSCBBOX> KDSC::bbox() const { - if( _cdsc->bbox == 0 ) - return auto_ptr<KDSCBBOX>( 0 ); + if( _cdsc->bbox == nullptr ) + return unique_ptr<KDSCBBOX>( nullptr ); else - return auto_ptr<KDSCBBOX>( new KDSCBBOX( *_cdsc->bbox ) ); + return unique_ptr<KDSCBBOX>( new KDSCBBOX( *_cdsc->bbox ) ); } -auto_ptr<KDSCBBOX> KDSC::page_bbox() const +unique_ptr<KDSCBBOX> KDSC::page_bbox() const { - if( _cdsc->page_bbox == 0 ) - return auto_ptr<KDSCBBOX>( 0 ); + if( _cdsc->page_bbox == nullptr ) + return unique_ptr<KDSCBBOX>( nullptr ); else - return auto_ptr<KDSCBBOX>( new KDSCBBOX( *_cdsc->page_bbox ) ); + return unique_ptr<KDSCBBOX>( new KDSCBBOX( *_cdsc->page_bbox ) ); } TQString KDSC::dsc_title() const diff --git a/kghostview/dscparse/dscparse_adapter.h b/kghostview/dscparse/dscparse_adapter.h index 05b7e637..77855972 100644 --- a/kghostview/dscparse/dscparse_adapter.h +++ b/kghostview/dscparse/dscparse_adapter.h @@ -28,51 +28,6 @@ #include "dscparse.h" -#if defined(__GNUC__) -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 93) -/* - * We add a quick 'n' dirty inline implementation of auto_ptr for older - * releases of GCC, which don't include an auto_ptr implementation in - * <memory>. - */ - -template <class T> class auto_ptr { -private: - T* _ptr; - -public: - typedef T element_type; - explicit auto_ptr(T* p = 0) : _ptr(p) {} - auto_ptr(auto_ptr& a) : _ptr(a.release()) {} - template <class T1> auto_ptr(auto_ptr<T1>& a) : _ptr(a.release()) {} - auto_ptr& operator=(auto_ptr& a) { - if (&a != this) { - delete _ptr; - _ptr = a.release(); - } - return *this; - } - template <class T1> - auto_ptr& operator=(auto_ptr<T1>& a) { - if (a.get() != this->get()) { - delete _ptr; - _ptr = a.release(); - } - return *this; - } - ~auto_ptr() { delete _ptr; } - - T& operator*() const { return *_ptr; } - T* operator->() const { return _ptr; } - T* get() const { return _ptr; } - T* release() { T* tmp = _ptr; _ptr = 0; return tmp; } - void reset(T* p = 0) { delete _ptr; _ptr = p; } -}; - -#endif -#endif - - class KDSCBBOX { public: @@ -304,13 +259,8 @@ public: CDSCMEDIA** media() const; const CDSCMEDIA* page_media() const; -#if defined(__GNUC__) && (__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 93)) - auto_ptr<KDSCBBOX> bbox() const; - auto_ptr<KDSCBBOX> page_bbox() const; -#else - std::auto_ptr<KDSCBBOX> bbox() const; - std::auto_ptr<KDSCBBOX> page_bbox() const; -#endif + std::unique_ptr<KDSCBBOX> bbox() const; + std::unique_ptr<KDSCBBOX> page_bbox() const; // CDSCDOSEPS *doseps; |