示例#1
0
 /// <summary>
 /// Creates an IFCData object as IfcText.
 /// </summary>
 /// <param name="value">The string value.</param>
 /// <returns>The IFCData object.</returns>
 public static IFCData CreateAsText(string value)
 {
     if (value == null)
     {
         return(null);
     }
     return(IFCData.CreateStringOfType(value, "IfcText"));
 }
示例#2
0
 /// <summary>
 /// Creates an IFCData object as IfcIdentifier.
 /// </summary>
 /// <param name="value">The string value.</param>
 /// <returns>The IFCData object.</returns>
 public static IFCData CreateAsIdentifier(string value)
 {
     if (value == null)
     {
         return(null);
     }
     return(IFCData.CreateStringOfType(value.Length > 255 ? value.Remove(255) : value, "IfcIdentifier"));
 }
示例#3
0
        /// <summary>
        /// Creates an IFCData object as IfcLabel.
        /// </summary>
        /// <param name="value">The string value.</param>
        /// <returns>The IFCData object.</returns>
        public static IFCData CreateAsLabel(string value)
        {
            if (value == null)
            {
                return(null);
            }

            if (value.Length > IFCLimits.MAX_IFCLABEL_STR_LEN)
            {
                OnIFCStringTooLongWarn(value, IFCLimits.MAX_IFCLABEL_STR_LEN);
                value = value.Remove(IFCLimits.MAX_IFCLABEL_STR_LEN);
            }
            return(IFCData.CreateStringOfType(value, "IfcLabel"));
        }
示例#4
0
        /// <summary>
        /// Creates an IFCData object as IfcIdentifier.
        /// </summary>
        /// <param name="value">The string value.</param>
        /// <returns>The IFCData object.</returns>
        public static IFCData CreateAsIdentifier(string value)
        {
            if (value == null)
            {
                return(null);
            }

            if (value.Length > IFCLimits.MAX_IFCIDENTIFIER_STR_LEN)
            {
                OnIFCStringTooLongWarn(value, IFCLimits.MAX_IFCIDENTIFIER_STR_LEN);
                value = value.Remove(IFCLimits.MAX_IFCIDENTIFIER_STR_LEN);
            }
            return(IFCData.CreateStringOfType(value, "IfcIdentifier"));
        }
示例#5
0
        /// <summary>
        /// Creates an IFCData object as IfcLabel.
        /// </summary>
        /// <param name="value">The string value.</param>
        /// <returns>The IFCData object.</returns>
        public static IFCData CreateAsLabel(string value)
        {
            if (value == null)
            {
                return(null);
            }

            value = new string(value.Where(c => !char.IsControl(c)).ToArray());
            if (value.Length > IFCLimits.MAX_IFCLABEL_STR_LEN)
            {
                OnIFCStringTooLongWarn(value, IFCLimits.MAX_IFCLABEL_STR_LEN);
                value = value.Remove(IFCLimits.MAX_IFCLABEL_STR_LEN);
            }
            return(IFCData.CreateStringOfType(value, "IfcLabel"));
        }
示例#6
0
        /// <summary>
        /// Creates an IFCData object as IfcText.
        /// </summary>
        /// <param name="value">The string value.</param>
        /// <returns>The IFCData object.</returns>
        public static IFCData CreateAsText(string value)
        {
            if (value == null)
            {
                return(null);
            }

            int maxStrLen = IFCLimits.CalculateMaxAllowedSize(value);

            if (value.Length > maxStrLen)
            {
                OnIFCStringTooLongWarn(value, maxStrLen);
                value = value.Remove(maxStrLen);
            }
            return(IFCData.CreateStringOfType(value, "IfcText"));
        }
示例#7
0
        /// <summary>
        /// Creates an IFCData object as IfcText.
        /// </summary>
        /// <param name="value">The string value.</param>
        /// <returns>The IFCData object.</returns>
        public static IFCData CreateAsText(string value)
        {
            if (value == null)
            {
                return(null);
            }

            value = new string(value.Where(c => !char.IsControl(c)).ToArray());
            int maxStrLen = IFCLimits.CalculateMaxAllowedSize(value);

            if (value.Length > maxStrLen)
            {
                OnIFCStringTooLongWarn(value, maxStrLen);
                value = value.Remove(maxStrLen);
            }
            return(IFCData.CreateStringOfType(value, "IfcText"));
        }
示例#8
0
 /// <summary>
 /// Creates an IFCData object as IfcIdentifier.
 /// </summary>
 /// <param name="value">The string value.</param>
 /// <returns>The IFCData object.</returns>
 public static IFCData CreateAsIdentifier(string value)
 {
     return(IFCData.CreateStringOfType(value, "IfcIdentifier"));
 }
示例#9
0
 /// <summary>
 /// Creates an IFCData object as IfcLabel.
 /// </summary>
 /// <param name="value">The string value.</param>
 /// <returns>The IFCData object.</returns>
 public static IFCData CreateAsLabel(string value)
 {
     return(IFCData.CreateStringOfType(value, "IfcLabel"));
 }