• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# QName类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中QName的典型用法代码示例。如果您正苦于以下问题:C# QName类的具体用法?C# QName怎么用?C# QName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



QName类属于命名空间,在下文中一共展示了QName类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FastConstants

 static FastConstants()
 {
     ANY_TYPE = new QName("any");
     ERROR = FastAlertSeverity.ERROR;
     WARN = FastAlertSeverity.WARN;
     FATAL = FastAlertSeverity.FATAL;
     DYNAMIC = new ErrorType("Dynamic");
     STATIC = new ErrorType("Static");
     REPORTABLE = new ErrorType("Reportable");
     S1_INVALID_XML = new ErrorCode(STATIC, 1, "ERR S1", "Invalid XML", ERROR);
     S2_OPERATOR_TYPE_INCOMP = new ErrorCode(STATIC, 2, "ERR S2", "Incompatible operator and type", ERROR);
     S3_INITIAL_VALUE_INCOMP = new ErrorCode(STATIC, 3, "ERR S3", "Incompatible initial value", ERROR);
     S4_NO_INITIAL_VALUE_FOR_CONST = new ErrorCode(STATIC, 4, "ERR S4", "Fields with constant operators must have a default value defined.", ERROR);
     S5_NO_INITVAL_MNDTRY_DFALT = new ErrorCode(STATIC, 5, "ERR S5", "No initial value for mandatory field with default operator", ERROR);
     D1_FIELD_APP_INCOMP = new ErrorCode(DYNAMIC, 1, "ERR D1", "Field cannot be converted to type of application field", ERROR);
     D2_INT_OUT_OF_RANGE = new ErrorCode(DYNAMIC, 2, "ERR D2", "The integer value is out of range for the specified integer type.", WARN);
     D3_CANT_ENCODE_VALUE = new ErrorCode(DYNAMIC, 3, "ERR D3", "The value cannot be encoded for the given operator.", ERROR);
     D4_INVALID_TYPE = new ErrorCode(DYNAMIC, 4, "ERR D4", "The previous value is not the same type as the type of the current field.", ERROR);
     D5_NO_DEFAULT_VALUE = new ErrorCode(DYNAMIC, 5, "ERR D5", "If no prior value is set and the field is not present, there must be a default value or the optional flag must be set.", ERROR);
     D6_MNDTRY_FIELD_NOT_PRESENT = new ErrorCode(DYNAMIC, 6, "ERR D6", "A mandatory field must have a value", ERROR);
     D7_SUBTRCTN_LEN_LONG = new ErrorCode(DYNAMIC, 7, "ERR D7", "The subtraction length is longer than the base value.", ERROR);
     D8_TEMPLATE_NOT_EXIST = new ErrorCode(DYNAMIC, 8, "ERR D8", "The referenced template does not exist.", ERROR);
     D9_TEMPLATE_NOT_REGISTERED = new ErrorCode(DYNAMIC, 9, "ERR D9", "The template has not been registered.", ERROR);
     R1_LARGE_DECIMAL = new ErrorCode(REPORTABLE, 1, "ERR R1", "Decimal exponent does not fit into range -63...63", WARN);
     R4_NUMERIC_VALUE_TOO_LARGE = new ErrorCode(REPORTABLE, 4, "ERR R4", "The value is too large.", WARN);
     R5_DECIMAL_CANT_CONVERT_TO_INT = new ErrorCode(REPORTABLE, 5, "ERR R5", "The decimal value cannot convert to an integer because of trailing decimal part.", WARN);
     R7_PMAP_OVERLONG = new ErrorCode(REPORTABLE, 7, "ERR R7", "The presence map is overlong.", WARN);
     R8_PMAP_TOO_MANY_BITS = new ErrorCode(REPORTABLE, 8, "ERR R8", "The presence map has too many bits.", WARN);
     R9_STRING_OVERLONG = new ErrorCode(REPORTABLE, 9, "ERR R9", "The string is overlong.", ERROR);
     GENERAL_ERROR = new ErrorCode(DYNAMIC, 100, "GENERAL", "An error has occurred.", ERROR);
     IMPOSSIBLE_EXCEPTION = new ErrorCode(DYNAMIC, 101, "IMPOSSIBLE", "This should never happen.", ERROR);
     IO_ERROR = new ErrorCode(DYNAMIC, 102, "IOERROR", "An IO error occurred.", FATAL);
     PARSE_ERROR = new ErrorCode(DYNAMIC, 103, "PARSEERR", "An exception occurred while parsing.", ERROR);
     LENGTH_FIELD = new QName("length", TEMPLATE_DEFINITION_1_1);
 }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:35,代码来源:FastConstants.cs


