Avogadro  1.1.0
/home/kitware/dashboards/avogadro/libavogadro/src/idlist.h
00001 /**********************************************************************
00002   IDList - Organized List of Primitives.
00003 
00004   Copyright (C) 2007 Donald Ephraim Curtis
00005 
00006   This file is part of the Avogadro molecular editor project.
00007   For more information, see <http://avogadro.openmolecules.net/>
00008 
00009   Avogadro is free software; you can redistribute it and/or modify
00010   it under the terms of the GNU General Public License as published by
00011   the Free Software Foundation; either version 2 of the License, or
00012   (at your option) any later version.
00013 
00014   Avogadro is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017   GNU General Public License for more details.
00018 
00019   You should have received a copy of the GNU General Public License
00020   along with this program; if not, write to the Free Software
00021   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00022   02110-1301, USA.
00023  **********************************************************************/
00024 
00025 #ifndef IDLIST_H
00026 #define IDLIST_H
00027 
00028 #include <avogadro/global.h>
00029 #include <avogadro/primitive.h>
00030 #include <avogadro/primitivelist.h>
00031 
00032 #include <QVector>
00033 #include <QList>
00034 
00035 namespace Avogadro
00036 {
00037 
00047   class IDListPrivate;
00048   class A_EXPORT IDList
00049   {
00050     public:
00054       IDList();
00055       IDList( const IDList &other );
00056       IDList( const QList<Primitive *> &other );
00057       IDList( const PrimitiveList &other );
00058 
00059       IDList &operator=( const IDList &other );
00060       IDList &operator=(const QList<Primitive *> &other);
00061       IDList &operator=(const PrimitiveList &other);
00062 
00066       ~IDList();
00067 
00074       QList<unsigned long> subList( Primitive::Type type ) const;
00075 
00080       bool contains( const Primitive *p ) const;
00081 
00087       void append( Primitive *p );
00088 
00095       void removeAll( Primitive *p );
00096 
00100       int size() const;
00101 
00105       bool isEmpty() const;
00106 
00111       int count( Primitive::Type type ) const;
00112 
00117       int count() const;
00118 
00122       void clear();
00123 
00124     private:
00125       IDListPrivate * const d;
00126   };
00127 
00128 } // namespace Avogadro
00129 
00130 #endif // __IDLIST_H