New functions - String::escape() and String::unescape()
[AXE.git] / demos / acltest.cpp
index 9cdaf04..46743a9 100644 (file)
@@ -5,7 +5,7 @@
 ***********************
 **      FILE NAME      : acltest.cpp
 **      SYSTEM NAME    : AXE - Andromeda X-windows Encapsulation
-**      VERSION NUMBER : $Revision: 1.4 $
+**      VERSION NUMBER : $Revision: 1.5 $
 **
 **  DESCRIPTION      :  Test routine for non-X classes
 **
 
 /*****************************
    $Log: acltest.cpp,v $
-   Revision 1.4  2002-09-26 14:48:46  arjen
+   Revision 1.5  2002-11-03 13:19:33  arjen
+   New functions - String::escape() and String::unescape()
+
+   Revision 1.4  2002/09/26 14:48:46  arjen
    Use the std: namespace for STL objects
 
    Revision 1.3  2002/09/02 06:18:12  arjen
@@ -37,7 +40,7 @@
 
 *****************************/
 
-static const char *RCSID = "$Id: acltest.cpp,v 1.4 2002-09-26 14:48:46 arjen Exp $";
+static const char *RCSID = "$Id: acltest.cpp,v 1.5 2002-11-03 13:19:33 arjen Exp $";
 
 #include "String.h"
 #include "integer.h" 
@@ -105,6 +108,22 @@ int main()
    String num(3737);
    std::cout << num << "\n";
 
+   std::cout << "***********************\nEscape Test\n*********************\n";
+
+   x = "\a\b\f\n\r\t\v\"'\\\xC0\x02";
+   y = x.escape();
+   std::cout << "Escaped sequence = " << y << "\n";
+   if (y.unescape() == x)
+   {
+      std::cout << "Escape sequence converts back into original string.\n";
+   }
+   else
+   {
+      std::cout << "Escape sequence does NOT convert back into original string.\n";
+      x = y.unescape();
+      std::cout << x.escape() << "\n";
+   }
+
    std::cout << "***********************\nInteger Test\n*********************\n";
    integer a(2000000000), b(2048);
    integer c;