DocumentProtectorPy.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2009 Werner Mayer <wmayer@users.sourceforge.net>        *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 
00024 #ifndef SANDBOX_DOCUMENTPROTECTORPY_H
00025 #define SANDBOX_DOCUMENTPROTECTORPY_H
00026 
00027 #include <CXX/Extensions.hxx>
00028 
00029 namespace App {
00030 class DocumentPy;
00031 class DocumentObject;
00032 class DocumentObjectPy;
00033 }
00034 
00035 namespace Sandbox {
00036 
00037 class DocumentProtector;
00038 class DocumentProtectorPy : public Py::PythonExtension<DocumentProtectorPy>
00039 {
00040 public:
00041     static void init_type(void);    // announce properties and methods
00042 
00043     DocumentProtectorPy(App::DocumentPy *doc);
00044     ~DocumentProtectorPy();
00045 
00046     Py::Object repr();
00047     Py::Object getattr(const char *);
00048     int setattr(const char *, const Py::Object &);
00049 
00050     Py::Object addObject(const Py::Tuple&);
00051     Py::Object recompute(const Py::Tuple&);
00052 
00053 private:
00054     typedef PyObject* (*method_varargs_handler)(PyObject *_self, PyObject *_args);
00055     static method_varargs_handler pycxx_handler;
00056     static PyObject *method_varargs_ext_handler(PyObject *_self, PyObject *_args);
00057 
00058 private:
00059     DocumentProtector* _dp;
00060     friend class DocumentProtector;
00061 };
00062 
00063 class DocumentObjectProtector;
00064 class DocumentObjectProtectorPy : public Py::PythonExtension<DocumentObjectProtectorPy>
00065 {
00066 public:
00067     static void init_type(void);    // announce properties and methods
00068 
00069     DocumentObjectProtectorPy(App::DocumentObject *obj);
00070     DocumentObjectProtectorPy(App::DocumentObjectPy *obj);
00071     ~DocumentObjectProtectorPy();
00072 
00073     Py::Object repr();
00074     Py::Object getattr(const char *);
00075     int setattr(const char *, const Py::Object &);
00076 
00077 private:
00078     DocumentObjectProtector* _dp;
00079     friend class DocumentObjectProtector;
00080 };
00081 
00082 }
00083 
00084 #endif // SANDBOX_DOCUMENTPROTECTORPY_H
00085 

Generated on Wed Nov 23 19:00:08 2011 for FreeCAD by  doxygen 1.6.1