ianmackenzie / elm-iso-10303 / Step.Format

Low-level attribute formatting functionality. Usually you will want to use the functions in the Step.Encode module instead.

derivedValue : String

The special 'derived value' string *.

null : String

The special 'null value' string $.

bool : Basics.Bool -> String

Format a boolean value as either .T. or .F..

int : Basics.Int -> String

Format an integer value. (This is really just an alias for Elm's built-in String.fromInt.)

float : Basics.Float -> String

Format a floating-point value. This is almost the same as Elm's built-in String.fromFloat but (as required by the STEP standard) will ensure that the resulting string has a trailing decimal place if one is not otherwise required. For example, the value 3 will be formatted as 3. instead of just 3.

string : String -> String

Format a string by wrapping it in single quotation marks. Unicode characters will be properly escaped according to the (weird, custom) method specified in the STEP standard; for example, "see ยง 4.1" will be encoded as 'see \X\A7 4.1'.

id : Basics.Int -> String

Format a STEP integer ID as (for example) #123.

enum : Step.EnumValue.EnumValue -> String

Format an enum value as a capitalized string with leading and trailing periods, for example .METRE..

binaryData : Bytes.Encode.Encoder -> String

Format binary data as a hex-encoded string according to the STEP standard and wrap it in double quotation marks.

Note that since Elm only supports byte-aligned binary data, there is no way to create (for example) a blob of binary data exactly 5 bits in size even though that is supported by the STEP standard. As a result, the encoded string will always start with 0 (since that character is otherwise used to indicate a number of padding zero bits).

list : List String -> String

Given a list strings (assumed to be formatted attribute values produced by other functions in this module), join them using a comma and enclose them in parentheses, for example (#1,#2,#3) for a list of entity references.

typedAttribute : Step.TypeName.TypeName -> String -> String

Format a typed attribute by surrounding an existing attribute (given as a string) in parentheses and prepending the given type name, for example SOME_TYPE_NAME(123) for a typed integer attribute.