From ce89d27efb0080400873a9d921d0c18208cd8b35 Mon Sep 17 00:00:00 2001 From: arjen Date: Thu, 26 Sep 2002 14:48:46 +0000 Subject: [PATCH] Use the std: namespace for STL objects --- demos/acltest.cpp | 121 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 62 insertions(+), 59 deletions(-) diff --git a/demos/acltest.cpp b/demos/acltest.cpp index 299f655..9cdaf04 100644 --- a/demos/acltest.cpp +++ b/demos/acltest.cpp @@ -5,7 +5,7 @@ *********************** ** FILE NAME : acltest.cpp ** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation -** VERSION NUMBER : $Revision: 1.3 $ +** VERSION NUMBER : $Revision: 1.4 $ ** ** DESCRIPTION : Test routine for non-X classes ** @@ -22,7 +22,10 @@ /***************************** $Log: acltest.cpp,v $ - Revision 1.3 2002-09-02 06:18:12 arjen + 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 Fixed some date and time conversion functions Revision 1.2 2002/07/27 06:34:06 arjen @@ -34,7 +37,7 @@ *****************************/ -static const char *RCSID = "$Id: acltest.cpp,v 1.3 2002-09-02 06:18:12 arjen Exp $"; +static const char *RCSID = "$Id: acltest.cpp,v 1.4 2002-09-26 14:48:46 arjen Exp $"; #include "String.h" #include "integer.h" @@ -45,128 +48,128 @@ int main() String hello = "Hello there"; String points, pattern; - cout << hello << ",length= " << ~hello << "\n"; - cout << "4th character = " << hello[3] << " (Changed to L)\n"; + std::cout << hello << ",length= " << ~hello << "\n"; + std::cout << "4th character = " << hello[3] << " (Changed to L)\n"; hello[3] = 'L'; if ((char *)points) - cout << "Points is not empty\n"; + std::cout << "Points is not empty\n"; if (!points) - cout << "Points is empty\n"; + std::cout << "Points is empty\n"; points = "123456"; if ((char *)points) - cout << "after assignment: Points is not empty\n"; + std::cout << "after assignment: Points is not empty\n"; if (!points) - cout << "after assignment: points is empty\n"; + std::cout << "after assignment: points is empty\n"; hello += points + String("!??"); - cout << "Catenated: " << hello << ",length= " << ~hello << "\n"; + std::cout << "Catenated: " << hello << ",length= " << ~hello << "\n"; - cout << "Substring(10,3) = " << String(hello(10,3)) << "\n"; + std::cout << "Substring(10,3) = " << String(hello(10,3)) << "\n"; hello(10,3) = points; - cout << "hello(10,3)=points ->hello = " << hello << "\n"; - cout << "Substring(8,9) = " << String(hello(8,9)) << "\n"; + std::cout << "hello(10,3)=points ->hello = " << hello << "\n"; + std::cout << "Substring(8,9) = " << String(hello(8,9)) << "\n"; - cout << "Converted to upper case: " << hello.upper() << "\n"; - cout << "Converted to lower case: " << hello.lower() << "\n"; + std::cout << "Converted to upper case: " << hello.upper() << "\n"; + std::cout << "Converted to lower case: " << hello.lower() << "\n"; hello(8,9) = "__"; - cout << "hello(8,9)=__ ->hello = " << hello << "\n"; + std::cout << "hello(8,9)=__ ->hello = " << hello << "\n"; hello(8,7) = ""; - cout << "Removing with hello(8,7) = \"\": " << hello << "\n"; + std::cout << "Removing with hello(8,7) = \"\": " << hello << "\n"; hello(8,0) = "ere "; - cout << "Inserting with hello(8,0) = \"ere \": " << hello << "\n"; + std::cout << "Inserting with hello(8,0) = \"ere \": " << hello << "\n"; hello(5, ~hello-5) = ""; - cout << "Truncating with hello(5, ~hello-5) = \"\": " << hello << "\n"; + std::cout << "Truncating with hello(5, ~hello-5) = \"\": " << hello << "\n"; - cout << "String shifting:\n"; + std::cout << "String shifting:\n"; String x("abcdefgh"); String y; y = x << 3; - cout << x << " << 3 = " << y << "\n"; + std::cout << x << " << 3 = " << y << "\n"; y = x >> 3; - cout << x << " >> 3 = " << y << "\n"; + std::cout << x << " >> 3 = " << y << "\n"; - cout << "\nInput a string:\n"; + std::cout << "\nInput a string:\n"; cin >> hello; - cout << hello << "\n\n"; - cout << "\nAnd another one:\n"; + std::cout << hello << "\n\n"; + std::cout << "\nAnd another one:\n"; cin >> pattern; - cout << pattern << "\n\n"; - cout << "Second string found at position " << pattern.in(hello); - cout << " of first string.\n"; + std::cout << pattern << "\n\n"; + std::cout << "Second string found at position " << pattern.in(hello); + std::cout << " of first string.\n"; - cout << "Construct a string from an int: "; + std::cout << "Construct a string from an int: "; String num(3737); - cout << num << "\n"; + std::cout << num << "\n"; - cout << "***********************\nInteger Test\n*********************\n"; + std::cout << "***********************\nInteger Test\n*********************\n"; integer a(2000000000), b(2048); integer c; - cout << "a = " << a << ", b = " << b << "\n"; - cout << "c = " << c << "\n"; + std::cout << "a = " << a << ", b = " << b << "\n"; + std::cout << "c = " << c << "\n"; c = b; - cout << "c = b : c = " << c << "\n"; + std::cout << "c = b : c = " << c << "\n"; - cout << "***********************\nDate Test\n*********************\n"; + std::cout << "***********************\nDate Test\n*********************\n"; date d1, d2(22,7,1964); - cout << "Default constructor: " << d1 << ", with (d,m,y): " << d2 << "\n"; - cout << "Enter a date: \n"; + std::cout << "Default constructor: " << d1 << ", with (d,m,y): " << d2 << "\n"; + std::cout << "Enter a date: \n"; String datestring; cin >> datestring; d2 = date(datestring); - cout << datestring << " parses into (DD-MM-YYYY): " << d2 << "\n"; + std::cout << datestring << " parses into (DD-MM-YYYY): " << d2 << "\n"; datestring = d2.format("%F"); - cout << "Formatted date: " << datestring << "\n"; + std::cout << "Formatted date: " << datestring << "\n"; d1 = today(); - cout << "Size of a date is " << sizeof(d1) << "\n"; + std::cout << "Size of a date is " << sizeof(d1) << "\n"; - cout << "365 days after " << d2 << " is " << d2 + 365 << "\n"; + std::cout << "365 days after " << d2 << " is " << d2 + 365 << "\n"; date d3(0,0,0); d3 += 365; - cout << "365 days was converted to " << d3 << "\n"; - cout << "Added to the date you entered: " << d2 + d3 << "\n"; + std::cout << "365 days was converted to " << d3 << "\n"; + std::cout << "Added to the date you entered: " << d2 + d3 << "\n"; - cout << d2 << " == " << d1 << " is " << (d2 == d1) << "\n"; - cout << d2 << " != " << d1 << " is " << (d2 != d1) << "\n"; - cout << d2 << " >= " << d1 << " is " << (d2 >= d1) << "\n"; - cout << d2 << " <= " << d1 << " is " << (d2 <= d1) << "\n"; - cout << d2 << " > " << d1 << " is " << (d2 > d1) << "\n"; - cout << d2 << " < " << d1 << " is " << (d2 < d1) << "\n"; + std::cout << d2 << " == " << d1 << " is " << (d2 == d1) << "\n"; + std::cout << d2 << " != " << d1 << " is " << (d2 != d1) << "\n"; + std::cout << d2 << " >= " << d1 << " is " << (d2 >= d1) << "\n"; + std::cout << d2 << " <= " << d1 << " is " << (d2 <= d1) << "\n"; + std::cout << d2 << " > " << d1 << " is " << (d2 > d1) << "\n"; + std::cout << d2 << " < " << d1 << " is " << (d2 < d1) << "\n"; - cout << "difference is " << d2 - d1 << " days.\n\n"; + std::cout << "difference is " << d2 - d1 << " days.\n\n"; - cout << "***********************\nTime Test\n*********************\n"; + std::cout << "***********************\nTime Test\n*********************\n"; hour t1, t2; - cout << "Default constructor: " << t1 << "\n"; + std::cout << "Default constructor: " << t1 << "\n"; t1 = hour(10, 50, 30); - cout << "With 10,50,30: " << t1 << "\n"; - cout << "Enter a time: \n"; + std::cout << "With 10,50,30: " << t1 << "\n"; + std::cout << "Enter a time: \n"; cin >> datestring; t2 = hour(datestring); - cout << datestring << " parses into (HH:MM:SS): " << t2 << "\n"; + std::cout << datestring << " parses into (HH:MM:SS): " << t2 << "\n"; - cout << "t1 + t2 = " << t1 + t2 << "\n"; - cout << "t1 - t2 = " << t1 - t2 << "\n"; - cout << "t2 - t1 = " << t2 - t1 << "\n"; + std::cout << "t1 + t2 = " << t1 + t2 << "\n"; + std::cout << "t1 - t2 = " << t1 - t2 << "\n"; + std::cout << "t2 - t1 = " << t2 - t1 << "\n"; d1 = today(); t1 = now(); - cout << "\nThe time now is " << d1 << " " << t1 << "\n"; + std::cout << "\nThe time now is " << d1 << " " << t1 << "\n"; return 0; } -- 2.11.0