1 module hunt.sql.ast.expr.SQLTextLiteralExpr; 2 3 import hunt.sql.ast.expr.SQLTextLiteralExpr; 4 import hunt.sql.ast.expr.SQLLiteralExpr; 5 import hunt.sql.ast.SQLExprImpl; 6 import hunt.collection; 7 import hunt.sql.ast.SQLObject; 8 import hunt.String; 9 10 public abstract class SQLTextLiteralExpr : SQLExprImpl , SQLLiteralExpr { 11 12 protected String text; 13 14 public this(){ 15 16 } 17 18 public this(String text){ 19 20 this.text = text; 21 } 22 23 public String getText() { 24 return this.text; 25 } 26 27 public void setText(String text) { 28 this.text = text; 29 } 30 31 public override size_t toHash() @trusted nothrow { 32 int prime = 31; 33 size_t result = 1; 34 result = prime * result + hashOf(text); 35 return result; 36 } 37 38 public override bool opEquals(Object obj) { 39 if (this is obj) { 40 return true; 41 } 42 if (obj is null) { 43 return false; 44 } 45 if (typeid(SQLTextLiteralExpr) != typeid(obj)) { 46 return false; 47 } 48 SQLTextLiteralExpr other = cast(SQLTextLiteralExpr) obj; 49 if (text is null) { 50 if (other.text !is null) { 51 return false; 52 } 53 } else if (!(text == other.text)) { 54 return false; 55 } 56 return true; 57 } 58 59 override public abstract SQLTextLiteralExpr clone(); 60 61 public override List!SQLObject getChildren() { 62 return Collections.emptyList!(SQLObject)(); 63 } 64 }