示例2: Convert

 public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context)
 {
     var name = new QName(fieldDef.GetString("Name"), fieldDef.GetString("Ns"));
     bool optional = fieldDef.GetBool("Optional");
     GroupValue exponentDef = fieldDef.GetGroup("Exponent");
     GroupValue exponentOperatorDef = exponentDef.GetGroup("Operator").GetGroup(0);
     Operator exponentOperator = GetOperator(exponentOperatorDef.Group);
     ScalarValue exponentDefaultValue = ScalarValue.Undefined;
     if (exponentDef.IsDefined("InitialValue"))
         exponentDefaultValue = new IntegerValue(exponentDef.GetInt("InitialValue"));
     GroupValue mantissaDef = fieldDef.GetGroup("Mantissa");
     GroupValue mantissaOperatorDef = mantissaDef.GetGroup("Operator").GetGroup(0);
     Operator mantissaOperator = GetOperator(mantissaOperatorDef.Group);
     ScalarValue mantissaDefaultValue = ScalarValue.Undefined;
     if (mantissaDef.IsDefined("InitialValue"))
         mantissaDefaultValue = new LongValue(mantissaDef.GetInt("InitialValue"));
     ComposedScalar composedDecimal = Util.ComposedDecimal(name, exponentOperator, exponentDefaultValue,
                                                           mantissaOperator, mantissaDefaultValue, optional);
     IFieldValue retAuxId;
     if (fieldDef.TryGetValue("AuxId", out retAuxId) && retAuxId!=null)
     {
         composedDecimal.Id = retAuxId.ToString();
     }
     return composedDecimal;
 }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:25,代码来源:ComposedDecimalConverter.cs


示例3: Field

 protected Field(string name, string key, bool optional, string id)
 {
     this.name = new QName(name);
     this.key = new QName(key);
     this.optional = optional;
     this.id = id;
 }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:7,代码来源:Field.cs


示例4: Group

 public Group(QName name, Field[] fields, bool optional)
     : base(name, optional)
 {
     var expandedFields = new List<Field>();
     var references = new List<StaticTemplateReference>();
     for (int i = 0; i < fields.Length; i++)
     {
         if (fields[i] is StaticTemplateReference)
         {
             var currentTemplate = (StaticTemplateReference)fields[i];
             Field[] referenceFields = currentTemplate.Template.Fields;
             for (int j = 1; j < referenceFields.Length; j++)
                 expandedFields.Add(referenceFields[j]);
             references.Add(currentTemplate);
         }
         else
         {
             expandedFields.Add(fields[i]);
         }
     }
     this.fields = expandedFields.ToArray();
     fieldDefinitions = fields;
     fieldIndexMap = ConstructFieldIndexMap(this.fields);
     fieldNameMap = ConstructFieldNameMap(this.fields);
     fieldIdMap = ConstructFieldIdMap(this.fields);
     introspectiveFieldMap = ConstructInstrospectiveFields(this.fields);
     usesPresenceMap_Renamed_Field = DeterminePresenceMapUsage(this.fields);
     staticTemplateReferences = references.ToArray();
 }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:29,代码来源:Group.cs


示例5: Convert

        public override Field Convert(GroupValue fieldDef, TemplateRegistry templateRegistry, ConversionContext context)
        {
            string name = fieldDef.GetString("Name");
            string ns = fieldDef.GetString("Ns");
            var qname = new QName(name, ns);
            var fields = GroupConverter.ParseFieldInstructions(fieldDef, templateRegistry, context);
            bool optional = fieldDef.GetBool("Optional");
            Scalar length = null;
            if (fieldDef.IsDefined("Length"))
            {
                var lengthDef = fieldDef.GetGroup("Length");
                QName lengthName;
                string id = null;
                if (lengthDef.IsDefined("Name"))
                {
                    var nameDef = lengthDef.GetGroup("Name");
                    lengthName = new QName(nameDef.GetString("Name"), nameDef.GetString("Ns"));
                    if (nameDef.IsDefined("AuxId"))
                        id = nameDef.GetString("AuxId");
                }
                else
                    lengthName = Global.CreateImplicitName(qname);
                var operator_Renamed = Operator.NONE;
                if (lengthDef.IsDefined("Operator"))
                    operator_Renamed = GetOperator(lengthDef.GetGroup("Operator").GetGroup(0).GetGroup());
                var initialValue = ScalarValue.UNDEFINED;
                if (lengthDef.IsDefined("InitialValue"))
                    initialValue = (ScalarValue) lengthDef.GetValue("InitialValue");
                length = new Scalar(lengthName, Type.U32, operator_Renamed, initialValue, optional) {Id = id};
            }

            return new Sequence(qname, length, fields, optional);
        }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:33,代码来源:SequenceConverter.cs


