X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Fmathml_editor%2Fsrc%2FPtr.hh;fp=helm%2FDEVEL%2Fmathml_editor%2Fsrc%2FPtr.hh;h=0000000000000000000000000000000000000000;hb=f761deff2f2f8c0cce674d2885b22a94a972ea85;hp=9330c96cfb22c897d10dbe3185bfaabb11da3309;hpb=841f96d4a534645067f92e9701b55edcc21e9600;p=helm.git diff --git a/helm/DEVEL/mathml_editor/src/Ptr.hh b/helm/DEVEL/mathml_editor/src/Ptr.hh deleted file mode 100644 index 9330c96cf..000000000 --- a/helm/DEVEL/mathml_editor/src/Ptr.hh +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2000-2002, Luca Padovani . -// -// This file is part of GtkMathView, a Gtk widget for MathML. -// -// GtkMathView is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// GtkMathView 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 General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with GtkMathView; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// For details, see the GtkMathView World-Wide-Web page, -// http://www.cs.unibo.it/helm/mml-widget, or send a mail to -// - -#ifndef Ptr_hh -#define Ptr_hh - -template -class Ptr -{ -public: - Ptr(P* p = 0) : ptr(p) { if (ptr != 0) ptr->ref(); } - Ptr(const Ptr& p) : ptr(p.ptr) { if (ptr != 0) ptr->ref(); } - ~Ptr() { if (ptr != 0) ptr->unref(); } - - P* operator->() const { assert(ptr != 0); return ptr; } - Ptr& operator=(const Ptr& p) - { - if (ptr == p.ptr) return *this; - if (p.ptr != 0) p.ptr->ref(); - if (ptr != 0) ptr->unref(); - ptr = p.ptr; - return *this; - } - - operator P*() const { return ptr; } - template friend Ptr smart_cast(const Ptr& p) { return Ptr(dynamic_cast(p.ptr)); } - template friend bool is_a(const Ptr& p) { return dynamic_cast(p.ptr) != 0; } - template operator Ptr() const { return Ptr(ptr); } - -private: - P* ptr; -}; - -#endif // Ptr_hh