Natools

natools-string_escapes.ads at [46b1fe3862]
Login

File src/natools-string_escapes.ads artifact a3cb74363f part of check-in 46b1fe3862


------------------------------------------------------------------------------
-- Copyright (c) 2016, Natacha Porté                                        --
--                                                                          --
-- Permission to use, copy, modify, and distribute this software for any    --
-- purpose with or without fee is hereby granted, provided that the above   --
-- copyright notice and this permission notice appear in all copies.        --
--                                                                          --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR  --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES   --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN    --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.           --
------------------------------------------------------------------------------

------------------------------------------------------------------------------
-- Natools.String_Escapes provides escaping and unescaping for Strings in   --
-- various formats.                                                         --
------------------------------------------------------------------------------

package Natools.String_Escapes is
   pragma Pure;

   function C_Escape_Hex
     (S : String;
      Add_Quotes : Boolean := False)
     return String;
      --  Replace non-ASCII-printable characters of S with C-style escapes,
      --  either two-character (like "\n") or hexadecimal four-character
      --  (like "\xC3").
      --  Add double quotes at the beginning and end if Add_Quotes.

end Natools.String_Escapes;