String.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2004 X-Way Rights BV
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00023 #ifndef _CLASS_BEE_LANG_STRING_H
00024 #define _CLASS_BEE_LANG_STRING_H
00025 
00026 #include "beecrypt/api.h"
00027 
00028 #ifdef __cplusplus
00029 
00030 #include "beecrypt/c++/lang/CharSequence.h"
00031 using beecrypt::lang::CharSequence;
00032 #include "beecrypt/c++/lang/Comparable.h"
00033 using beecrypt::lang::Comparable;
00034 #include "beecrypt/c++/lang/Object.h"
00035 using beecrypt::lang::Object;
00036 #include "beecrypt/c++/array.h"
00037 using beecrypt::array;
00038 using beecrypt::bytearray;
00039 
00040 #include <iostream>
00041 #include <unicode/unistr.h>
00042 
00043 namespace beecrypt {
00044     namespace lang {
00049         class BEECRYPTCXXAPI String : public beecrypt::lang::Object, public virtual beecrypt::lang::CharSequence, public virtual beecrypt::lang::Comparable<String>
00050         {
00051             friend class Character;
00052             friend class StringBuffer;
00053             friend class StringBuilder;
00054 
00055         private:
00056             array<jchar> _value;
00057 
00058             String(array<jchar>&);
00059             String(const array<jchar>&, const array<jchar>&);
00060 
00061         public:
00062             static String valueOf(bool b);
00063             static String valueOf(jchar c);
00064             static String valueOf(jint i);
00065             static String valueOf(jlong l);
00066 
00067         public:
00068             String();
00069             String(char);
00070             String(jchar);
00071             String(const char*);
00072             String(const jchar*, jint offset, jint length);
00073             String(const bytearray&);
00074             String(const array<jchar>&);
00075             String(const String& copy);
00076             String(const UnicodeString& copy);
00077             virtual ~String() {}
00078 
00079             String& operator=(const String& copy);
00080             String& operator=(const UnicodeString& copy);
00081 
00082             virtual jchar charAt(jint index) const throw (IndexOutOfBoundsException);
00083             virtual jint compareTo(const String& str) const throw ();
00084             jint compareToIgnoreCase(const String& str) const throw ();
00085             String concat(const String& str) const throw ();
00086             bool contains(const CharSequence& seq) const throw ();
00087             bool contentEquals(const CharSequence& seq) const throw ();
00088             bool endsWith(const String& suffix) const throw ();
00089             virtual bool equals(const Object* obj) const throw ();
00090             bool equals(const String& str) const throw ();
00091             bool equalsIgnoreCase(const String& str) const throw ();
00092             virtual jint hashCode() const throw ();
00093             jint indexOf(jint ch, jint fromIndex = 0) const throw ();
00094             jint indexOf(const String& str, jint fromIndex = 0) const throw ();
00095             virtual jint length() const throw ();
00096             bool startsWith(const String& prefix, jint offset = 0) const throw ();
00097             virtual CharSequence* subSequence(jint beginIndex, jint endIndex) const throw (IndexOutOfBoundsException);
00098             String substring(jint beginIndex) const throw (IndexOutOfBoundsException);
00099             String substring(jint beginIndex, jint endIndex) const throw (IndexOutOfBoundsException);
00100             String toLowerCase() const throw ();
00101             String toUpperCase() const throw ();
00102             const array<jchar>& toCharArray() const throw ();
00103             virtual String toString() const throw ();
00104             UnicodeString toUnicodeString() const throw ();
00105         };
00106 
00107         BEECRYPTCXXAPI
00108         beecrypt::lang::String operator+(const beecrypt::lang::String& s1, const beecrypt::lang::String& s2);
00109 
00110         BEECRYPTCXXAPI
00111         bool operator<(const beecrypt::lang::String& s1, const beecrypt::lang::String& s2);
00112 
00113         BEECRYPTCXXAPI
00114         std::ostream& operator<<(std::ostream& stream, const beecrypt::lang::String& str);
00115         BEECRYPTCXXAPI
00116         std::ostream& operator<<(std::ostream& stream, const beecrypt::lang::String* str);
00117     }
00118 }
00119 
00120 #endif
00121 
00122 #endif

Generated on Fri Jun 19 13:39:40 2009 for BeeCrypt C++ by  doxygen 1.5.8