internal QueryFunction(string name, ValueDataType returnType, ValueDataType[] paramTypes, QueryFunctionFlag flags)
 {
     this.name = name;
     this.returnType = returnType;
     this.paramTypes = paramTypes;
     this.flags = flags;
 }
Example #2
0
 public static string Resolve(ValueDataType dataType)
 {
     switch (dataType)
     {
         case ValueDataType.Int:
             return typeof(int).ToString();
         case ValueDataType.Decimal:
             return typeof(decimal).ToString();
         case ValueDataType.ByteArray:
             return typeof(byte[]).ToString();
         case ValueDataType.DateTime:
             return typeof(DateTime).ToString();
         case ValueDataType.Bool:
             return typeof(bool).ToString();
         case ValueDataType.Image:
             return typeof(Image).ToString();
         case ValueDataType.Json:
             return "Json";
         case ValueDataType.Xml:
             return "Xml";
         case ValueDataType.String:
             return typeof(string).ToString();
         default:
             return "Custom";
     }
 }
 internal XPathConjunctExpr(XPathExprType type, ValueDataType returnType, XPathExpr left, XPathExpr right) : base(type, returnType)
 {
     if ((left == null) || (right == null))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QueryCompileException(QueryCompileError.InvalidExpression));
     }
     base.SubExpr.Add(left);
     base.SubExpr.Add(right);
 }
 internal static ValueDataType[] MakeTypes(int size)
 {
     ValueDataType[] typeArray = new ValueDataType[size];
     for (int i = 0; i < size; i++)
     {
         typeArray[i] = ValueDataType.String;
     }
     return typeArray;
 }
