Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members

it_bus/stream_transformer.h

00001 #ifndef _STRING_TEMPLATE_PROCESSOR_H_
00002 #define _STRING_TEMPLATE_PROCESSOR_H_
00003 
00004 //
00005 //      Copyright (c) 2002 IONA Technologies PLC. All Rights Reserved.
00006 // 
00007 //
00008 
00009 #include <it_dsa/vector.h>
00010 #include <it_bus/string_map.h>
00011 #include <it_bus/types.h>
00012 #include <it_bus/binary_buffer.h>
00013 #include <it_bus/exception.h>
00014 
00015 namespace IT_Bus
00016 {
00017         class IT_AFC_API StreamTransformerException :
00018             public Exception
00019         {
00020           public:
00021             StreamTransformerException(
00022                 const char * desc1 = 0,
00023                 const char * desc2 = 0,
00024                 const char * desc3 = 0,
00025                 const char * desc4 = 0,
00026                 const char * desc5 = 0,
00027                 const char * desc6 = 0
00028             );
00029 
00030             StreamTransformerException(
00031                 IT_ULong error_code, 
00032                 const char * desc1 = 0,
00033                 const char * desc2 = 0,
00034                 const char * desc3 = 0,
00035                 const char * desc4 = 0,
00036                 const char * desc5 = 0,
00037                 const char * desc6 = 0
00038             );
00039 
00040             virtual ~StreamTransformerException();
00041 
00045             virtual Exception*
00046             clone() const;
00047         
00051             virtual void
00052             rethrow() const;
00053         };
00054 
00055 
00056         class IT_AFC_API StreamTransformer;
00057 
00058         class IT_AFC_API KeywordTransformer
00059         {
00060         public:
00061             KeywordTransformer();
00062 
00063             KeywordTransformer(
00064                  const KeywordTransformer&
00065             );
00066 
00067             virtual
00068             ~KeywordTransformer();
00069 
00070             virtual
00071             void
00072             transform(
00073                 StreamTransformer&,
00074                 BinaryBuffer&
00075             ) throw((IT_Bus::StreamTransformerException)) = 0;
00076         };
00077 
00078         class IT_AFC_API StreamTransformer
00079         {
00080           typedef IT_Pair<char, char>                 DelimPairType;
00081           typedef IT_Vector<DelimPairType>            DelimPairVectorType;
00082           typedef StringMap<KeywordTransformer*>      KeywordTransformerMapType;
00083 
00084         public:
00085             StreamTransformer();
00086 
00087             virtual
00088             ~StreamTransformer();
00089 
00090             void
00091             register_keyword(
00092                 const String&,
00093                 KeywordTransformer*
00094             );
00095 
00096             void
00097             register_delimiters(
00098                 char,
00099                 char
00100             );
00101 
00102             void
00103             transform(
00104                 const BinaryBuffer&,
00105                 BinaryBuffer&
00106             ) throw((IT_Bus::StreamTransformerException));
00107 
00108             void
00109             transform(
00110                 const String&,
00111                 String&
00112             ) throw((IT_Bus::StreamTransformerException));
00113 
00114 
00115         protected:
00116             int
00117             get_next_token(
00118                 String&, 
00119                 const BinaryBuffer&
00120             );
00121 
00122             KeywordTransformerMapType                       m_transformer_map;
00123             DelimPairVectorType                             m_delims;
00124             int                                             m_iter;
00125         };
00126 
00127         class IT_AFC_API FilenameTransformer : public StreamTransformer
00128         {
00129         public:
00130             FilenameTransformer();
00131 
00132             virtual
00133             ~FilenameTransformer();
00134         };
00135 
00136         class IT_AFC_API KeywordTransformer_PID : public KeywordTransformer
00137         {
00138         public:
00139             KeywordTransformer_PID();
00140 
00141             KeywordTransformer_PID(
00142                  const KeywordTransformer_PID&
00143             );
00144 
00145             virtual
00146             ~KeywordTransformer_PID();
00147 
00148             virtual
00149             void
00150             transform(
00151                 StreamTransformer&,
00152                 BinaryBuffer&
00153             ) throw((IT_Bus::StreamTransformerException));
00154         };
00155 }
00156 
00157 #endif // #define _STRING_TEMPLATE_PROCESSOR_H_

Generated on Wed Mar 22 12:23:08 2006 for Artix by  doxygen 1.3.9.1