TCCodec.h

Go to the documentation of this file.
00001 //*******************************************************************************
00002 //
00003 // *******   ***   ***               *
00004 //    *     *     *                  *
00005 //    *    *      *                *****
00006 //    *    *       ***  *   *   **   *    **    ***
00007 //    *    *          *  * *   *     *   ****  * * *
00008 //    *     *         *   *      *   * * *     * * *
00009 //    *      ***   ***    *     **   **   **   *   *
00010 //                        *
00011 //*******************************************************************************
00012 // see http://sourceforge.net/projects/tcsystem/ for details.
00013 // Copyright (C) 2003 - 2008 Thomas Goessler. All Rights Reserved. 
00014 //*******************************************************************************
00015 //
00016 // TCSystem is the legal property of its developers.
00017 // Please refer to the COPYRIGHT file distributed with this source distribution.
00018 // 
00019 // This library is free software; you can redistribute it and/or             
00020 // modify it under the terms of the GNU Lesser General Public                
00021 // License as published by the Free Software Foundation; either              
00022 // version 2.1 of the License, or (at your option) any later version.        
00023 //                                                                           
00024 // This library is distributed in the hope that it will be useful,           
00025 // but WITHOUT ANY WARRANTY; without even the implied warranty of            
00026 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         
00027 // Lesser General Public License for more details.                           
00028 //                                                                           
00029 // You should have received a copy of the GNU Lesser General Public          
00030 // License along with this library; if not, write to the Free Software       
00031 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
00032 //*******************************************************************************
00033 //  $Id: TCCodec.h 870 2008-07-21 14:15:33Z the_____tiger $
00034 //*******************************************************************************
00035 #ifndef _TCCODEC_H_
00036 #define _TCCODEC_H_
00037 
00038 #include "TCNonCopyable.h"
00039 #include "TCSharedPtr.h"
00040 
00041 #include <string>
00042 
00043 namespace TC
00044 {
00045     class Stream;
00046 
00064     class Codec: protected NonCopyAble
00065     {
00066     public:
00073        virtual uint32 Decode(Stream& stream, sint16 &val) = 0;
00080        virtual uint32 Decode(Stream& stream, uint16 &val) = 0;
00087        virtual uint32 Decode(Stream& stream, sint32 &val) = 0;
00094        virtual uint32 Decode(Stream& stream, uint32 &val) = 0;
00101        virtual uint32 Decode(Stream& stream, sint64 &val) = 0;
00108        virtual uint32 Decode(Stream& stream, uint64 &val) = 0;
00115        virtual uint32 Decode(Stream& stream, float &val) = 0;
00122        virtual uint32 Decode(Stream& stream, double &val) = 0;
00129        virtual uint32 Decode(Stream& stream, char *val) = 0;
00136        virtual uint32 Decode(Stream& stream, std::string& val) = 0;
00143        virtual uint32 Decode(Stream& stream, char &val) = 0;
00150        virtual uint32 Decode(Stream& stream, uchar &val)  = 0;
00151 
00152 
00159        virtual uint32 Encode(sint16 val, Stream& stream) = 0;
00166        virtual uint32 Encode(uint16 val, Stream& stream) = 0;
00173        virtual uint32 Encode(sint32 val, Stream& stream) = 0;
00180        virtual uint32 Encode(uint32 val, Stream& stream) = 0;
00187        virtual uint32 Encode(sint64 val, Stream& stream) = 0;
00194        virtual uint32 Encode(uint64 val, Stream& stream) = 0;
00201        virtual uint32 Encode(float val, Stream& stream) = 0;
00208        virtual uint32 Encode(double val, Stream& stream) = 0;
00215        virtual uint32 Encode(const char *val, Stream& stream) = 0;
00222        virtual uint32 Encode(const std::string& val, Stream& stream) = 0;
00229        virtual uint32 Encode(char val, Stream& stream) = 0;
00236        virtual uint32 Encode(uchar val, Stream& stream) = 0;
00237 
00243        virtual uint32 EncodeEndOfLine(Stream& stream) = 0;
00250        virtual uint32 EncodeSpace(Stream& stream) = 0;
00251 
00252        virtual ~Codec() {}
00253     };
00254 
00256     typedef SharedPtr<Codec> CodecPtr;
00257 
00262 } // namespace TC
00263 
00264 #endif // _TCCODEC_H_

Copyright (c) Thomas Goessler 2003 - 2008