示例6: ComposedScalar

 public ComposedScalar(QName name, FASTType type, Scalar[] fields, bool optional, ComposedValueConverter valueConverter)
     : base(name, optional)
 {
     this.fields = fields;
     this.valueConverter = valueConverter;
     this.type = type;
 }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:7,代码来源:ComposedScalar.cs


示例7: GetId

 public override int GetId(QName name)
 {
     MessageTemplate template = nameMap[name];
     if (template == null || !templateMap.ContainsKey(template))
         return - 1;
     return templateMap[template];
 }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:7,代码来源:BasicTemplateRegistry.cs


示例8: createComposedDecimal

        private static Field createComposedDecimal(System.Xml.XmlElement fieldNode, QName name, bool optional, System.Xml.XmlNode mantissaNode, System.Xml.XmlNode exponentNode, ParsingContext context)
        {
            string mantissaOperator = "none";
            string exponentOperator = "none";
            ScalarValue mantissaDefaultValue = ScalarValue.UNDEFINED;
            ScalarValue exponentDefaultValue = ScalarValue.UNDEFINED;
            QName mantissaKey = null;
            QName exponentKey = null;
            string mantissaDictionary = context.Dictionary;
            string exponentDictionary = context.Dictionary;
            string mantissaNamespace = context.Namespace;
            string exponentNamespace = context.Namespace;

            if ((mantissaNode != null) && mantissaNode.HasChildNodes)
            {
                System.Xml.XmlElement operatorElement = GetElement((System.Xml.XmlElement) mantissaNode, 1);
                mantissaOperator = operatorElement.Name;

                if (operatorElement.HasAttribute("value"))
                    mantissaDefaultValue = FASTType.I64.GetValue(operatorElement.GetAttribute("value"));
                if (operatorElement.HasAttribute("ns"))
                    mantissaNamespace = operatorElement.GetAttribute("ns");
                if (operatorElement.HasAttribute("key"))
                    mantissaKey = new QName(operatorElement.GetAttribute("key"), mantissaNamespace);
                if (operatorElement.HasAttribute("dictionary"))
                    mantissaDictionary = operatorElement.GetAttribute("dictionary");
            }

            if ((exponentNode != null) && exponentNode.HasChildNodes)
            {
                System.Xml.XmlElement operatorElement = GetElement((System.Xml.XmlElement) exponentNode, 1);
                exponentOperator = operatorElement.Name;

                if (operatorElement.HasAttribute("value"))
                    exponentDefaultValue = FASTType.I32.GetValue(operatorElement.GetAttribute("value"));
                if (operatorElement.HasAttribute("ns"))
                    exponentNamespace = operatorElement.GetAttribute("ns");
                if (operatorElement.HasAttribute("key"))
                    exponentKey = new QName(operatorElement.GetAttribute("key"), exponentNamespace);
                if (operatorElement.HasAttribute("dictionary"))
                    exponentDictionary = operatorElement.GetAttribute("dictionary");
            }

            ComposedScalar scalar = Util.ComposedDecimal(name, Operator.Operator.GetOperator(exponentOperator), exponentDefaultValue, Operator.Operator.GetOperator(mantissaOperator), mantissaDefaultValue, optional);

            Scalar exponent = scalar.Fields[0];
            exponent.Dictionary = exponentDictionary;
            if (exponentKey != null)
                exponent.Key = exponentKey;

            Scalar mantissa = scalar.Fields[1];
            mantissa.Dictionary = mantissaDictionary;
            if (mantissaKey != null)
                mantissa.Key = mantissaKey;

            if (fieldNode.HasAttribute("id"))
                scalar.Id = fieldNode.GetAttribute("id");
            return scalar;
        }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:59,代码来源:ComposedDecimalParser.cs


