src/include/common/spds/DataTransformer.h

00001 /*
00002  * Copyright (C) 2003-2007 Funambol, Inc
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 version 2 as
00006  * published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00016  * 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();
00067 
00068         DataTransformer(char*  name);
00069 
00070         virtual ~DataTransformer();
00071 
00072         static DataTransformer* getEncoder(const char* name);
00073         static DataTransformer* getDecoder(const char* name);
00074         static BOOL isSupportedEncoder(char*  name);
00075         static BOOL isSupportedDecoder(char*  name);
00076 
00077         void setName(const char* name);
00078         const char* getName();
00079 
00093         virtual char* transform(char* data, TransformationInfo& info) = 0;
00094 
00095     };
00096 
00098 #endif

Generated on Fri Nov 9 12:21:24 2007 for Funambol Outlook Plug-in Library by  doxygen 1.5.2