Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

core/StelObjectType.hpp

Go to the documentation of this file.
00001 /*
00002  * Stellarium
00003  * Copyright (C) 2007 Fabien Chereau
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 #ifndef _STELOBJECTTYPE_HPP_
00021 #define _STELOBJECTTYPE_HPP_
00022 
00023 #include <QSharedPointer>
00024 
00027 template <class T> class QSharedPointerNoDelete : public QSharedPointer<T>
00028 {
00029 public:
00030     QSharedPointerNoDelete() {;}
00031     QSharedPointerNoDelete(T *ptr) : QSharedPointer<T>(ptr, QSharedPointerNoDelete::noDelete) {;}
00032     QSharedPointerNoDelete(T *ptr, bool own) : QSharedPointer<T>(ptr) {Q_UNUSED(own); Q_ASSERT(own==true);}
00033     QSharedPointerNoDelete(const QSharedPointer<T>& ptr) : QSharedPointer<T>(ptr) {;}
00034     static void noDelete(T *ptr) {Q_UNUSED(ptr);}
00035     inline operator const QSharedPointer<T>&() const {return *(static_cast<QSharedPointer<T> >(this));}
00036 };
00037 
00040 
00041 class StelObject;
00042 
00045 typedef QSharedPointerNoDelete<StelObject> StelObjectP;
00046 
00047 #endif // _STELOBJECTTYPE_HPP_

Generated on Wed Jun 2 13:11:13 2010 for Stellarium by  doxygen 1.5.5