StringPimpl.h

00001 #ifndef REBECCA_STRINGPIMPL_H
00002 #define REBECCA_STRINGPIMPL_H
00003 
00004 /*
00005  * RebeccaAIML, Artificial Intelligence Markup Language 
00006  * C++ api and engine.
00007  *
00008  * Copyright (C) 2005,2006,2007 Frank Hassanabad
00009  *
00010  * This file is part of RebeccaAIML.
00011  *
00012  * RebeccaAIML is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 3 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * RebeccaAIML is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00024  */
00025 
00026 
00027 //To get the REBECA_EXPORT macro
00028 #include <rebecca/exports.h>
00029 #include <rebecca/Exceptions.h>
00030 
00031 //To get the size_t for the deletions
00032 #include <cstddef>
00033 
00034 /* Disable Windows VC 7.x warning about 
00035  * it ignoring the throw specification
00036  */
00037 #ifdef _WIN32
00038 #    pragma warning ( push )
00039 #    pragma warning( disable : 4290 )
00040 #endif
00041 
00042 
00043 //See AimlFacade for the explanation of this namespace
00044 namespace rebecca
00045 {
00046 //See AimlFacade for the explanation of this namespace
00047 namespace impl
00048 {
00049 
00050 
00051 
00052 /*
00053  * The private string which I do not expose.
00054  * 
00055  * This forward decleration is so that the code will 
00056  * compile but the true string is kept private within
00057  * this class.
00058  */ 
00059 class StringPrivate;
00060 
00082 class REBECCA_EXPORT StringPimpl
00083 {
00084     public:
00085 
00097         StringPimpl() 
00098             throw(Exception &);
00099 
00114         StringPimpl(const char * const stringPimpl) 
00115             throw(Exception &);
00116         
00129         const char *c_str() const 
00130             throw(Exception &);
00131 
00143         bool empty() const 
00144             throw(Exception &);
00145 
00156         StringPimpl(const StringPimpl& stringPimpl);
00157 
00168         StringPimpl &operator=(const StringPimpl &stringPimpl);
00169 
00178         virtual ~StringPimpl();
00179         
00202         void operator delete(void* p);
00203 
00228         void *operator new(size_t size);
00229 
00231 
00238         StringPimpl& operator+=(const StringPimpl &s);
00239 
00246         StringPimpl& operator+=(const char *s);
00247 
00257         bool operator!=(const char *s) const;
00258 
00268         StringPimpl operator+(const char *s) const;
00269 
00279         bool operator==(const StringPimpl &s) const;
00280         
00290         bool operator==(const char *s) const;
00291 
00302         bool startsWith(const StringPimpl &right) const;
00303 
00312         int getInteger() const
00313             throw(NumberFormatException &);
00314 
00329         bool existsAsAFile() const
00330             throw();
00331 
00346         bool existsAsADirectory() const
00347             throw();
00348         
00362         void transformIntoAbsoluteFilePath() const
00363             throw();
00364 
00373         StringPimpl operator+(const StringPimpl &s) const;
00374 
00383         StringPimpl &operator=(const char *c);
00384 
00393         StringPimpl &operator=(const char c);
00394 
00400         unsigned int size() const;
00401 
00407         unsigned int length() const;
00408 
00419         char at(const unsigned int i) const;
00420 
00430         bool operator<(const StringPimpl& s) const;
00431 
00441         bool operator!=(const StringPimpl &s) const;
00442 
00450         void push_back(char c);
00451 
00455         void clear();
00456     
00464         StringPimpl &transformToUpperCase()
00465             throw();
00466 
00474         StringPimpl &transformToLowerCase()
00475             throw();
00476 
00486         StringPimpl &transformByTrimmingWhiteSpace()
00487             throw();
00488 
00496         StringPimpl &transformFirstCharacterUpperCase()
00497             throw();
00498 
00507         StringPimpl &transformByTrimmingLeft()
00508             throw();
00509 
00518         StringPimpl &transformByTrimmingRight()
00519             throw();
00520 
00533         StringPimpl &transformByTrimmingExcessSpaces()
00534             throw();
00535 
00543         void removePunctuation(const StringPimpl &sentenceSplitters)
00544             throw();
00545     
00556         static StringPimpl getString(int number)
00557             throw(NumberFormatException &);
00558 
00559     private:
00560 
00571         void init(const char * const stringPimpl);
00572         
00580         StringPrivate *m_pimpl;
00581 };
00582 
00583 } //end namespace impl
00584 
00585 //expose StringPimpl to Rebecca namespace 
00586 using rebecca::impl::StringPimpl;
00587 
00598 REBECCA_EXPORT bool operator==(const char *c, const StringPimpl &s);
00599 
00611 REBECCA_EXPORT StringPimpl operator+(const char *c, const StringPimpl &s);
00612 
00613 } //end namespace rebecca
00614 
00615 #ifdef _WIN32
00616 #    pragma warning ( pop )
00617 #endif
00618 
00619 
00620 
00621 
00622 
00623 #endif

Generated on Mon Aug 27 12:26:58 2007 for RebeccaAIML by  doxygen 1.5.3