Blender V2.61 - r43446

PyTypeList.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of blendTex library
00004 
00005 Copyright (c) 2007 The Zdeno Ash Miklas
00006 
00007 This program is free software; you can redistribute it and/or modify it under
00008 the terms of the GNU Lesser General Public License as published by the Free Software
00009 Foundation; either version 2 of the License, or (at your option) any later
00010 version.
00011 
00012 This program is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00015 
00016 You should have received a copy of the GNU Lesser General Public License along with
00017 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00018 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00019 http://www.gnu.org/copyleft/lesser.txt.
00020 -----------------------------------------------------------------------------
00021 */
00022 
00027 #if !defined PYTYPELIST_H
00028 #define PYTYPELIST_H
00029 
00030 #include "Common.h"
00031 
00032 #include <memory>
00033 #include <vector>
00034 
00035 #include <PyObjectPlus.h>
00036 
00037 // forward declaration
00038 class PyTypeListItem;
00039 
00040 // type for list of types
00041 typedef std::vector<PyTypeListItem*> PyTypeListType;
00042 
00043 
00045 class PyTypeList
00046 {
00047 public:
00049     ~PyTypeList();
00050 
00052     bool in (PyTypeObject * type);
00053 
00055     void add (PyTypeObject * type, const char * name);
00056 
00058     bool ready (void);
00059 
00061     void reg (PyObject * module);
00062 
00063 protected:
00065     std::auto_ptr<PyTypeListType> m_list;
00066 };
00067 
00068 
00070 class PyTypeListItem
00071 {
00072 public:
00074     PyTypeListItem (PyTypeObject * type, const char * name)
00075         : m_type(type), m_name(name)
00076     { }
00077 
00079     PyTypeObject * getType (void) { return m_type; }
00080 
00082     const char * getName (void) { return m_name; }
00083 
00084 protected:
00086     PyTypeObject * m_type;
00088     const char * m_name;
00089 };
00090 
00091 
00092 #endif