// Return type name as text public TextValue Type(TypedValue arg) { return(TextValue.Create(arg.DataType.ToString())); }
///================================================================= /// /// Add-in functions /// // basic string public TextValue Text(TypedValue value) { return(TextValue.Create(value.ToString())); }
// fancier string public TextValue Format(TypedValue value) { return(TextValue.Create(value.Format())); }
// Import a linked or externally held relvar public VoidValue Import(TextValue sourcearg, TextValue namearg, TextValue whatarg, TextValue locatorarg) { if (sourcearg.Value == Catalog.DefaultDatabaseSource) { if (!_catvars.Catalog.LinkRelvar(namearg.Value)) { throw ProgramError.Fatal("Connect", "cannot link to '{0}'", namearg.Value); } } else if (!_catvars.Catalog.ImportRelvar(sourcearg.Value, namearg.Value, whatarg.Value, locatorarg.Value)) { throw ProgramError.Fatal("Connect", "cannot import from '{0}'", namearg.Value); } return(VoidValue.Default); }
// Match using regex public BoolValue Match(TextValue arg1, TextValue arg2) { Regex re = new Regex(arg2.Value); return(BoolValue.Create(re.IsMatch(arg1.Value))); }
// trigger an error public VoidValue Fail(TextValue source, TextValue message) { throw ProgramError.Fatal(source.Value, message.Value); }
public UserValue UserSelector(TextValue typename, TypedValue[] valargs) { var usertype = DataTypeUser.Find(typename.Value); return(usertype.CreateValue(valargs)); }
public NumberValue Length(TextValue arg1) { return(NumberValue.Create(arg1.Value.Length)); }
///================================================================= /// Sequential IO /// // Write a text value to the console/output public VoidValue Write(TextValue line) { _output.WriteLine(line.Value); return(VoidValue.Default); }
// The part of arg1 after arg2, or nothing if not found public TextValue After(TextValue arg1, TextValue arg2) { int pos = arg1.Value.IndexOf(arg2.Value); return(pos == -1 ? TextValue.Default : TextValue.Create(arg1.Value.Substring(pos + arg2.Value.Length))); }
public TextValue ToLower(TextValue arg1) { return(TextValue.Create(arg1.Value.ToLower())); }
// The part of arg1 before arg2, or arg1 if not found public TextValue Before(TextValue arg1, TextValue arg2) { int pos = arg1.Value.IndexOf(arg2.Value); return(pos == -1 ? arg1 : TextValue.Create(arg1.Value.Substring(0, pos))); }
// remove leading and trailing white space public TextValue Trim(TextValue arg1) { return(TextValue.Create(arg1.Value.Trim())); }
///================================================================= /// /// Text string operations /// // Concatenate. Converts arguments to string. public TextValue Concat(TypedValue arg1, TypedValue arg2) { return(TextValue.Create(arg1.ToString() + arg2.ToString())); }
public void SetText(int colno, string value) { _valueholder._values[colno] = TextValue.Create(value); }
static TextValue() { Default = new TextValue { Value = "" }; }