private TypeInfo CreateStringType(StringDataType stringType) { if (stringType.Width != null) { var width = evaluator_.EvaluateNonIndeterminate(stringType.Width); return(new StringTypeInfo(width, stringType.IsFixed)); } else { return(TypeInfo.String); } }
/// <summary> /// Resolves the specified data type. /// </summary> /// <param name="dataType">Data type specification.</param> /// <returns>Resolved EDM Type.</returns> PrimitiveDataType IPrimitiveDataTypeVisitor <PrimitiveDataType> .Visit(StringDataType dataType) { int? maxLength = null; bool? isUnicode = null; MaxLengthFacet maxLengthFacet; IsUnicodeFacet isUnicodeFacet; if (dataType.TryGetFacet(out maxLengthFacet)) { maxLength = maxLengthFacet.Value; } if (dataType.TryGetFacet(out isUnicodeFacet)) { isUnicode = isUnicodeFacet.Value; } return(EdmDataTypes.String(maxLength, isUnicode)); }
/// <summary> /// Initializes static members of the DataTypes class. /// </summary> static DataTypes() { Integer = new IntegerDataType(); Stream = new StreamDataType(); String = new StringDataType(); Boolean = new BooleanDataType(); FixedPoint = new FixedPointDataType(); FloatingPoint = new FloatingPointDataType(); DateTime = new DateTimeDataType(); Binary = new BinaryDataType(); Guid = new GuidDataType(); TimeOfDay = new TimeOfDayDataType(); ComplexType = new ComplexDataType(); EntityType = new EntityDataType(); CollectionType = new CollectionDataType(); ReferenceType = new ReferenceDataType(); RowType = new RowDataType(); EnumType = new EnumDataType(); Spatial = new SpatialDataType(); }
static DataTypeDescriptor() { DnsName = new DnsNameDataType(); IpAddress = new IpAddress(); Bag = new Bag(); Time = new Time(); String = new StringDataType(); Rfc822Name = new Rfc822Name(); X500Name = new X500Name(); Double = new DoubleDataType(); YearMonthDuration = new YearMonthDuration(); DaytimeDuration = new DaytimeDuration(); DateTime = new DateTime(); Date = new DateDataType(); Integer = new IntegerDataType(); Boolean = new BooleanDataType(); HexBinary = new HexBinary(); Base64Binary = new Base64Binary(); AnyUri = new AnyUri(); Function = new FunctionDataType(); }
public Rule(Node node) { Node ruleidnode = node.Attributes.GetNamedItem("RuleId"); this._ruleId = (StringDataType)DataTypeFactory.Instance.CreateValue(StringDataType.URIID, ruleidnode.NodeValue); Node effectnode = node.Attributes.GetNamedItem("Effect"); this._effect = new Effect(effectnode.NodeValue); NodeList children = node.ChildNodes; for (int i = 0; i < children.Length; i++) { Node child = children.Item(i); if (child.NodeName.Equals(Target.stringIdentifer)) { this._target = (Target)PolicyElementFactory.GetInstance(child); } if (child.NodeName.Equals(Description.stringIdentifer)) { this._description = (Description)PolicyElementFactory.GetInstance(child); } if (child.NodeName.Equals(Condition.stringIdentifer)) { this._condition = (Condition)PolicyElementFactory.GetInstance(child); } if (child.NodeName.Equals(ObligationExpressions.stringIdentifer)) { this._obligationExpressions = ((ObligationExpressions)PolicyElementFactory.GetInstance(child)); } if (child.NodeName.Equals(AdviceExpressions.stringIdentifer)) { this._adviceExpressions = ((AdviceExpressions)PolicyElementFactory.GetInstance(child)); } } if (this._target == null && this._condition == null) { this._isRuleReference = true; } }
public DataTypeValue GetInstance(Node node) { return(StringDataType.GetInstance(node)); }
public DataTypeValue GetInstance(string value) { return(StringDataType.GetInstance(value)); }
protected override void SetMyBlockInternalArg() { myBlockInternalArg = new StringDataType(this, output); }
IEdmPrimitiveTypeReference IPrimitiveDataTypeVisitor <IEdmPrimitiveTypeReference> .Visit(StringDataType dataType) { IEdmPrimitiveType typeDefinition = this.GetEdmTypeDefinition(dataType); bool isUnicode = dataType.GetFacetValue <IsUnicodeFacet, bool>(true); int?maxLength = null; if (dataType.HasFacet <MaxLengthFacet>()) { maxLength = dataType.GetFacet <MaxLengthFacet>().Value; } var typeReference = new EdmStringTypeReference( typeDefinition, dataType.IsNullable, false, maxLength, isUnicode); return(typeReference); }
public Attribute(Node node) { if (!node.NodeName.Equals(Identifer)) { throw new Indeterminate(Indeterminate.IndeterminateSyntaxError); } NamedNodeMap attributes = node.Attributes; Node idnode = attributes.GetNamedItem("AttributeId"); if (idnode != null) { this._attributeId = new AnyURIDataType(idnode.NodeValue); } else { throw new Indeterminate(Indeterminate.IndeterminateSyntaxError); } Node includeinresultnode = attributes.GetNamedItem("IncludeInResult"); if (includeinresultnode != null) { string value = includeinresultnode.NodeValue.Trim(); if (value.EqualsIgnoreCase("true")) { this._includeInResult = BooleanDataType.True; } else { this._includeInResult = BooleanDataType.False; } } else { throw new Indeterminate(Indeterminate.IndeterminateSyntaxError); } Node issuernode = attributes.GetNamedItem("Issuer"); if (issuernode != null) { this._issuer = new StringDataType(issuernode.NodeValue); } this._attributeValues = new List <AttributeValue>(); NodeList children = node.ChildNodes; for (int i = 0; i < children.Length; i++) { Node child = children.Item(i); if (child.NodeName.Equals("AttributeValue")) { this._attributeValues.Add((AttributeValue)AttributeValue.GetInstance(child)); } } if (this._attributeValues.Count == 0) { throw new Indeterminate(Indeterminate.IndeterminateSyntaxError); } }
private void ProcessStringNameSpaceFile(StringDataType type, NameSpaceFile imgFile) { if (!Contains((int)type)) { InsertItem(new GenericKeyedTemplate <StringTemplate>((int)type)); } WzProperty dataBlob = imgFile.Object as WzFileProperty; if (dataBlob.Name.Equals("Eqp.img")) { foreach (var eqpTypeBlob in dataBlob["Eqp"] as WzProperty) { run(eqpTypeBlob.Value as WzProperty); } } else if (dataBlob.Name.Equals("Etc.img")) { run(dataBlob["Etc"] as WzProperty); } else if (dataBlob.Name.Equals("Map.img")) { foreach (var mapBlob in dataBlob) { run(mapBlob.Value as WzProperty); } } else { run(dataBlob); } void run(WzProperty blob) { foreach (var stringBlob in blob) { var templateId = Convert.ToInt32(stringBlob.Key); var prop = stringBlob.Value as WzProperty; if (prop.HasChild("bookName")) { continue; // skill book, we only want skill names } var pEntry = new StringTemplate(templateId); AssignProviderAttributes(pEntry, prop); this[type].Add(pEntry); // BEGIN PROPERTY AUTO POPULATION //foreach (var templateMember in pEntry.GetType().GetMembers()) //{ // var memberData = templateMember.GetCustomAttributes(); // var providerAttribute = memberData // .FirstOrDefault(md => md is ProviderAttributeAttribute); // if (providerAttribute is ProviderAttributeAttribute paa) // { // var pi = pEntry.GetType().GetProperty(templateMember.Name); // // if pi is null: throw -- should not happen // var val = prop.GetImgPropVal(pi.PropertyType, paa.AttributeName); // if (val.IsNullOrDefault() || val is string s && s.Length <= 0) // { // foreach (var attrName in paa.AltAttributeNames) // { // val = prop.GetImgPropVal(pi.PropertyType, attrName); // if (!val.IsNullOrDefault() || val is string ss && ss.Length <= 0) break; // } // } // pi.SetValue(pEntry, prop.GetImgPropVal(pi.PropertyType, paa.AttributeName)); // } //} // END PROPERTY AUTO POPULATION //this[type].Add(new StringTemplate(templateId) //{ // Name = prop.GetString("name"), // StreetName = prop.GetString("streetName"), // Description = prop.GetString("desc") //}); //if (this[type][templateId].Name is null) //{ // this[type][templateId].Name = prop.GetString("mapName"); //} //if (this[type][templateId].Name is null) //{ // throw new NullReferenceException($"Template name is null. ID: {templateId}"); //} } } }
public GenericKeyedTemplate <StringTemplate> this[StringDataType key] => base[(int)key];
public virtual void VisitStringDataType(StringDataType stringDataType) { DefaultVisit(stringDataType); }