00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "nel/ai/script/compilateur.h"
00025 #include "nel/ai/script/constraint.h"
00026
00027 namespace NLAISCRIPT
00028 {
00029 CConstraintChkMethodeType::CConstraintChkMethodeType(IConstraint *constraint,int lin,int col):
00030 _Constraint(constraint),_Satisfied(false),_Lin(lin),_Col(col)
00031 {
00032 _Ident = NULL;
00033 ((CConstraintMethode *)constraint)->addConstraint(this);
00034 std::string text;
00035 text = NLAIC::stringGetBuild("constraint<CConstraintChkMethodeType> for %s",((IConstraint *)_Constraint)->getInfo());
00036 _TxtInfo = new char [strlen(text.c_str()) + 1];
00037 strcpy(_TxtInfo,text.c_str());
00038 _RunIsDone = false;
00039 }
00040
00041 const IConstraint *CConstraintChkMethodeType::clone() const
00042 {
00043 IConstraint *x = new CConstraintChkMethodeType(_Constraint,_Lin,_Col);
00044 return x;
00045 }
00046
00047 void CConstraintChkMethodeType::run(CCompilateur &c)
00048 {
00049 if(_Ident == NULL)
00050 {
00051 _Constraint->run(c);
00052 _Ident = (NLAIC::CIdentType *)((CConstraintMethode *)_Constraint)->getConstraintTypeOf();
00053 }
00054 runConnexcion();
00055 }
00056
00057 void CConstraintChkMethodeType::run(IConstraint *c)
00058 {
00059 if(c == _Constraint)
00060 {
00061
00062 _RunIsDone = true;
00063 _Ident = (NLAIC::CIdentType *)((CConstraintMethode *)c)->getConstraintTypeOf();
00064 }
00065 }
00066
00067 bool CConstraintChkMethodeType::operator == (const IConstraint &c) const
00068 {
00069 if(getTypeOfClass() == c.getTypeOfClass() && *((const CConstraintChkMethodeType &)c)._Constraint == *_Constraint)
00070 {
00071 return true;
00072 }
00073 return false;
00074 }
00075
00076 void CConstraintChkMethodeType::addIndex(int i,CCodeBrancheRun *c)
00077 {
00078 }
00079
00080 void CConstraintChkMethodeType::getError(char *txt) const
00081 {
00082 strcpy(txt,_TxtInfo);
00083 }
00084
00085 CConstraintChkMethodeType::~CConstraintChkMethodeType()
00086 {
00087 if(!_RunIsDone) ((CConstraintMethode *)_Constraint)->popConstraint(this);
00088 _Constraint->release();
00089 delete _TxtInfo;
00090 }
00091 }