internal static IfcSimpleValue parseSimpleValue(string str)
{
if (str.StartsWith("IFCBOOLEAN("))
return new IfcBoolean(string.Compare(str.Substring(11, str.Length - 12), ".T.") == 0);
if (str.StartsWith("IFCIDENTIFIER("))
return new IfcIdentifier(str.Substring(15, str.Length - 17));
if (str.StartsWith("IFCINTEGER("))
return new IfcInteger(int.Parse(str.Substring(11, str.Length - 12)));
if (str.StartsWith("IFCLABEL("))
{
string s = str.Substring(10, str.Length - 12);
return new IfcLabel((s == "$" || string.IsNullOrEmpty(s) ? "DEFAULT" : s));
}
if (str.StartsWith("IFCLOGICAL("))
{
string s = str.Substring(11, str.Length - 12);
IfcLogicalEnum l = IfcLogicalEnum.UNKNOWN;
if (s == ".T.")
l = IfcLogicalEnum.TRUE;
else if (s == ".F.")
l = IfcLogicalEnum.FALSE;
return new IfcLogical(l);
}
if (str.StartsWith("IFCREAL("))
return new IfcReal(ParserSTEP.ParseDouble(str.Substring(8, str.Length - 9)));
if (str.StartsWith("IFCTEXT("))
{
string s = str.Substring(9, str.Length - 11);
return new IfcText((s == "$" || string.IsNullOrEmpty(s) ? "DEFAULT" : s));
}
int i = 0;
if (int.TryParse(str, out i))
return new IfcInteger(i);
double d = 0;
if (double.TryParse(str, out d))
return new IfcReal(d);
if (str == ".T.")
return new IfcBoolean(true);
if (str == ".F.")
return new IfcBoolean(false);
if (str == ".U.")
return new IfcLogical(IfcLogicalEnum.UNKNOWN);
return null;
}