public override int Compare(ktString op, ktValue val) { int ret = 0; bool bVal = val.ToBool(); switch (op) { case "<>": case "!=": case "op<>": case "op!=": case "operator<>": case "operator!=": case "ne": case "isnotequal": case "notequal": { ret = (m_value != bVal) ? 1 : 0; break; } case "==": case "op==": case "operator==": case "isequal": case "equal": case "eq": { ret = (m_value == bVal) ? 1 : 0; break; } default: { throw new ktError("Couldn't find the method '" + op + "' in class '" + m_Name + "'.", ktERR._404); } } return ret; }
/// <summary> /// Sets a property of this class, matching 'Name', with the value provided (by 'Value') /// </summary> public override ktValue SetProperty(ktString Name, ktValue Value) { if ((Name == "this") || (Name == "_this") || (Name == "object") || (Name == "_object") || (Name == "_") || (Name.IsEmpty())) { /*try { m_Value = Convert.ToInt32( Value.ToString() ); } catch (Exception E) { if (E.GetType() == typeof( System.FormatException )) { throw new ktError( "kactalkClass::CreateObject: Cant make '" + Value + "' into an integer", ktERR.WRONGTYPE ); } }*/ } else if (Name == "MathMode") { // m_Value.MathMode = (((ktClass)Value.Value).ToString().ToLower() == "true"); m_Value.MathMode = Value.ToBool(); } else { throw new ktError("Couldn't find the property '" + Name + "' in class '" + m_Name + "'.", ktERR._404); } return GetProperty("_"); }
private bool CheckLogicStatement(ktList List, ktToken Token, ref ktValue r) { bool ret = false; //ktToken token = new ktToken(ktTokenType.Statement, "logic", 0, 0); Token.Type = ktTokenType.Statement; // ktDebug.Log("CheckLogicST: " + List.Get_R(" ")); r = TokenToValue( Token, List ); ret = r.ToBool(); // ktDebug.Log("CheckLogicST: R:" + ret.ToString()); return ret; }
public override ktClass CreateObject(ktValue Value) { return new ktBool(Value.ToBool()); }