Remove String->const char* conversion operator in favor of c_str method
[clinton/bobotpp.git] / source / String.H
CommitLineData
c1dcc495 1// String.H -*- C++ -*-
2// Copyright (c) 1997, 1998 Etienne BERNARD
3// Copyright (c) 2002.2003,2005 Clinton Ebadi
4
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation; either version 2 of the License, or
8// any later version.
9
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
39b022cb 17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
c1dcc495 18
19#ifndef BSTRING_H
20#define BSTRING_H
21
22#include <iostream>
23#include <string>
24
25class String {
26
005c31fb 27 std::string my_string;
28
c1dcc495 29public:
30 String();
31 String(const char *);
32 String(const String &);
33 String(const std::string &);
34 String(long);
35 String(char);
36
37 String & operator=(const char *);
38 String & operator=(const String &);
39 String & operator=(const std::string &);
40
41 ~String();
42
43 int length() const;
44 int find(char);
45 void fill(char);
46 String pad(int);
47
48 String subString(int);
49 String subString(int, int);
50
51 String substr(int);
52 String substr(int, int);
53
54 String toLower();
55 String toUpper();
56 String trim();
57 int indexOf(char);
58
59 char & operator[](int);
60 const char & operator[](int) const;
61
62 bool operator==(const char *) const;
63 bool operator==(const String &) const;
64 bool operator==(const std::string &) const;
65
66 bool operator!=(const char *) const;
67 bool operator!=(const String &) const;
68 bool operator!=(const std::string &) const;
69
70 bool operator<(const String &) const;
71 bool operator>(const String &) const;
72 bool operator<(const std::string &) const;
73
74 bool operator<=(const String &) const;
75 bool operator<=(const std::string &) const;
76 bool operator>=(const String &) const;
77 bool operator>=(const std::string &) const;
78
79 String operator+(const char *);
80 String operator+(const String &);
81 String operator+(const std::string &);
82
83 friend std::string operator+(const std::string &, const String &);
84
815a1816 85 const char* c_str () const;
c1dcc495 86 operator std::string () const;
87
88 friend std::ostream & operator<<(std::ostream &, const String &);
89 friend std::istream & operator>>(std::istream &, String &);
90};
91
92bool operator==(const std::string &, const String &);
93bool operator!=(const std::string &, const String &);
94bool operator>(const std::string &, const String &);
95bool operator<(const std::string &, const String &);
96bool operator<=(const std::string &, const String &);
97bool operator>=(const std::string &, const String &);
98
99#endif