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

EmptyValue.cpp

Go to the documentation of this file.
00001 
00002 // EmptyValue.cpp: implementation of the CEmptyValue class.
00003 /*
00004  * Copyright (c) 1996-2000 Erwin Coumans <[email protected]>

00005  *
00006  * Permission to use, copy, modify, distribute and sell this software

00007  * and its documentation for any purpose is hereby granted without fee,

00008  * provided that the above copyright notice appear in all copies and

00009  * that both that copyright notice and this permission notice appear

00010  * in supporting documentation.  Erwin Coumans makes no

00011  * representations about the suitability of this software for any

00012  * purpose.  It is provided "as is" without express or implied warranty.

00013  *
00014  */
00015 
00016 
00017 
00018 
00019 #include "EmptyValue.h"
00020 #include "IntValue.h"
00021 #include "FloatValue.h"
00022 #include "StringValue.h"
00023 #include "ErrorValue.h"
00024 #include "ListValue.h"
00025 #include "VoidValue.h"
00026 
00027 
00029 // Construction/Destruction
00031 
00032 CEmptyValue::CEmptyValue()
00033 /*
00034 pre:

00035 effect: constructs a new CEmptyValue

00036 */
00037 {
00038         SetModified(false);
00039 }
00040 
00041 CEmptyValue::~CEmptyValue()
00042 /*
00043 pre:

00044 effect: deletes the object

00045 */
00046 {
00047 
00048 }
00049 
00050 CValue * CEmptyValue::Calc(VALUE_OPERATOR op, CValue * val)
00051 /*
00052 pre:

00053 ret: a new object containing the result of applying operator op to this

00054 object and val

00055 */
00056 {
00057         return val->CalcFinal(VALUE_EMPTY_TYPE, op, this);
00058         
00059 }
00060 
00061 CValue * CEmptyValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue * val)
00062 /*
00063 pre: the type of val is dtype

00064 ret: a new object containing the result of applying operator op to val and

00065 this object

00066 */
00067 {
00068         return val->AddRef();
00069 }
00070 
00071 
00072 float CEmptyValue::GetNumber()

00073 {
00074         return 0;
00075 }
00076 
00077 CListValue* CEmptyValue::GetPolySoup()

00078 {
00079         CListValue* soup = new CListValue();
00080         //don't add any poly, while it's an empty value
00081         return soup;
00082 }
00083 
00084 bool CEmptyValue::IsInside(CValue* testpoint,bool bBorderInclude) {
00085         
00086         // empty space is solid, so always inside
00087         return true;
00088 }
00089 
00090 
00091 /*
00092 bool CEmptyValue::Query(int InfoTYPE, CValue** result, CValue* datain) {

00093         switch (InfoTYPE) {

00094                 

00095         case CValue::IS_INSIDE_EXCL_BORDER:

00096                 // we getluck, it is the same as IS_INSIDE for emptyvalues

00097         case CValue::IS_INSIDE: {

00098                 return true;

00099                 break;

00100                                                         }

00101         case CValue::GET_POLYSOUP: {

00102                 CListValue* tmpval = GetPolySoup();

00103                 *result = tmpval;

00104                 return true;

00105                 

00106                                                            }

00107         default: {

00108                 

00109                          }

00110         }

00111         

00112         return CValue::Query(InfoTYPE,result,datain);

00113         

00114 }

00115 
00116  

00117 */
00118 
00119 static CCString emptyString = CCString("");
00120 const CCString & CEmptyValue::GetText()

00121 {
00122         return emptyString;
00123 }
00124 
00125 CValue* CEmptyValue::GetReplica() { 
00126         CEmptyValue* replica = new CEmptyValue(*this);
00127         CValue::AddDataToReplica(replica);
00128         return replica;
00129 };
00130 

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