XDRDecoder.h++

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002    commonc++ - A C++ Common Class Library
00003    Copyright (C) 2005-2012  Mark A Lindner
00004 
00005    This file is part of commonc++.
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public
00018    License along with this library; if not, write to the Free
00019    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020    ---------------------------------------------------------------------------
00021 */
00022 
00023 #ifndef __ccxx_XDRDecoder_hxx
00024 #define __ccxx_XDRDecoder_hxx
00025 
00026 #include <commonc++/DataReader.h++>
00027 CCXX_FWD_DECL(Variant);
00028 
00029 namespace ccxx {
00030 
00038 class COMMONCPP_API XDRDecoder
00039 {
00040   public:
00041 
00047   XDRDecoder(DataReader &reader);
00048 
00050   ~XDRDecoder() throw();
00051 
00058   inline XDRDecoder& decode(bool &v) throw(IOException)
00059   { int vv; decode(vv); v = static_cast<bool>(vv); return(*this); }
00060 
00067   inline XDRDecoder& decode(byte_t &v) throw(IOException)
00068   { uint32_t vv; decode(vv); v = static_cast<byte_t>(vv); return(*this); }
00069 
00076   inline XDRDecoder& decode(char &v) throw(IOException)
00077   { uint32_t vv; decode(vv); v = static_cast<bool>(vv); return(*this); }
00078 
00085   inline XDRDecoder& decode(int16_t &v) throw(IOException)
00086   { uint32_t vv; decode(vv); v = static_cast<int16_t>(vv); return(*this); }
00087 
00094   inline XDRDecoder& decode(uint16_t &v) throw(IOException)
00095   { uint32_t vv; decode(vv); v = static_cast<uint16_t>(vv); return(*this); }
00096 
00103   inline XDRDecoder& decode(int32_t &v) throw(IOException)
00104   { _reader >> v; return(*this); }
00105 
00112   inline XDRDecoder& decode(uint32_t &v) throw(IOException)
00113   { _reader >> v; return(*this); }
00114 
00121   inline XDRDecoder& decode(int64_t &v) throw(IOException)
00122   { _reader >> v; return(*this); }
00123 
00130   inline XDRDecoder& decode(uint64_t &v) throw(IOException)
00131   { _reader >> v; return(*this); }
00132 
00139   inline XDRDecoder& decode(float &v) throw(IOException)
00140   { _reader >> v; return(*this); }
00141 
00148   inline XDRDecoder& decode(double &v) throw(IOException)
00149   { _reader >> v; return(*this); }
00150 
00160   XDRDecoder& decode(char *s, size_t maxlen = 0) throw(IOException);
00161 
00171   XDRDecoder& decode(String &s, size_t maxlen = 0) throw(IOException);
00172 
00180   XDRDecoder& decode(byte_t *v, size_t len) throw(IOException);
00181 
00188   XDRDecoder& decode(Variant &v) throw(IOException);
00189 
00190   private:
00191 
00192   DataReader &_reader;
00193 };
00194 
00195 }; // namespace ccxx
00196 
00197 #endif // __ccxx_XDRDecoder_hxx
00198 
00199 /* end of header file */
Generated on Sat Nov 26 16:49:07 2011 for libcommonc++ by  doxygen 1.6.3