CrystalSpace

Public API Reference

imap/services.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2001 by Norman Kraemer
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_IMAP_SYNTAXSERVICE_H__
00020 #define __CS_IMAP_SYNTAXSERVICE_H__
00021 
00028 #include "csutil/scf.h"
00029 
00030 #include "ivideo/graph3d.h"
00031 
00032 class csBox3;
00033 class csColor;
00034 class csColor4;
00035 class csGradient;
00036 class csMatrix3;
00037 class csPlane3;
00038 class csShaderVariable;
00039 class csVector2;
00040 class csVector3;
00041 
00042 struct csAlphaMode;
00043 
00044 struct iDocumentNode;
00045 struct iKeyValuePair;
00046 struct iLoaderContext;
00047 struct iMaterialWrapper;
00048 struct iRenderBuffer;
00049 struct iSector;
00050 struct iShader;
00051 struct iShaderVariableAccessor;
00052 struct iString;
00053 struct iStringSet;
00054 struct iThingFactoryState;
00055 
00058 
00059 #define CSTEX_UV 1  
00060 
00061 #define CSTEX_V1 2  
00062 
00063 #define CSTEX_V2 4  
00064 
00065 #define CSTEX_UV_SHIFT 8 
00066 
00068 SCF_VERSION (iSyntaxService, 1, 7, 1);
00069 
00074 struct iSyntaxService : public iBase
00075 {
00090   virtual bool ParseBool (iDocumentNode* node, bool& result,
00091         bool def_result) = 0;
00092  
00115   virtual bool ParseBoolAttribute (iDocumentNode* node, const char* attrname,
00116         bool& result, bool def_result, bool required) = 0;
00117 
00121   virtual bool WriteBool (iDocumentNode* node, const char* name, 
00122     bool value) = 0;
00123   
00128   bool WriteBool (iDocumentNode* node, const char* name, bool value, 
00129     bool default_value) 
00130   { 
00131     if (value != default_value) 
00132       return WriteBool (node, name, value); 
00133     else
00134       return true;
00135   }
00136 
00140   virtual bool ParsePlane (iDocumentNode* node, csPlane3 &p) = 0;
00141 
00145   virtual bool WritePlane (iDocumentNode* node, csPlane3 &p) = 0;
00146   
00150   virtual bool ParseMatrix (iDocumentNode* node, csMatrix3 &m) = 0;
00151 
00155   virtual bool WriteMatrix (iDocumentNode* node, csMatrix3* m) = 0;
00156 
00160   virtual bool ParseVector (iDocumentNode* node, csVector3 &v) = 0;
00161 
00165   virtual bool WriteVector (iDocumentNode* node, csVector3* v) = 0;
00166 
00170   virtual bool ParseVector (iDocumentNode* node, csVector2 &v) = 0;
00171 
00175   virtual bool WriteVector (iDocumentNode* node, csVector2* v) = 0;
00176 
00180   virtual bool ParseBox (iDocumentNode* node, csBox3 &v) = 0;
00181 
00185   virtual bool WriteBox (iDocumentNode* node, csBox3* v) = 0;
00186 
00190   virtual bool ParseColor (iDocumentNode* node, csColor &c) = 0;
00191 
00195   virtual bool WriteColor (iDocumentNode* node, csColor* c) = 0;
00196 
00200   virtual bool ParseColor (iDocumentNode* node, csColor4 &c) = 0;
00201 
00205   virtual bool WriteColor (iDocumentNode* node, csColor4* c) = 0;
00206 
00210   virtual bool ParseMixmode (iDocumentNode* node, uint &mixmode,
00211     bool allowFxMesh = false) = 0;
00212 
00216   virtual bool WriteMixmode (iDocumentNode* node, uint mixmode,
00217     bool allowFxMesh) = 0;
00218 
00225   virtual bool HandlePortalParameter (
00226         iDocumentNode* child, iLoaderContext* ldr_context,
00227         uint32 &flags, bool &mirror, bool &warp, int& msv,
00228         csMatrix3 &m, csVector3 &before, csVector3 &after,
00229         iString* destSector, bool& handled, bool& autoresolve) = 0;
00230 
00234   virtual bool ParseGradient (iDocumentNode* node,
00235                               csGradient& gradient) = 0;
00236 
00240   virtual bool WriteGradient (iDocumentNode* node,
00241                               csGradient* gradient) = 0;
00242 
00246   virtual bool ParseShaderVar (iDocumentNode* node, 
00247     csShaderVariable& var) = 0;
00252   virtual csRef<iShaderVariableAccessor> ParseShaderVarExpr (
00253     iDocumentNode* node) = 0;
00254                             
00258   virtual bool WriteShaderVar (iDocumentNode* node, 
00259     csShaderVariable* var) = 0;
00260                             
00265   virtual void ReportError (const char* msgid, iDocumentNode* errornode,
00266         const char* msg, ...) CS_GNUC_PRINTF(4,5) = 0;
00267 
00272   virtual void ReportBadToken (iDocumentNode* badtokennode) = 0;
00273 
00278   virtual void Report (const char* msgid, int severity, 
00279     iDocumentNode* errornode, const char* msg, ...) CS_GNUC_PRINTF(5,6) = 0;
00280   
00284   virtual bool ParseAlphaMode (iDocumentNode* node, iStringSet* strings,
00285     csAlphaMode& alphaMode, bool allowAutoMode = true) = 0;
00286     
00290   virtual bool WriteAlphaMode (iDocumentNode* node, iStringSet* strings,
00291     csAlphaMode* alphaMode) = 0;
00292     
00302   virtual bool ParseZMode (iDocumentNode* node, csZBufMode& zmode,
00303     bool allowZmesh = false) = 0;
00304 
00308   virtual bool WriteZMode (iDocumentNode* node, csZBufMode* zmode,
00309     bool allowZmesh) = 0;
00310 
00316   virtual bool ParseKey (iDocumentNode* node, iKeyValuePair* &keyvalue) = 0;
00317 
00322   virtual bool WriteKey (iDocumentNode* node, iKeyValuePair* keyvalue) = 0;
00323 
00327   virtual csRef<iRenderBuffer> ParseRenderBuffer (iDocumentNode* node) = 0;
00328   
00339   virtual csRef<iShader> ParseShaderRef (iDocumentNode* node) = 0;
00340 };
00341 
00344 #endif // __CS_IMAP_SYNTAXSERVICE_H__
00345 

Generated for Crystal Space by doxygen 1.4.6