Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

EXP_C-Api.cpp

Go to the documentation of this file.
00001 #include "EXP_C-Api.h"
00002 #include "IntValue.h"
00003 #include "BoolValue.h"
00004 #include "StringValue.h"
00005 #include "ErrorValue.h"
00006 #include "InputParser.h"
00007 
00008 EXP_ValueHandle         EXP_CreateInt(int innie)

00009 {
00010         return (EXP_ValueHandle) new CIntValue(innie);
00011 }
00012 
00013 EXP_ValueHandle         EXP_CreateBool(int innie)

00014 {
00015         return (EXP_ValueHandle) new CBoolValue(innie!=0);
00016 }
00017 
00018 EXP_ValueHandle         EXP_CreateString(const char* str)

00019 {
00020         
00021         return (EXP_ValueHandle) new CStringValue(str,"");
00022 }
00023 
00024 void                                    EXP_SetName(EXP_ValueHandle inval,const char* newname)

00025 {
00026         ((CValue*) inval)->SetName(newname);
00027 }
00028 
00029 /* calculate expression from inputtext */
00030 EXP_ValueHandle         EXP_ParseInput(const char* inputtext)

00031 {
00032         CValue* resultval=NULL;
00033         CParser parser;
00034         CExpression* expr = parser.ProcessText(inputtext);
00035         if (expr)
00036         {
00037                 resultval = expr->Calculate();
00038                 expr->Release();
00039         } else
00040         {
00041                 resultval = new CErrorValue("couldn't parsetext");
00042         }
00043 
00044         return (EXP_ValueHandle) resultval;
00045 }
00046 
00047 void                                    EXP_ReleaseValue(EXP_ValueHandle inval)

00048 {
00049         ((CValue*) inval)->Release();
00050 }
00051 
00052 int                                     EXP_IsValid(EXP_ValueHandle inval)

00053 {
00054         return !((CValue*) inval)->IsError();
00055 }
00056 
00057 /* assign property 'propval' to 'destinationval' */
00058 void                                    EXP_SetProperty(EXP_ValueHandle destinationval,const char* propname,EXP_ValueHandle propval)

00059 {
00060         ((CValue*) destinationval)->SetProperty(propname,(CValue*)propval);
00061 }
00062 
00063 const char*                                     EXP_GetText(EXP_ValueHandle inval)

00064 {
00065         return ((CValue*) inval)->GetText();
00066 }
00067 
00068 EXP_ValueHandle                         EXP_GetProperty(EXP_ValueHandle inval,const char* propname)

00069 {
00070         return (EXP_ValueHandle) ((CValue*)inval)->GetProperty(propname);
00071 }

Generated at Thu Feb 1 13:03:02 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000