Cleanup classes that are moved to ACL
[AXE.git] / src / String.h
diff --git a/src/String.h b/src/String.h
deleted file mode 100644 (file)
index a9b7177..0000000
+++ /dev/null
@@ -1,383 +0,0 @@
-/**************************************************************************
-**  (c) Copyright 1997, Andromeda Technology & Automation
-***************************************************************************
-** MODULE INFORMATION *
-***********************
-**      FILE NAME      : String.h
-**      SYSTEM NAME    : Andromeda X-Windows Encapsulation
-**      VERSION NUMBER : $Revision: 1.4 $
-**
-**  DESCRIPTION      :  Character String class definition
-**
-**  EXPORTED OBJECTS : class String
-**  LOCAL    OBJECTS : class substring
-**  MODULES  USED    :
-***************************************************************************
-**  ADMINISTRATIVE INFORMATION *
-********************************
-**      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
-**      CREATION DATE   : Nov 17, 1995
-**      LAST UPDATE     : Mar 31, 2010
-**      MODIFICATIONS   : 
-**************************************************************************/
-
-/*****************************
-   $Log: String.h,v $
-   Revision 1.4  2007/05/04 13:56:05  arjen
-   Added a copy contructor to the regex class. This prevents multiple frees in the destructor.
-
-   Revision 1.3  2002/11/03 13:18:57  arjen
-   New functions - String::escape() and String::unescape()
-
-   Revision 1.2  2002/09/28 06:45:51  arjen
-   New feature: subtring selection by regular expression.
-   Bugfix: use the std: namespace for STL classes istream and ostream
-
-   Revision 1.1  2002/07/25 08:01:26  arjen
-   First checkin, AXE release 0.2
-
-*****************************/
-
-// static const char RCSID[] = "$Id: String.h,v 1.4 2007/05/04 13:56:05 arjen Exp $";
-
-#ifndef STRING_H
-#define STRING_H
-
-#include <stdlib.h>
-#include <iostream>
-#include <string.h>
-
-#include <regex.h>
-
-//  Forward declarations.
-class substring;
-class regex;
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-**  NAME           : String - Character String class.
-**  MEMBERS        : p -> s : Pointer to the actual String data.
-**                   p -> n : Number of references to this String.
-**  OPERATORS      : =      : Assign a String, char *, char to a String.
-**                   +, +=  : concatenate Strings
-**                   ~      : Length of a String
-**                   []     : Individual character access.
-**                   !      : Empty String test.
-**                   ()     : Substring selection.
-**                   ostream << : String to output stream.
-**                   istream << : String from input stream.
-**                   ==, !=, <,
-**                   >, <=, >= : String comparison.
-**  METHODS        :
-**
-**  DESCRIPTION    : The String class counts the references to a String to
-**                   minimize copying and uses standard C++ character strings
-**                   as constants.
-**
-**  RELATIONS      : substring
-**  SEE ALSO       :
-**  LAST MODIFIED  : Aug 27, 1999
-**+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-*/
-
-class String
-{
-   friend class substring;
-   friend class regex;
-
-   struct srep
-   {
-      char  *s;    // pointer to data;
-      int    n;    // reference count
-   } *p;
-
-public:
-
-   String(const char *);      // String x = "abc"
-   String(char);              // String x = 'a'
-   String();                  // String x;
-   String(const String &);    // String x = String ...
-   String(const substring &); // String x = String(s, l)
-
-   String& operator=(const char);
-   String& operator=(const char *);
-   String& operator=(const String &);
-   ~String();
-
-   /*  Numerical conversion */
-
-   String(long);             //  String x(12);  x = "12"
-   String(unsigned long);    //  String x(12);  x = "12"
-   String(int);              //  String x(12);  x = "12"
-   operator long()
-   {
-      return strtol(p->s, 0, 0);
-   }
-
-   operator unsigned long()
-   {
-      return strtoul(p->s, 0, 0);
-   }
-
-   long dec(void)
-   {
-      return strtol(p->s, 0, 10);
-   }
-
-   long oct(void)
-   {
-      return strtol(p->s, 0, 8);
-   }
-
-   long hex(void) 
-   {
-      return strtol(p->s, 0, 16);
-   }
-
-   String(double);
-   operator double()
-   {
-      return strtod(p->s, 0);
-   }
-
-   /*     */
-
-   char& operator[](int i);    //  Individual character access
-
-   int operator~() const      //  Length of the String
-   {
-      return strlen(p->s);
-   }
-
-   operator char*()
-   {
-      if (p->s && p->s[0])
-         return p->s;
-      else
-         return 0;
-   }
-   operator const char*() const
-   {
-      if (p->s && p->s[0])
-         return p->s;
-      else
-         return 0;
-   }
-
-   operator bool()   //  Test for empty String
-   {
-      return p->s != 0 && p->s[0] != '\0';
-   }
-
-   /*
-    *   String concatenation.
-    *   char and char* are handled by constructors.
-    */
-
-   String& operator+=(const String&);
-   String& operator+=(const char *);
-   friend String operator+(const String&, const String&);
-   friend String operator+(const String&, const char *);
-   friend String operator+(const char *,  const String&);
-
-   /*
-    *  Shifting characters out
-    *            "abcdefgh" <<= 3  = "defgh"
-    *            "abcdefgh" >>= 3  = "abcde"
-    */
-
-   friend String operator<<(const String &x, int n);
-   String & operator<<=(int n);
-
-   friend String operator>>(const String &x, int n);
-   String & operator>>=(int n);
-
-   /*
-    *   Substring selection
-    *
-    *   A substring can be selected by a start index and a length or
-    *   by matching a regular expression.
-    *
-    *   Selecting a substring by regular expression, combined with
-    *   the lvalue semantics of the substring class is a particularly
-    *   powerful concept. Possible uses are for example:
-    *
-    *   (assuming String S, M; regex R;)
-    *   M = S(R);             ->  Returns matching part of S into M.
-    *   S(R) = "replacement"; -> replace matching part of S.
-    *   S(R) = "";            -> Removes matching part from S.
-    *   S(R) == S;            -> true if and only if all of S matches R exactly.
-    */
-
-   substring operator()(int start, int len);
-   substring operator()(const regex &r);
-
-   /*
-    *   Input and output
-    */
-
-   friend std::ostream& operator<<(std::ostream &, const String &);
-   friend std::istream& operator>>(std::istream &, String &);
-
-   /*
-    *   String comparison tests
-    */
-
-   friend int operator==(const String& x, const String& y)
-   {
-      return strcmp(x.p->s, y.p->s) == 0;
-   }
-
-   friend int operator!=(const String& x, const String& y)
-   {
-      return strcmp(x.p->s, y.p->s) != 0;
-   }
-
-   friend int operator<=(const String& x, const String& y)
-   {
-      return strcmp(x.p->s, y.p->s) <= 0;
-   }
-
-   friend int operator>=(const String& x, const String& y)
-   {
-      return strcmp(x.p->s, y.p->s) >= 0;
-   }
-
-   friend int operator<(const String& x, const String& y)
-   {
-      return strcmp(x.p->s, y.p->s) < 0;
-   }
-
-   friend int operator>(const String& x, const String& y)
-   {
-      return strcmp(x.p->s, y.p->s) > 0;
-   }
-
-   friend int operator==(const String& x, const char * y)
-   {
-      return strcmp(x.p->s, y) == 0;
-   }
-
-   friend int operator!=(const String& x, const char * y)
-   {
-      return strcmp(x.p->s, y) != 0;
-   }
-
-   friend int operator<=(const String& x, const char * y)
-   {
-      return strcmp(x.p->s, y) <= 0;
-   }
-
-   friend int operator>=(const String& x, const char * y)
-   {
-      return strcmp(x.p->s, y) >= 0;
-   }
-
-   friend int operator<(const String& x, const char * y)
-   {
-      return strcmp(x.p->s, y) < 0;
-   }
-
-   friend int operator>(const String& x, const char * y)
-   {
-      return strcmp(x.p->s, y) > 0;
-   }
-
-   /*
-    *  Modifiers
-    */
-
-   String upper();   //  Convert to upper case (ASCII)
-   String lower();   //  Convert to lower case (ASCII)
-   String escape();   //  Insert backslashes to escape special characters
-   String unescape(); //  Remove backslashes from escape codes.
-
-   /*
-    *  Character searching and Pattern matching
-    */
-
-   int index(char c);
-   int rindex(char c);
-
-   int in(String & x);
-
-   //  Regular expression pattern matching
-   friend bool operator == (const String &s, const regex &r);
-   friend bool operator == (const regex &r, const String &s);
-};
-   /*
-    *   Other operators to think about...
-    *
-    *
-    *   Numeric conversion with strtod and strtol and vice-versa,
-    *   so we can do:
-    *                 String nr = 123  //  nr = "123"
-    *                 float x = 2.32; String f = x;  // f = "2.32"
-    *                             f = "3.145";
-    *                         int i = f;           // i = 3
-    *
-    *   String matching:
-    *       int index(String&, start=0)  // Find position of substring
-    *
-    *
-    *  Literature:  Bjarne Stroustrup, Section 6.9
-    *               DDJ October 1991, pg 24
-    */
-
-
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-**  NAME           : substring - Determine part of a String object.
-**  MEMBERS        : str   : The String object of which this is a substring
-**                   start : index of the first substring character.
-**                   len   : Number of characters in the substring
-**  OPERATORS      : =     : Assignment of a String or char *
-**  METHODS        :
-**
-**  DESCRIPTION    : This implements substring selection from a String object
-**                   with l-value semantics.
-**
-**  RELATIONS      : String
-**  SEE ALSO       :
-**  LAST MODIFIED  :
-**+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-*/
-
-class substring
-{
-   friend class String;
-
-   String     *str;   //  Where I am a substring of.
-   int  start, len;
-
-public:
-   String& operator=(const String &); 
-   String& operator=(const char *s)
-   {
-      *this = String(s);
-      return *str;
-   }
-};
-
-/*  Regular expression matching */
-
-class regex
-{
-   friend class String;
-
-   regex_t    expression;
-   String     original;
-
-public:
-
-   regex(const String & reg);
-   regex(const char * reg);
-   regex(const regex & reg);
-   ~regex();
-
-   regex& operator=(const regex &);
-
-   friend bool operator == (const String &s, const regex &r);
-   friend bool operator == (const regex &r, const String &s);
-};
-
-#endif  /* STRING_H */