//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // // Microsoft //------------------------------------------------------------------------------ using System; using System.Diagnostics; namespace System.Xml.Xsl.Qil { /// /// View over a Qil atomic value literal (of any type). /// /// /// Don't construct QIL nodes directly; instead, use the QilFactory. /// internal class QilLiteral : QilNode { private object value; //----------------------------------------------- // Constructor //----------------------------------------------- /// /// Construct a new node /// public QilLiteral(QilNodeType nodeType, object value) : base(nodeType) { Value = value; } //----------------------------------------------- // QilLiteral methods //----------------------------------------------- public object Value { get { return this.value; } set { this.value = value; } } public static implicit operator string(QilLiteral literal) { return (string) literal.value; } public static implicit operator int(QilLiteral literal) { return (int) literal.value; } public static implicit operator long(QilLiteral literal) { return (long) literal.value; } public static implicit operator double(QilLiteral literal) { return (double) literal.value; } public static implicit operator decimal(QilLiteral literal) { return (decimal) literal.value; } public static implicit operator XmlQueryType(QilLiteral literal) { return (XmlQueryType) literal.value; } } }