Saucexages v0.2.0 Saucexages.Codec.SauceFieldDecoder View Source

Functions for decoding commonly used SAUCE field data types.

Link to this section Summary

Functions

Converts a SAUCE string, optionally using the specified encodings

Decodes a SAUCE comment block comment line

Decodes SAUCE comment block comment lines as a list of strings

Decodes SAUCE comment block comment lines with an optional separator

Decodes SAUCE record comment lines

Decodes a SAUCE C-style string, removing any padding. A default value may be optionally specified to use for cases when decoding is impossible. Custom encodings can also be passed to attempt to decode using something other than the SAUCE standard CP437 and a fallback of utf-8

Decodes a SAUCE data type, using the SAUCE spec data type specification rules. If a data type is invalid, it will be coerced to 0

Decodes a SAUCE date binary to an Elixir DateTime if possible

Decodes SAUCE date-time components taken from a SAUCE record and converts them to an Elixir DateTime if possible

Decodes a SAUCE file type, using the SAUCE spec file type specification rules. If a file type is invalid, it will be coerced to 0

Decodes a SAUCE string, removing any padding. A default value may be optionally specified to use for cases when decoding is impossible. Custom encodings can also be passed to attempt to decode using something other than the SAUCE standard CP437 and a fallback of utf-8

Link to this section Functions

Link to this function convert_string(bin, encodings \\ ["VENDORS/MICSFT/PC/CP437"]) View Source
convert_string(binary(), [String.t() | atom()]) ::
  {:ok, String.t(), atom() | String.t()} | {:error, term()}

Converts a SAUCE string, optionally using the specified encodings.

Link to this function decode_comment_block_line(comment_line) View Source
decode_comment_block_line(binary()) :: String.t() | nil

Decodes a SAUCE comment block comment line.

Link to this function decode_comment_block_lines(comment_lines) View Source
decode_comment_block_lines([binary()]) :: [String.t() | nil]

Decodes SAUCE comment block comment lines as a list of strings.

Link to this function decode_comment_block_lines_with(comment_lines, separator \\ "\n") View Source
decode_comment_block_lines_with([binary()], String.t()) :: String.t()

Decodes SAUCE comment block comment lines with an optional separator.

Link to this function decode_comment_lines(comment_lines) View Source
decode_comment_lines(non_neg_integer() | binary()) :: non_neg_integer()

Decodes SAUCE record comment lines.

Link to this function decode_cstring(bin, default_value \\ nil, encodings \\ ["VENDORS/MICSFT/PC/CP437"]) View Source
decode_cstring(binary(), String.t() | nil, [String.t()]) :: String.t()

Decodes a SAUCE C-style string, removing any padding. A default value may be optionally specified to use for cases when decoding is impossible. Custom encodings can also be passed to attempt to decode using something other than the SAUCE standard CP437 and a fallback of utf-8.

Link to this function decode_data_type(data_type) View Source
decode_data_type(non_neg_integer()) :: non_neg_integer()

Decodes a SAUCE data type, using the SAUCE spec data type specification rules. If a data type is invalid, it will be coerced to 0.

Link to this function decode_date(date_binary) View Source
decode_date(binary()) :: DateTime.t() | nil

Decodes a SAUCE date binary to an Elixir DateTime if possible.

Link to this function decode_date(year, month, day) View Source
decode_date(binary(), binary(), binary()) :: DateTime.t() | nil

Decodes SAUCE date-time components taken from a SAUCE record and converts them to an Elixir DateTime if possible.

Link to this function decode_file_type(file_type, data_type) View Source
decode_file_type(non_neg_integer(), non_neg_integer()) :: non_neg_integer()

Decodes a SAUCE file type, using the SAUCE spec file type specification rules. If a file type is invalid, it will be coerced to 0.

Link to this function decode_string(bin, default_value \\ nil, encodings \\ ["VENDORS/MICSFT/PC/CP437"]) View Source
decode_string(binary(), String.t() | nil, [String.t()]) :: String.t() | nil

Decodes a SAUCE string, removing any padding. A default value may be optionally specified to use for cases when decoding is impossible. Custom encodings can also be passed to attempt to decode using something other than the SAUCE standard CP437 and a fallback of utf-8.