ionflux.org | Impressum

StringManipulator.hpp

Go to the documentation of this file.
00001 #ifndef IONFLUX_TOOLS_STRINGMANIPULATOR
00002 #define IONFLUX_TOOLS_STRINGMANIPULATOR
00003 /* ==========================================================================
00004  * Ionflux Tools
00005  * Copyright (c) 2004 Joern P. Meier
00006  * mail@ionflux.org
00007  * --------------------------------------------------------------------------
00008  * StringManipulator.hpp                    String manipulators.
00009  * ==========================================================================
00010  * 
00011  * This file is part of Ionflux Tools.
00012  * 
00013  * Ionflux Tools is free software; you can redistribute it and/or modify it 
00014  * under the terms of the GNU General Public License as published by the Free
00015  * Software Foundation; either version 2 of the License, or (at  your option)
00016  * any later version.
00017  * 
00018  * Ionflux Tools is distributed in the hope that it will be useful, but 
00019  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00020  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00021  * for more details.
00022  * 
00023  * You should have received a copy of the GNU General Public License
00024  * along with Ionflux Tools; if not, write to the Free Software Foundation, 
00025  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00026  * 
00027  * ========================================================================== */
00028 
00029 #include <iostream>
00030 #include <string>
00031 #include <vector>
00032 #include <sstream>
00033 #include <iomanip>
00034 #include <cctype>
00035 #include <ionflux/tools.hpp>
00036 
00037 namespace Ionflux
00038 {
00039 
00040 namespace Tools
00041 {
00042 
00055 class StringManipulator
00056 {
00057     public:
00062         StringManipulator() { };
00063         
00068         virtual ~StringManipulator() { };
00069         
00079         virtual std::string process(const std::string& bytes, 
00080             std::vector<std::string>* args = 0) = 0;
00081         
00086         virtual std::string getName() = 0;
00087         
00088 };
00089 
00096 class StringUppercase
00097 : public StringManipulator
00098 {
00099     public:
00101         static const std::string STRINGMANIP_NAME;
00102         
00104         StringUppercase() { };
00105         
00107         virtual ~StringUppercase() { };
00108         
00118         virtual std::string process(const std::string& bytes, 
00119             std::vector<std::string>* args = 0);
00120         
00125         virtual std::string getName();
00126         
00127 };
00128 
00135 class StringLowercase
00136 : public StringManipulator
00137 {
00138     public:
00140         static const std::string STRINGMANIP_NAME;
00141         
00143         StringLowercase() { };
00144         
00146         virtual ~StringLowercase() { };
00147         
00157         virtual std::string process(const std::string& bytes, 
00158             std::vector<std::string>* args = 0);
00159         
00164         virtual std::string getName();
00165         
00166 };
00167 
00174 class StringErase
00175 : public StringManipulator
00176 {
00177     public:
00179         static const std::string STRINGMANIP_NAME;
00180         
00182         StringErase() { };
00183         
00185         virtual ~StringErase() { };
00186         
00196         virtual std::string process(const std::string& bytes, 
00197             std::vector<std::string>* args = 0);
00198         
00203         virtual std::string getName();
00204         
00205 };
00206 
00214 class StringReplace
00215 : public StringManipulator
00216 {
00217     public:
00219         static const std::string STRINGMANIP_NAME;
00220         
00222         StringReplace() { };
00223         
00225         virtual ~StringReplace() { };
00226         
00236         virtual std::string process(const std::string& bytes, 
00237             std::vector<std::string>* args = 0);
00238         
00243         virtual std::string getName();
00244         
00245 };
00246 
00253 class StringTrim
00254 : public StringManipulator
00255 {
00256     public:
00258         static const std::string STRINGMANIP_NAME;
00259         
00261         StringTrim() { };
00262         
00264         virtual ~StringTrim() { };
00265         
00275         virtual std::string process(const std::string& bytes, 
00276             std::vector<std::string>* args = 0);
00277         
00282         virtual std::string getName();
00283         
00284 };
00285 
00292 class StringLTrim
00293 : public StringManipulator
00294 {
00295     public:
00297         static const std::string STRINGMANIP_NAME;
00298         
00300         StringLTrim() { };
00301         
00303         virtual ~StringLTrim() { };
00304         
00314         virtual std::string process(const std::string& bytes, 
00315             std::vector<std::string>* args = 0);
00316         
00321         virtual std::string getName();
00322         
00323 };
00324 
00331 class StringRTrim
00332 : public StringManipulator
00333 {
00334     public:
00336         static const std::string STRINGMANIP_NAME;
00337         
00339         StringRTrim() { };
00340         
00342         virtual ~StringRTrim() { };
00343         
00353         virtual std::string process(const std::string& bytes, 
00354             std::vector<std::string>* args = 0);
00355         
00360         virtual std::string getName();
00361         
00362 };
00363 
00374 class StringTruncate
00375 : public StringManipulator
00376 {
00377     public:
00379         static const std::string STRINGMANIP_NAME;
00380         
00382         StringTruncate() { };
00383         
00385         virtual ~StringTruncate() { };
00386         
00396         virtual std::string process(const std::string& bytes, 
00397             std::vector<std::string>* args = 0);
00398         
00403         virtual std::string getName();
00404         
00405 };
00406 
00415 class StringCenter
00416 : public StringManipulator
00417 {
00418     public:
00420         static const std::string STRINGMANIP_NAME;
00421         
00423         StringCenter() { };
00424         
00426         virtual ~StringCenter() { };
00427         
00437         virtual std::string process(const std::string& bytes, 
00438             std::vector<std::string>* args = 0);
00439         
00444         virtual std::string getName();
00445         
00446 };
00447 
00456 class StringMove
00457 : public StringManipulator
00458 {
00459     public:
00461         static const std::string STRINGMANIP_NAME;
00462         
00464         StringMove() { };
00465         
00467         virtual ~StringMove() { };
00468         
00478         virtual std::string process(const std::string& bytes, 
00479             std::vector<std::string>* args = 0);
00480         
00485         virtual std::string getName();
00486         
00487 };
00488 
00495 class StringAppend
00496 : public StringManipulator
00497 {
00498     public:
00500         static const std::string STRINGMANIP_NAME;
00501         
00503         StringAppend() { };
00504         
00506         virtual ~StringAppend() { };
00507         
00517         virtual std::string process(const std::string& bytes, 
00518             std::vector<std::string>* args = 0);
00519         
00524         virtual std::string getName();
00525         
00526 };
00527 
00535 class StringInsert
00536 : public StringManipulator
00537 {
00538     public:
00540         static const std::string STRINGMANIP_NAME;
00541         
00543         StringInsert() { };
00544         
00546         virtual ~StringInsert() { };
00547         
00557         virtual std::string process(const std::string& bytes, 
00558             std::vector<std::string>* args = 0);
00559         
00564         virtual std::string getName();
00565         
00566 };
00567 
00576 class StringNumFormat
00577 : public StringManipulator
00578 {
00579     public:
00581         static const std::string STRINGMANIP_NAME;
00582         
00584         StringNumFormat() { };
00585         
00587         virtual ~StringNumFormat() { };
00588         
00598         virtual std::string process(const std::string& bytes, 
00599             std::vector<std::string>* args = 0);
00600         
00605         virtual std::string getName();
00606         
00607 };
00608 
00616 class StringTranslate
00617 : public StringManipulator
00618 {
00619     public:
00621         static const std::string STRINGMANIP_NAME;
00622         
00624         StringTranslate() { };
00625         
00627         virtual ~StringTranslate() { };
00628         
00638         virtual std::string process(const std::string& bytes, 
00639             std::vector<std::string>* args = 0);
00640         
00645         virtual std::string getName();
00646         
00647 };
00648 
00656 class StringSubstr
00657 : public StringManipulator
00658 {
00659     public:
00661         static const std::string STRINGMANIP_NAME;
00662         
00664         StringSubstr() { };
00665         
00667         virtual ~StringSubstr() { };
00668         
00678         virtual std::string process(const std::string& bytes, 
00679             std::vector<std::string>* args = 0);
00680         
00685         virtual std::string getName();
00686         
00687 };
00688 
00696 class StringLPad
00697 : public StringManipulator
00698 {
00699     public:
00701         static const std::string STRINGMANIP_NAME;
00702         
00704         StringLPad() { };
00705         
00707         virtual ~StringLPad() { };
00708         
00718         virtual std::string process(const std::string& bytes, 
00719             std::vector<std::string>* args = 0);
00720         
00725         virtual std::string getName();
00726         
00727 };
00728 
00736 class StringRPad
00737 : public StringManipulator
00738 {
00739     public:
00741         static const std::string STRINGMANIP_NAME;
00742         
00744         StringRPad() { };
00745         
00747         virtual ~StringRPad() { };
00748         
00758         virtual std::string process(const std::string& bytes, 
00759             std::vector<std::string>* args = 0);
00760         
00765         virtual std::string getName();
00766         
00767 };
00768 
00777 class StringSWrap
00778 : public StringManipulator
00779 {
00780     public:
00782         static const std::string STRINGMANIP_NAME;
00783         
00785         StringSWrap() { };
00786         
00788         virtual ~StringSWrap() { };
00789         
00799         virtual std::string process(const std::string& bytes, 
00800             std::vector<std::string>* args = 0);
00801         
00806         virtual std::string getName();
00807         
00808 };
00809 
00816 class StringXMLEscape
00817 : public StringManipulator
00818 {
00819     public:
00821         static const std::string STRINGMANIP_NAME;
00822         
00824         StringXMLEscape() { };
00825         
00827         virtual ~StringXMLEscape() { };
00828         
00838         virtual std::string process(const std::string& bytes, 
00839             std::vector<std::string>* args = 0);
00840         
00845         virtual std::string getName();
00846         
00847 };
00848 
00855 class StringURLEncode
00856 : public StringManipulator
00857 {
00858     public:
00860         static const std::string STRINGMANIP_NAME;
00861         
00863         StringURLEncode() { };
00864         
00866         virtual ~StringURLEncode() { };
00867         
00877         virtual std::string process(const std::string& bytes, 
00878             std::vector<std::string>* args = 0);
00879         
00884         virtual std::string getName();
00885         
00886 };
00887 
00888 }
00889 
00890 }
00891 
00895 #endif

Generated on Tue Mar 14 20:58:30 2006 for Ionflux Tools Class Library (iftools) by  doxygen 1.4.6