Example #5
0
        private void SetEditor(ValueDataType dataType)
        {
            switch (dataType)
            { 
                case ValueDataType.Int:
                    Editor = new SettingsIntEditor();
                    break;

                case ValueDataType.String:
                    Editor = new SettingsStringEditor();
                    break;

                case ValueDataType.Decimal:
                    Editor = new SettingsDecimalEditor();
                    break;

                case ValueDataType.ByteArray:
                    Editor = new SettingsBinaryEditor();
                    break;

                case ValueDataType.DateTime:
                    Editor = new SettingsDateTimeEditor();
                    break;

                case ValueDataType.Bool:
                    Editor = new SettingsBooleanEditor();
                    break;

                case ValueDataType.Json:
                    Editor = new SettingsJsonEditor();
                    break;

                case ValueDataType.Xml:
                    Editor = new SettingsXmlEditor();
                    break;

                case ValueDataType.Image:
                    Editor = new SettingsImageEditor();
                    break;

                default:
                    Editor = new SettingsCustomEditor();
                    break;
            }

            panelEditor.Controls.Clear();
            comboBox1.SelectedItem = Editor.ValueType.ToString();
            ((Control)Editor).Dock = DockStyle.Fill;
            panelEditor.Controls.Add((Control)Editor);
        }
 static XPathFunctionLibrary()
 {
     XPathFunction[] functionArray = new XPathFunction[0x24];
     ValueDataType[] argTypes = new ValueDataType[1];
     functionArray[0] = new XPathFunction(XPathFunctionID.Boolean, "boolean", ValueDataType.Boolean, argTypes);
     functionArray[1] = new XPathFunction(XPathFunctionID.False, "false", ValueDataType.Boolean);
     functionArray[2] = new XPathFunction(XPathFunctionID.True, "true", ValueDataType.Boolean);
     functionArray[3] = new XPathFunction(XPathFunctionID.Not, "not", ValueDataType.Boolean, new ValueDataType[] { ValueDataType.Boolean });
     functionArray[4] = new XPathFunction(XPathFunctionID.Lang, "lang", ValueDataType.Boolean, new ValueDataType[] { ValueDataType.String });
     ValueDataType[] typeArray4 = new ValueDataType[1];
     functionArray[5] = new XPathFunction(XPathFunctionID.Number, "number", ValueDataType.Double, typeArray4);
     functionArray[6] = new XPathFunction(XPathFunctionID.NumberDefault, "number", ValueDataType.Double);
     functionArray[7] = new XPathFunction(XPathFunctionID.Sum, "sum", ValueDataType.Double, new ValueDataType[] { ValueDataType.Sequence });
     functionArray[8] = new XPathFunction(XPathFunctionID.Floor, "floor", ValueDataType.Double, new ValueDataType[] { ValueDataType.Double });
     functionArray[9] = new XPathFunction(XPathFunctionID.Ceiling, "ceiling", ValueDataType.Double, new ValueDataType[] { ValueDataType.Double });
     functionArray[10] = new XPathFunction(XPathFunctionID.Round, "round", ValueDataType.Double, new ValueDataType[] { ValueDataType.Double });
     ValueDataType[] typeArray9 = new ValueDataType[1];
     functionArray[11] = new XPathFunction(XPathFunctionID.String, "string", ValueDataType.String, typeArray9);
     functionArray[12] = new XPathFunction(XPathFunctionID.StringDefault, "string", ValueDataType.String, QueryFunctionFlag.UsesContextNode);
     functionArray[13] = new XPathFunction(XPathFunctionID.ConcatTwo, "concat", ValueDataType.String, new ValueDataType[] { ValueDataType.String, ValueDataType.String });
     functionArray[14] = new XPathFunction(XPathFunctionID.ConcatThree, "concat", ValueDataType.String, new ValueDataType[] { ValueDataType.String, ValueDataType.String, ValueDataType.String });
     functionArray[15] = new XPathFunction(XPathFunctionID.ConcatFour, "concat", ValueDataType.String, new ValueDataType[] { ValueDataType.String, ValueDataType.String, ValueDataType.String, ValueDataType.String });
     functionArray[0x10] = new XPathFunction(XPathFunctionID.StartsWith, "starts-with", ValueDataType.Boolean, new ValueDataType[] { ValueDataType.String, ValueDataType.String });
     functionArray[0x11] = new XPathFunction(XPathFunctionID.NormalizeSpace, "normalize-space", ValueDataType.String, new ValueDataType[] { ValueDataType.String });
     functionArray[0x12] = new XPathFunction(XPathFunctionID.NormalizeSpaceDefault, "normalize-space", ValueDataType.String, QueryFunctionFlag.UsesContextNode);
     functionArray[0x13] = new XPathFunction(XPathFunctionID.Contains, "contains", ValueDataType.Boolean, new ValueDataType[] { ValueDataType.String, ValueDataType.String });
     functionArray[20] = new XPathFunction(XPathFunctionID.SubstringBefore, "substring-before", ValueDataType.String, new ValueDataType[] { ValueDataType.String, ValueDataType.String });
     functionArray[0x15] = new XPathFunction(XPathFunctionID.SubstringAfter, "substring-after", ValueDataType.String, new ValueDataType[] { ValueDataType.String, ValueDataType.String });
     functionArray[0x16] = new XPathFunction(XPathFunctionID.Substring, "substring", ValueDataType.String, new ValueDataType[] { ValueDataType.String, ValueDataType.Double });
     functionArray[0x17] = new XPathFunction(XPathFunctionID.SubstringLimit, "substring", ValueDataType.String, new ValueDataType[] { ValueDataType.String, ValueDataType.Double, ValueDataType.Double });
     functionArray[0x18] = new XPathFunction(XPathFunctionID.StringLength, "string-length", ValueDataType.Double, new ValueDataType[] { ValueDataType.String });
     functionArray[0x19] = new XPathFunction(XPathFunctionID.StringLengthDefault, "string-length", ValueDataType.Double, QueryFunctionFlag.UsesContextNode);
     functionArray[0x1a] = new XPathFunction(XPathFunctionID.Translate, "translate", ValueDataType.String, new ValueDataType[] { ValueDataType.String, ValueDataType.String, ValueDataType.String });
     functionArray[0x1b] = new XPathFunction(XPathFunctionID.Last, "last", ValueDataType.Double, QueryFunctionFlag.UsesContextNode);
     functionArray[0x1c] = new XPathFunction(XPathFunctionID.Position, "position", ValueDataType.Double, QueryFunctionFlag.UsesContextNode);
     functionArray[0x1d] = new XPathFunction(XPathFunctionID.Count, "count", ValueDataType.Double, new ValueDataType[] { ValueDataType.Sequence });
     functionArray[30] = new XPathFunction(XPathFunctionID.LocalName, "local-name", ValueDataType.String, new ValueDataType[] { ValueDataType.Sequence });
     functionArray[0x1f] = new XPathFunction(XPathFunctionID.LocalNameDefault, "local-name", ValueDataType.String, QueryFunctionFlag.UsesContextNode);
     functionArray[0x20] = new XPathFunction(XPathFunctionID.Name, "name", ValueDataType.String, new ValueDataType[] { ValueDataType.Sequence });
     functionArray[0x21] = new XPathFunction(XPathFunctionID.NameDefault, "name", ValueDataType.String, QueryFunctionFlag.UsesContextNode);
     functionArray[0x22] = new XPathFunction(XPathFunctionID.NamespaceUri, "namespace-uri", ValueDataType.String, new ValueDataType[] { ValueDataType.Sequence });
     functionArray[0x23] = new XPathFunction(XPathFunctionID.NamespaceUriDefault, "namespace-uri", ValueDataType.String, QueryFunctionFlag.UsesContextNode);
     functionTable = functionArray;
 }
        static void ConvertFirstArg(ProcessingContext context, ValueDataType type)
        {
            StackFrame arg = context.TopArg;
            Value[] values = context.Values;

            while (arg.basePtr <= arg.endPtr)
            {
                values[arg.basePtr++].ConvertTo(context, type);
            }
        }
 internal QueryFunction(string name, ValueDataType returnType) : this(name, returnType, emptyParams, QueryFunctionFlag.None)
 {
 }
 internal XPathLiteralExpr(XPathExprType type, ValueDataType returnType) : base(type, returnType)
 {
 }
