class interface UT_STRING_FORMATTER

feature(s) from KL_IMPORTED_STRING_ROUTINES
   --  Access

   STRING_: KL_STRING_ROUTINES
      --  Routines that ought to be in class STRING

      ensure
         string_routines_not_void: Result /= Void

feature(s) from KL_IMPORTED_OUTPUT_STREAM_ROUTINES
   --  Access

   OUTPUT_STREAM_: KL_OUTPUT_STREAM_ROUTINES
      --  Routines that ought to be in class OUTPUT_STREAM

      ensure
         output_stream_routines_not_void: Result /= Void

feature(s) from KL_IMPORTED_OUTPUT_STREAM_ROUTINES
   --  Type anchors

   OUTPUT_STREAM_TYPE: OUTPUT_STREAM

feature(s) from UT_IMPORTED_FORMATTERS
   --  Access

   INTEGER_FORMATTER_: UT_INTEGER_FORMATTER
      --  Formatting routines that ought
      --  to be in class INTEGER

      ensure
         integer_formatter_not_void: Result /= Void

   CHARACTER_FORMATTER_: UT_CHARACTER_FORMATTER
      --  Formatting routines that ought
      --  to be in class CHARACTER

      ensure
         character_formatter_not_void: Result /= Void

   BOOLEAN_FORMATTER_: UT_BOOLEAN_FORMATTER
      --  Formatting routines that ought
      --  to be in class BOOLEAN

      ensure
         boolean_formatter_not_void: Result /= Void

   STRING_FORMATTER_: UT_STRING_FORMATTER
      --  Formatting routines that ought
      --  to be in class STRING

      ensure
         string_formatter_not_void: Result /= Void

   ARRAY_FORMATTER_: UT_ARRAY_FORMATTER
      --  Formatting routines that ought
      --  to be in class ARRAY

      ensure
         array_formatter_not_void: Result /= Void

feature(s) from UT_STRING_FORMATTER
   --  Access

   eiffel_string_out (a_string: STRING): STRING
      --  Formatted version of a_string, where all
      --  non-printable characters are replaced by their
      --  escaped character sequence as described in
      --  ETL, section 25.15, page 422;
      --  Return a new string at each call.
      --  Regexp: ([ !#$&(-~]|%[BFNRTU%'"]|%/[0-9]+/)*

      require
         a_string_not_void: a_string /= Void
      ensure
         eiffel_string_out_not_void: Result /= Void

   quoted_eiffel_string_out (a_string: STRING): STRING
      --  Formatted version of a_string, surrounded
      --  by double quotes, where all non-printable
      --  characters are replaced by their escaped
      --  character sequence as described in ETL,
      --  section 25.15, page 422;
      --  Return a new string at each call.
      --  Regexp: \"([ !#$&(-~]|%[BFNRTU%'"]|%/[0-9]+/)*\"

      require
         a_string_not_void: a_string /= Void
      ensure
         quoted_eiffel_string_out_not_void: Result /= Void

   left_padded_string_out (a_string: STRING; a_length: INTEGER; c: CHARACTER): STRING
      --  Clone of a_string, padded on the left with
      --  c characters if a_string is less than 
      --  a_length character long;
      --  Return a new string at each call.
      --  Regexp: c{(a_length-a_string.count).max (0)}a_string

      require
         a_string_not_void: a_string /= Void;
         a_length_positive: a_length >= 0
      ensure
         left_padded_string_out_not_void: Result /= Void

feature(s) from UT_STRING_FORMATTER
   --  String handling

   append_eiffel_string (a_target: STRING; a_string: STRING)
      --  Append a_string to a_target, where all
      --  non-printable characters are replaced by their
      --  escaped character sequence as described in
      --  ETL, section 25.15, page 422.

      require
         a_target_not_void: a_target /= Void;
         a_string_not_void: a_string /= Void

   append_quoted_eiffel_string (a_target: STRING; a_string: STRING)
      --  Append a_string, surrounded by double quotes, to
      --  a_target, where all non-printable characters are
      --  replaced by their escaped character sequence as
      --  described in ETL, section 25.15, page 422.

      require
         a_target_not_void: a_target /= Void;
         a_string_not_void: a_string /= Void

   append_left_padded_string (a_target: STRING; a_string: STRING; a_length: INTEGER; c: CHARACTER)
      --  Append a_string to a_target, padded on the
      --  left with c characters if a_string is less
      --  than a_length character long.

      require
         a_target_not_void: a_target /= Void;
         a_string_not_void: a_string /= Void;
         a_length_positive: a_length >= 0

feature(s) from UT_STRING_FORMATTER
   --  File handling

   put_eiffel_string (a_file: like OUTPUT_STREAM_TYPE; a_string: STRING)
      --  Write a_string to a_file, where all
      --  non-printable characters are replaced by their
      --  escaped character sequence as described in
      --  ETL, section 25.15, page 422.

      require
         a_file_not_void: a_file /= Void;
         a_file_is_open_write: OUTPUT_STREAM_.is_open_write(a_file);
         a_string_not_void: a_string /= Void

   put_quoted_eiffel_string (a_file: like OUTPUT_STREAM_TYPE; a_string: STRING)
      --  Write a_string, surrounded by double quotes, to
      --  a_file, where all non-printable characters are
      --  replaced by their escaped character sequence as
      --  described in ETL, section 25.15, page 422.

      require
         a_file_not_void: a_file /= Void;
         a_file_is_open_write: OUTPUT_STREAM_.is_open_write(a_file);
         a_string_not_void: a_string /= Void

   put_left_padded_string (a_file: like OUTPUT_STREAM_TYPE; a_string: STRING; a_length: INTEGER; c: CHARACTER)
      --  Write a_string to a_file, padded on the
      --  left with c characters if a_string is less
      --  than a_length character long.

      require
         a_file_not_void: a_file /= Void;
         a_file_is_open_write: OUTPUT_STREAM_.is_open_write(a_file);
         a_string_not_void: a_string /= Void;
         a_length_positive: a_length >= 0


end of UT_STRING_FORMATTER