コード例 #1
0
ファイル: P21Tests.cs プロジェクト: bnaand/xBim-Toolkit
 public void Unescape_8BitHex()
 {
     const string escaped = @"\X\C4";
     const string expected = "Ä";
     var value = new IfcText(escaped);
     var unescaped = decoder.Unescape(value);
     // Assert.AreEqual(escaped, value.ToPart21.Trim('\''));
     Assert.AreEqual(expected, unescaped);
 }
コード例 #2
0
        public string Unescape(IfcText value)
        {
            Initialize(value);
            while(!eof)
            {
                if (At(CodeTableToken))
                    MovePast(CodeTableToken);

                if (At(UpperAsciiToken))
                    ParseUpperAscii();
                else if (At(Hex8Token))
                    ParseHex8();
                else if (At(Hex16Token))
                    ParseHex16();
                else
                    CopyCharacter();
            }
            return builder.ToString();
        }
コード例 #3
0
 public override void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
         case 1:
         case 2:
         case 3:
         case 4:
         case 5:
             base.IfcParse(propIndex, value);
             break;
         case 6:
             _costType = value.StringVal;
             break;
         case 7:
             _condition = value.StringVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
コード例 #4
0
        public override void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
                case 0:
                case 1:
                case 2:
                case 3:
                    base.IfcParse(propIndex, value);
                    break;
                case 4:
                    _applicableValueRatio = value.RealVal;
                    break;
                case 5:
                    _thermalLoadSource =
                        (IfcThermalLoadSourceEnum) Enum.Parse(typeof (IfcThermalLoadSourceEnum), value.EnumVal, true);
                    break;
                case 6:
                    _propertySource =
                        (IfcPropertySourceEnum) Enum.Parse(typeof (IfcPropertySourceEnum), value.EnumVal, true);
                    break;
                case 7:
                    _sourceDescription = value.StringVal;
                    break;
                case 8:
                    _maximumValue = value.RealVal;
                    break;
                case 9:
                    _minimumValue = value.RealVal;
                    break;
                case 10:
                    _thermalLoadTimeSeriesValues = (IfcTimeSeries) value.EntityVal;
                    break;
                case 11:
                    _userDefinedThermalLoadSource = value.StringVal;
                    break;
                case 12:
                    _userDefinedPropertySource = value.StringVal;
                    break;
                case 13:
                    _thermalLoadType =
                        (IfcThermalLoadTypeEnum) Enum.Parse(typeof (IfcThermalLoadTypeEnum), value.EnumVal, true);
                    break;

                default:
                    this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
コード例 #5
0
 /// <summary>
 /// set IfcValue to IfcText or IfcReal
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 private IfcValue SetValue(string value)
 {
     IfcValue ifcValue;
     double test;
     if (double.TryParse(value, out test))
         ifcValue = new IfcReal(test);
     else
         ifcValue = new IfcText(value);
     return ifcValue;
 }
コード例 #6
0
 void IPersistIfc.IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
             _name = value.StringVal;
             break;
         case 1:
             _description = value.StringVal;
             break;
         case 2:
             _relatingDraughtingCallout = (IfcDraughtingCallout)(value.EntityVal);
             break;
         case 3:
             _relatedDraughtingCallout = (IfcDraughtingCallout)(value.EntityVal);
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
コード例 #7
0
 private void Initialize(IfcText value)
 {
     builder = new StringBuilder();
     p21 = value.ToPart21.Trim('\'');
     eof = p21.Length == 0;
     i = 0;
 }