Example #10
0
 internal bool IsType(ValueDataType type)
 {
     return (type == this.type);
 }
Example #11
0
 internal void Clear(ProcessingContext context)
 {
     if (ValueDataType.Sequence == this.type)
     {
         this.ReleaseSequence(context);
     }
     this.type = ValueDataType.None;
 }
 void CompileTypecast(ValueDataType destType)
 {
     Fx.Assert(ValueDataType.None != destType, "");
     this.codeBlock.Append(new TypecastOpcode(destType));
 }
        internal static XPathResultType ResultType(ValueDataType dataType)
        {
            switch (dataType)
            {
                default:
                    break;
                    
                case ValueDataType.Boolean:
                    return XPathResultType.Boolean;

                case ValueDataType.Double:
                    return XPathResultType.Number;

                case ValueDataType.Sequence:
                    return XPathResultType.NodeSet;

                case ValueDataType.String:
                    return XPathResultType.String;
            }
            
            return XPathResultType.Any;
        }
 internal XPathExpr(XPathExprType type, ValueDataType returnType)
 {
     this.type = type;
     this.returnType = returnType;
 }
Example #15
0
        internal static XPathResultType ConvertTypeToXslt(ValueDataType type)
        {
            switch (type)
            {
                case ValueDataType.Boolean:
                    return XPathResultType.Boolean;

                case ValueDataType.Double:
                    return XPathResultType.Number;

                case ValueDataType.Sequence:
                    return XPathResultType.NodeSet;

                case ValueDataType.String:
                    return XPathResultType.String;

                default:
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QueryCompileException(QueryCompileError.InvalidTypeConversion));
            }
        }
        internal void ConvertTo(ProcessingContext context, ValueDataType newType)
        {
            if (newType != this.type)
            {
                switch (newType)
                {
                    case ValueDataType.Boolean:
                        this.boolVal = this.ToBoolean();
                        break;

                    case ValueDataType.Double:
                        this.dblVal = this.ToDouble();
                        break;

                    case ValueDataType.String:
                        this.strVal = this.ToString();
                        break;
                }
                if (ValueDataType.Sequence == this.type)
                {
                    this.ReleaseSequence(context);
                }
                this.type = newType;
            }
        }
 private void CompileTypecast(ValueDataType destType)
 {
     this.codeBlock.Append(new TypecastOpcode(destType));
 }
 internal XPathExpr(XPathExprType type, ValueDataType returnType, XPathExprList subExpr) : this(type, returnType)
 {
     this.subExpr = subExpr;
 }
 internal QueryFunction(string name, ValueDataType returnType, QueryFunctionFlag flags)
     : this(name, returnType, QueryFunction.emptyParams, flags)
 {
 }
 internal TypecastOpcode(ValueDataType newType) : base(OpcodeID.Cast)
 {
     this.newType = newType;
 }
 internal QueryFunction(string name, ValueDataType returnType, ValueDataType[] paramTypes)
     : this(name, returnType, paramTypes, QueryFunctionFlag.None)
 {
 }
