Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

QGLViewerXML.h

Go to the documentation of this file.
00001 /* 00002 * QGLViewerXML.h 00003 * $Id: QGLViewerXML.h,v 1.8 2003/06/24 14:50:02 anxo Exp $ 00004 * 00005 * Copyright (C) 1999, 2000, 2001 Michael Meissner, Alexander Buck 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * As a special exception to the GPL, the QGLViewer authors (Markus 00022 * Janich, Michael Meissner, Richard Guenther, Alexander Buck and Thomas 00023 * Woerner) give permission to link this program with Qt (non-)commercial 00024 * edition, and distribute the resulting executable, without including 00025 * the source code for the Qt (non-)commercial edition in the source 00026 * distribution. 00027 * 00028 */ 00029 00030 // Description : Class QGLViewerXML 00031 // Purpose : Provides funcionality 00032 00033 00034 #ifndef __QGLVIEWERXML_H 00035 #define __QGLVIEWERXML_H 00036 00037 00038 // System 00040 #include <math.h> 00041 #ifdef _MSC_VER 00042 #if _MSC_VER >= 1300 00043 #include <iostream> 00044 #endif 00045 #else 00046 #include <iostream.h> 00047 #endif 00048 00049 00050 // Own 00052 #include "CP2D.h" 00053 #include "CV2D.h" 00054 #include "CBoundingBox3D.h" 00055 #include "CCamera.h" 00056 #include "CList.h" 00057 #include "CCameraKeyPathPoint.h" 00058 #include "CCameraKeyPathAttributes.h" 00059 00060 // Qt 00062 #include <qdom.h> 00063 00064 00065 // forward declarations 00067 00068 00069 00075 namespace QGLViewerXML { 00076 00080 QDomElement addNode(QDomElement& parent, 00081 const QString& member = QString::null); 00082 00085 QDomElement queryNode(const QDomElement& parent, 00086 const QString& member); 00087 00090 bool readXML(const QDomElement&, CP2D&); 00091 00094 bool writeXML(QDomElement, const CP2D&); 00095 00098 bool readXML(const QDomElement&, CP3D&); 00099 00102 bool writeXML(QDomElement, const CP3D&); 00103 00106 bool readXML(const QDomElement&, CP4D&); 00107 00110 bool writeXML(QDomElement, const CP4D&); 00111 00112 00115 bool readXML(const QDomElement&, CV2D&); 00116 00119 bool writeXML(QDomElement, const CV2D&); 00120 00123 bool readXML(const QDomElement&, CV3D&); 00124 00127 bool writeXML(QDomElement, const CV3D&); 00128 00131 bool readXML(const QDomElement&, CV4D&); 00132 00135 bool writeXML(QDomElement, const CV4D&); 00136 00137 00140 bool readXML(const QDomElement&, CQuat&); 00141 00144 bool writeXML(QDomElement, const CQuat&); 00145 00146 00149 bool readXML(const QDomElement&, CBoundingBox3D&); 00150 00153 bool writeXML(QDomElement, const CBoundingBox3D&); 00154 00155 00158 bool readXML(const QDomElement&, CMat4D&); 00159 00162 bool writeXML(QDomElement, const CMat4D&); 00163 00164 00167 bool readXML(const QDomElement&, CCamera&); 00168 00171 bool writeXML(QDomElement, const CCamera&); 00172 00174 bool readXML(const QDomElement&, CCameraKeyPathPoint&); 00175 00179 bool writeXML(QDomElement, const CCameraKeyPathPoint&,bool fParams=true); 00180 00185 bool readXML(const QDomElement&, CCameraKeyPathAttributes&); 00186 00190 bool writeXML(QDomElement, const CCameraKeyPathAttributes&); 00191 00195 template <class T> 00196 bool readXML(const QDomElement& domElem, CList<T>& list, QString tagName="CList") { 00197 if (domElem.nodeName().compare(tagName) != 0) 00198 return false; 00199 00200 int l=0; 00201 QDomNode node = domElem.firstChild(); 00202 while (!node.isNull()) { 00203 if (node.isElement()) { 00204 QDomElement elem = node.toElement(); 00205 T cam; 00206 00207 if (QGLViewerXML::readXML(elem, cam)) { 00208 list.insertAsLast(new T(cam)); 00209 l++; 00210 } 00211 } 00212 node = node.nextSibling(); 00213 } 00214 00215 return l>0; 00216 }; 00217 00218 00219 00223 template <class T> 00224 bool writeXML(QDomElement domElem, const CList<T>& list, QString tagName="CList") { 00225 domElem.setTagName(tagName); 00226 CListContainer<T> *pContainer; 00227 pContainer = list.getFirst(); 00228 while (pContainer) { 00229 if (!writeXML(addNode(domElem), *(pContainer->getObject()))) 00230 return false; 00231 pContainer = pContainer->getNext(); 00232 } 00233 return true; 00234 }; 00235 00236 } 00237 00238 00239 #endif

Generated on Wed Jul 28 02:09:12 2004 for QGLViewer by doxygen 1.3.7