public static int AsInteger(IAstNodePropertyValue propertyValue) { return ((IIntegerAstNodePropertyValue)propertyValue).Value; }
private void WritePropertyValue(IAstNodePropertyValue value) { if(value is IListAstNodePropertyValue) { textWriter.Write("["); IListAstNodePropertyValue list = (IListAstNodePropertyValue)value; for(int i = 0; i < list.Items.Length; ++i) { if(i != 0) textWriter.Write(", "); WritePropertyValue(list.Items[i]); } // for textWriter.Write("]"); return; } // if if((value is ISymbolAstNodePropertyValue) || (value is IStringAstNodePropertyValue && IsSymbol(((IStringAstNodePropertyValue)value).Value))) { string symbol = ((IStringAstNodePropertyValue)value).Value; textWriter.Write(symbol); return; } // if if(value is IStringAstNodePropertyValue) { string stringValue = ((IStringAstNodePropertyValue)value).Value; textWriter.Write("\"{0}\"", stringValue); return; } // if if(value is IIntegerAstNodePropertyValue) { textWriter.Write(((IIntegerAstNodePropertyValue)value).Value); return; } // if }
private IndexColumnDefinition GetIndexColumnDefinition(IAstNodePropertyValue value) { if(value is IStringAstNodePropertyValue) return new IndexColumnDefinition(((IStringAstNodePropertyValue)value).Value); if(value is IListAstNodePropertyValue) { IListAstNodePropertyValue list = (IListAstNodePropertyValue)value; return new IndexColumnDefinition(((IStringAstNodePropertyValue)list.Items[0]).Value, GetSortDirection(((IStringAstNodePropertyValue)list.Items[1]).Value)); } // throw new ArgumentOutOfRangeException("value"); }
public static string AsString(IAstNodePropertyValue propertyValue) { return ((IStringAstNodePropertyValue)propertyValue).Value; }
private static void AddProperty(IAstNode node, string name, IAstNodePropertyValue value) { node.Properties.AddProperty(new AstNodeProperty(name, value)); }
public static IAstNodeProperty List(string name, IAstNodePropertyValue[] values, Location location) { return new AstNodeProperty(name, new ListAstNodePropertyValue(values)); }
public static IAstNodeProperty List(string name, IAstNodePropertyValue[] values) { return List(name, values, null); }
/// <summary> /// Initializes a new instance of the <see cref="AstNodeProperty"/> class. /// </summary> /// <param name="name"></param> /// <param name="value"></param> /// <param name="location"></param> public AstNodeProperty(string name, IAstNodePropertyValue value, Location location) { this.name = name; this.value = value; this.location = location; }
/// <summary> /// Initializes a new instance of the <see cref="AstNodeProperty"/> class. /// </summary> /// <param name="name"></param> /// <param name="value"></param> public AstNodeProperty(string name, IAstNodePropertyValue value) { this.name = name; this.value = value; }