Example #22
0
 internal void Clear()
 {
     this.type = ValueDataType.None;
     this.sequence = null;
 }
        internal QueryFunction(string name, ValueDataType returnType, ValueDataType[] paramTypes, QueryFunctionFlag flags)
        {
            Fx.Assert(null != paramTypes, "");
            Fx.Assert(null != name, "");

            this.name = name;
            this.returnType = returnType;
            this.paramTypes = paramTypes;
            this.flags = flags;
        }
Example #24
0
        internal void ConvertTo(ProcessingContext context, ValueDataType newType)
        {
            Fx.Assert(null != context, "");

            if (newType == this.type)
            {
                return;
            }

            switch (newType)
            {
                default:
                    break;

                case ValueDataType.Boolean:
                    this.boolVal = this.ToBoolean();
                    break;

                case ValueDataType.Double:
                    this.dblVal = this.ToDouble();
                    break;

                case ValueDataType.String:
                    this.strVal = this.ToString();
                    break;
            }

            if (ValueDataType.Sequence == this.type)
            {
                this.ReleaseSequence(context);
            }
            this.type = newType;
        }
 internal static ValueDataType[] MakeTypes(int size)
 {
     ValueDataType[] t = new ValueDataType[size];
     for (int i = 0; i < size; ++i)
     {
         t[i] = ValueDataType.String;
     }
     return t;
 }
Example #26
0
 internal void StartFrame(int start)
 {
     this.type = ValueDataType.StackFrame;
     this.frame.basePtr = start + 1;
     this.frame.endPtr = start;
 }
 internal XPathFunction(XPathFunctionID functionID, string name, ValueDataType returnType, QueryFunctionFlag flags)
     : base(name, returnType, flags)
 {
     this.functionID = functionID;
 }
        internal PushXsltVariableOpcode(XsltContext context, IXsltContextVariable variable)
            : base(OpcodeID.PushXsltVariable)
        {
            Fx.Assert(null != context && null != variable, "");

            this.xsltContext = context;
            this.variable = variable;
            this.type = XPathXsltFunctionExpr.ConvertTypeFromXslt(variable.VariableType);

            // Make sure the type is supported
            switch (this.type)
            {
                case ValueDataType.Boolean:
                case ValueDataType.Double:
                case ValueDataType.String:
                case ValueDataType.Sequence:
                    break;

                default:
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QueryCompileException(QueryCompileError.InvalidType, SR.GetString(SR.QueryVariableTypeNotSupported, this.variable.VariableType.ToString())));
            }
        }
 internal XPathFunction(XPathFunctionID functionID, string name, ValueDataType returnType, ValueDataType[] argTypes)
     : base(name, returnType, argTypes)
 {
     this.functionID = functionID;
 }