src/include/common/spds/DataTransformer.h

00001 /*
00002  * Copyright (C) 2003-2007 Funambol
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program 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
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00030  #ifndef INCL_DATA_TRANSFORMER
00031     #define INCL_DATA_TRANSFORMER
00032 
00034     #include "base/fscapi.h"
00035 
00040     struct TransformationInfo {
00041 
00042         BOOL newReturnedData;
00043         long size;
00044         const char*  username;
00045         const char*  password;
00046         const char*  sourceName;
00047 
00048         TransformationInfo() : newReturnedData(FALSE)
00049                              , size(-1)
00050                              , username(NULL)
00051                              , password(NULL)
00052                              , sourceName(NULL) {}
00053 
00054     };
00055 
00056     class DataTransformer {
00057 
00058     private:
00059 
00060         char*  name;
00061 
00062     public:
00063         /*
00064          * Default constructor-destructor
00065          */
00066         DataTransformer() EXTRA_SECTION_01;
00067 
00068         DataTransformer(char*  name) EXTRA_SECTION_01;
00069 
00070         virtual ~DataTransformer() EXTRA_SECTION_01;
00071 
00072         static DataTransformer* getEncoder(const char* name) EXTRA_SECTION_01;
00073         static DataTransformer* getDecoder(const char* name) EXTRA_SECTION_01;
00074         static BOOL isSupportedEncoder(char*  name) EXTRA_SECTION_01;
00075         static BOOL isSupportedDecoder(char*  name) EXTRA_SECTION_01;
00076 
00077         void setName(const char* name) EXTRA_SECTION_01;
00078         const char* getName() EXTRA_SECTION_01;
00079 
00093         virtual char* transform(char* data, TransformationInfo& info) = 0 EXTRA_SECTION_01;
00094 
00095     };
00096 
00098 #endif

Generated on Fri Apr 27 12:29:18 2007 for Funambol C++ Client Library by  doxygen 1.5.2