示例9: ComposedScalar

 public ComposedScalar(QName name, FastType fastType, Scalar[] fields, bool optional,
                       IComposedValueConverter valueConverter)
     : base(name, optional)
 {
     _fields = fields;
     _valueConverter = valueConverter;
     _fastType = fastType;
 }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:8,代码来源:ComposedScalar.cs


示例10: Group

        public Group(QName name, string childNamespace, Field[] fields, bool optional)
            : base(name, optional)
        {
            _childNamespace = childNamespace;

            Init(fields,
                 out _fieldDefinitions, out _fields, out _fieldIndexMap, out _fieldNameMap,
                 out _introspectiveFieldMap, out _usesPresenceMapRenamedField, out _staticTemplateReferences);
        }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:9,代码来源:Group.cs


示例11: Convert

 public override Field Convert(GroupValue fieldDef, TemplateRegistry templateRegistry, ConversionContext context)
 {
     var name = new QName(fieldDef.GetString("Name"), fieldDef.GetString("Ns"));
     if (!templateRegistry.IsDefined(name))
     {
         throw new System.SystemException("Referenced template " + name + " not defined.");
     }
     return new StaticTemplateReference(templateRegistry.get_Renamed(name));
 }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:9,代码来源:StaticTemplateReferenceConverter.cs


示例12: Convert

        public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context)
        {
            var name = new QName(fieldDef.GetString("Name"), fieldDef.GetString("Ns"));
            MessageTemplate template;
            if (templateRegistry.TryGetTemplate(name, out template))
                return new StaticTemplateReference(template);

            throw new ArgumentOutOfRangeException("fieldDef", name, "Referenced template name not defined.");
        }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:9,代码来源:StaticTemplateReferenceConverter.cs


示例13: Add

        public override void Add(int templateId, QName templateName)
        {
            MessageTemplate template;
            if (!_defNameMap.TryGetValue(templateName, out template))
                throw new ArgumentOutOfRangeException("templateName", templateName, "The template is not defined.");

            _regTemplateMap[template] = templateId;
            _regIdMap[templateId] = template;
            NotifyTemplateRegistered(template, templateId);
        }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:10,代码来源:BasicTemplateRegistry.cs


示例14: ParsingContext

 public ParsingContext(XmlElement node, ParsingContext parent)
 {
     _parent = parent;
     if (node.HasAttribute("templateNs"))
         TemplateNamespace = node.GetAttribute("templateNs");
     if (node.HasAttribute("ns"))
         Namespace = node.GetAttribute("ns");
     if (node.HasAttribute("dictionary"))
         Dictionary = node.GetAttribute("dictionary");
     if (node.HasAttribute("name"))
         _name = new QName(node.GetAttribute("name"), Namespace);
 }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:12,代码来源:ParsingContext.cs


示例15: Sequence

        public Sequence(QName name, Scalar length, Field[] fields, bool optional)
            : base(name, optional)
        {
            _group = new Group(name, fields, optional);

            if (length == null)
            {
                _length = CreateLength(name, optional);
                _implicitLength = true;
            }
            else
                _length = length;
        }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:13,代码来源:Sequence.cs


示例16: Scalar

 public Scalar(QName name, FASTType type, OperatorCodec operatorCodec, ScalarValue defaultValue, bool optional)
     : base(name, optional)
 {
     InitBlock();
     operator_Renamed = operatorCodec.Operator;
     this.operatorCodec = operatorCodec;
     dictionary = "global";
     this.defaultValue = defaultValue ?? ScalarValue.UNDEFINED;
     this.type = type;
     typeCodec = type.GetCodec(operator_Renamed, optional);
     initialValue = ((defaultValue == null) || defaultValue.Undefined)?this.type.DefaultValue:defaultValue;
     operator_Renamed.Validate(this);
 }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:13,代码来源:Scalar.cs


示例17: Scalar

 private Scalar(QName name, FastType fastType, Operator op, OperatorCodec operatorCodec,
                ScalarValue defaultValue, bool optional)
     : base(name, optional)
 {
     _operator = op;
     _operatorCodec = operatorCodec;
     _dictionary = DictionaryFields.Global;
     _defaultValue = defaultValue ?? ScalarValue.Undefined;
     _fastType = fastType;
     _typeCodec = fastType.GetCodec(op, optional);
     _initialValue = (defaultValue == null || defaultValue.IsUndefined) ? _fastType.DefaultValue : defaultValue;
     op.Validate(this);
 }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:13,代码来源:Scalar.cs


