1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System;
- namespace NTERA.EmuEra.Game.EraEmu.GameData.Expression
- {
- internal abstract class IOperandTerm
- {
- public IOperandTerm(Type t)
- {
- type = t;
- }
- public Type GetOperandType()
- {
- return type;
- }
- public virtual Int64 GetIntValue(ExpressionMediator exm)
- {
- return 0;
- }
- public virtual string GetStrValue(ExpressionMediator exm, bool translate=false)
- {
- return "";
- }
- public virtual SingleTerm GetValue(ExpressionMediator exm, bool tryTranslate =false)
- {
- if (type == typeof(Int64))
- return new SingleTerm(0);
- return new SingleTerm("");
- }
- public bool IsInteger => type == typeof(Int64);
- public bool IsString => type == typeof(string);
- readonly Type type;
-
- /// <summary>
- /// 定数を解体して可能ならSingleTerm化する
- /// defineの都合上、2回以上呼ばれる可能性がある
- /// </summary>
- public virtual IOperandTerm Restructure(ExpressionMediator exm, bool tryTranslate=false)
- {
- return this;
- }
- }
- }
|