示例18: Convert

        public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context)
        {
            string name = fieldDef.GetString("Name");
            string ns = fieldDef.GetString("Ns");
            var qname = new QName(name, ns);
            Field[] fields = GroupConverter.ParseFieldInstructions(fieldDef, templateRegistry, context);
            bool optional = fieldDef.GetBool("Optional");
            Scalar length = null;
            IFieldValue retLength;
            if (fieldDef.TryGetValue("Length", out retLength) && retLength!=null)
            {
                GroupValue lengthDef = (GroupValue)retLength;
                QName lengthName;
                string id = null;
                IFieldValue retName;
                if (lengthDef.TryGetValue("Name", out retName) && retName != null)
                {
                    GroupValue nameDef = (GroupValue)retName;
                    lengthName = new QName(nameDef.GetString("Name"), nameDef.GetString("Ns"));
                    IFieldValue retAuxId;
                    if (nameDef.TryGetValue("AuxId", out retAuxId) && retAuxId != null)
                        id = retAuxId.ToString();
                }
                else
                    lengthName = Global.CreateImplicitName(qname);
                Operator op = Operator.None;
                IFieldValue retOperator;
                if (lengthDef.TryGetValue("Operator", out retOperator) && retOperator != null)
                    op = GetOperator(((GroupValue)retOperator).GetGroup(0).Group);
                ScalarValue initialValue = ScalarValue.Undefined;
                IFieldValue retInitialValue;
                if (lengthDef.TryGetValue("InitialValue", out retInitialValue) && retInitialValue != null)
                    initialValue = (ScalarValue) retInitialValue;
                length = new Scalar(lengthName, FastType.U32, op, initialValue, optional) {Id = id};
            }

            var sequence = new Sequence(qname, length, fields, optional);
            IFieldValue retTypeRef;
            if (fieldDef.TryGetValue("TypeRef", out retTypeRef) && retTypeRef != null)
            {
                GroupValue typeRef = (GroupValue)retTypeRef;
                string typeRefName = typeRef.GetString("Name");
                string typeRefNs = ""; // context.getNamespace();
                IFieldValue rettypeRefNs;
                if (typeRef.TryGetValue("Ns", out rettypeRefNs) && rettypeRefNs!=null)
                    typeRefNs = rettypeRefNs.ToString();
                sequence.TypeReference = new QName(typeRefName, typeRefNs);
            }
            return sequence;
        }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:50,代码来源:SequenceConverter.cs


示例19: ParseSequenceLengthField

        private Scalar ParseSequenceLengthField(QName name, System.Xml.XmlElement sequence, bool optional, ParsingContext parent)
        {
            System.Xml.XmlNodeList lengthElements = sequence.GetElementsByTagName("length");

            if (lengthElements.Count == 0)
            {
                var implicitLength = new Scalar(Global.CreateImplicitName(name), FASTType.U32, Operator.Operator.NONE, ScalarValue.UNDEFINED, optional)
                                         {Dictionary = parent.Dictionary};
                return implicitLength;
            }

            var length = (System.Xml.XmlElement) lengthElements.Item(0);
            var context = new ParsingContext(length, parent);
            return (Scalar) sequenceLengthParser.Parse(length, optional, context);
        }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:15,代码来源:SequenceParser.cs


示例20: Average

 public static bool Average(IEnumerator<QName> left, out QName result)
 {
     decimal sum = 0;
     decimal count = 0;
     if (left.MoveNext())
     {
         count++;
         sum += left.Current.GetValueOrDefault<decimal>();
         while (left.MoveNext())
         {
             count++;
             sum += left.Current.GetValueOrDefault<decimal>();
         }
     }
     result = (sum / count).CreateLiteral();
     // always returns true - means that execution avareage will always succeed if arguments match list criteria.
     return true;
 }
开发者ID:comindware,项目名称:database-examples,代码行数:18,代码来源:LocalCodeBuiltins.cs



注:本文中的QName类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# QQClient类代码示例发布时间:2022-05-24
下一篇:
C# QFontAlignment类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap