From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/stream__inline_8h-source.html | 407 +++++++++++++++++++++++++ 1 file changed, 407 insertions(+) create mode 100644 docs/doxygen/nel/stream__inline_8h-source.html (limited to 'docs/doxygen/nel/stream__inline_8h-source.html') diff --git a/docs/doxygen/nel/stream__inline_8h-source.html b/docs/doxygen/nel/stream__inline_8h-source.html new file mode 100644 index 00000000..5f08acfe --- /dev/null +++ b/docs/doxygen/nel/stream__inline_8h-source.html @@ -0,0 +1,407 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

stream_inline.h

Go to the documentation of this file.
00001 
+00012 /* Copyright, 2000 Nevrax Ltd.
+00013  *
+00014  * This file is part of NEVRAX NEL.
+00015  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00016  * it under the terms of the GNU General Public License as published by
+00017  * the Free Software Foundation; either version 2, or (at your option)
+00018  * any later version.
+00019 
+00020  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00021  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00023  * General Public License for more details.
+00024 
+00025  * You should have received a copy of the GNU General Public License
+00026  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00027  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00028  * MA 02111-1307, USA.
+00029  */
+00030 
+00031 #ifndef NL_STREAM_INLINE_H
+00032 #define NL_STREAM_INLINE_H
+00033 
+00034 #include <stdio.h>
+00035 
+00036 #include "nel/misc/debug.h"
+00037 
+00038 
+00039 namespace       NLMISC
+00040 {
+00041 
+00042 
+00043 // ======================================================================================================
+00044 // ======================================================================================================
+00045 // IBasicStream Inline Implementation.
+00046 // ======================================================================================================
+00047 // ======================================================================================================
+00048 
+00049 
+00050 // ======================================================================================================
+00051 // ======================================================================================================
+00052 // ======================================================================================================
+00053 
+00054 // ======================================================================================================
+00055 inline  IStream::IStream(bool inputStream)
+00056 {
+00057         _InputStream= inputStream;
+00058 }
+00059 
+00060 
+00061 // ======================================================================================================
+00062 inline  bool            IStream::isReading() const
+00063 {
+00064         return _InputStream;
+00065 }
+00066 
+00067 
+00068 // ======================================================================================================
+00069 // ======================================================================================================
+00070 // ======================================================================================================
+00071 
+00072 // ======================================================================================================
+00073 inline  void            IStream::serial(uint8 &b) 
+00074 {
+00075         serialBuffer((uint8 *)&b, 1);
+00076 }
+00077 
+00078 // ======================================================================================================
+00079 inline  void            IStream::serial(sint8 &b) 
+00080 {
+00081         serialBuffer((uint8 *)&b, 1);
+00082 }
+00083 
+00084 // ======================================================================================================
+00085 inline  void            IStream::serial(uint16 &b) 
+00086 {
+00087 #ifdef NL_LITTLE_ENDIAN
+00088         serialBuffer((uint8 *)&b, 2);
+00089 #else // NL_LITTLE_ENDIAN
+00090         uint16  v;
+00091         if(isReading())
+00092         {
+00093                 serialBuffer((uint8 *)&v, 2);
+00094                 NLMISC_BSWAP16(v);
+00095                 b=v;
+00096         }
+00097         else
+00098         {
+00099                 v=b;
+00100                 NLMISC_BSWAP16(v);
+00101                 serialBuffer((uint8 *)&v, 2);
+00102         }
+00103 #endif // NL_LITTLE_ENDIAN
+00104 }
+00105 
+00106 // ======================================================================================================
+00107 inline  void            IStream::serial(sint16 &b) 
+00108 {
+00109 #ifdef NL_LITTLE_ENDIAN
+00110         serialBuffer((uint8 *)&b, 2);
+00111 #else // NL_LITTLE_ENDIAN
+00112         uint16  v;
+00113         if(isReading())
+00114         {
+00115                 serialBuffer((uint8 *)&v, 2);
+00116                 NLMISC_BSWAP16(v);
+00117                 b=v;
+00118         }
+00119         else
+00120         {
+00121                 v=b;
+00122                 NLMISC_BSWAP16(v);
+00123                 serialBuffer((uint8 *)&v, 2);
+00124         }
+00125 #endif // NL_LITTLE_ENDIAN
+00126 }
+00127 
+00128 // ======================================================================================================
+00129 inline  void            IStream::serial(uint32 &b) 
+00130 {
+00131 #ifdef NL_LITTLE_ENDIAN
+00132         serialBuffer((uint8 *)&b, 4);
+00133 #else // NL_LITTLE_ENDIAN
+00134         uint32  v;
+00135         if(isReading())
+00136         {
+00137                 serialBuffer((uint8 *)&v, 4);
+00138                 NLMISC_BSWAP32(v);
+00139                 b=v;
+00140         }
+00141         else
+00142         {
+00143                 v=b;
+00144                 NLMISC_BSWAP32(v);
+00145                 serialBuffer((uint8 *)&v, 4);
+00146         }
+00147 #endif // NL_LITTLE_ENDIAN
+00148 }
+00149 
+00150 // ======================================================================================================
+00151 inline  void            IStream::serial(sint32 &b) 
+00152 {
+00153 #ifdef NL_LITTLE_ENDIAN
+00154         serialBuffer((uint8 *)&b, 4);
+00155 #else // NL_LITTLE_ENDIAN
+00156         uint32  v;
+00157         if(isReading())
+00158         {
+00159                 serialBuffer((uint8 *)&v, 4);
+00160                 NLMISC_BSWAP32(v);
+00161                 b=v;
+00162         }
+00163         else
+00164         {
+00165                 v=b;
+00166                 NLMISC_BSWAP32(v);
+00167                 serialBuffer((uint8 *)&v, 4);
+00168         }
+00169 #endif // NL_LITTLE_ENDIAN
+00170 }
+00171 
+00172 // ======================================================================================================
+00173 inline  void            IStream::serial(uint64 &b) 
+00174 {
+00175 #ifdef NL_LITTLE_ENDIAN
+00176                 serialBuffer((uint8 *)&b, 8);
+00177 #else // NL_LITTLE_ENDIAN
+00178         uint64  v;
+00179         if(isReading())
+00180         {
+00181                 serialBuffer((uint8 *)&v, 8);
+00182                 NLMISC_BSWAP64(v);
+00183                 b=v;
+00184         }
+00185         else
+00186         {
+00187                 v=b;
+00188                 NLMISC_BSWAP64(v);
+00189                 serialBuffer((uint8 *)&v, 8);
+00190         }
+00191 #endif // NL_LITTLE_ENDIAN
+00192 }
+00193 
+00194 // ======================================================================================================
+00195 inline  void            IStream::serial(sint64 &b) 
+00196 {
+00197 #ifdef NL_LITTLE_ENDIAN
+00198         serialBuffer((uint8 *)&b, 8);
+00199 #else // NL_LITTLE_ENDIAN
+00200         uint64  v;
+00201         if(isReading())
+00202         {
+00203                 serialBuffer((uint8 *)&v, 8);
+00204                 NLMISC_BSWAP64(v);
+00205                 b=v;
+00206         }
+00207         else
+00208         {
+00209                 v=b;
+00210                 NLMISC_BSWAP64(v);
+00211                 serialBuffer((uint8 *)&v, 8);
+00212         }
+00213 #endif // NL_LITTLE_ENDIAN
+00214 }
+00215 
+00216 // ======================================================================================================
+00217 inline  void            IStream::serial(float &b) 
+00218 {
+00219 #ifdef NL_LITTLE_ENDIAN
+00220         serialBuffer((uint8 *)&b, 4);
+00221 #else // NL_LITTLE_ENDIAN
+00222         uint32  v;
+00223         if(isReading())
+00224         {
+00225                 serialBuffer((uint8 *)&v, 4);
+00226                 NLMISC_BSWAP32(v);
+00227                 b=*((float*)&v);
+00228         }
+00229         else
+00230         {
+00231                 v=*((uint32*)&b);
+00232                 NLMISC_BSWAP32(v);
+00233                 serialBuffer((uint8 *)&v, 4);
+00234         }
+00235 #endif // NL_LITTLE_ENDIAN
+00236 }
+00237 
+00238 // ======================================================================================================
+00239 inline  void            IStream::serial(double &b) 
+00240 {
+00241 #ifdef NL_LITTLE_ENDIAN
+00242         serialBuffer((uint8 *)&b, 8);
+00243 #else // NL_LITTLE_ENDIAN
+00244         uint64  v;
+00245         if(isReading())
+00246         {
+00247                 serialBuffer((uint8 *)&v, 8);
+00248                 NLMISC_BSWAP64(v);
+00249                 b=*((double*)&v);
+00250         }
+00251         else
+00252         {
+00253                 v=*((uint64*)&b);
+00254                 NLMISC_BSWAP64(v);
+00255                 serialBuffer((uint8 *)&v, 8);
+00256         }
+00257 #endif // NL_LITTLE_ENDIAN
+00258 }
+00259 
+00260 // ======================================================================================================
+00261 inline  void            IStream::serial(bool &b) 
+00262 {
+00263         serialBit(b);
+00264 }
+00265 
+00266 #ifndef NL_OS_CYGWIN
+00267 // ======================================================================================================
+00268 inline  void            IStream::serial(char &b) 
+00269 {
+00270         serialBuffer((uint8 *)&b, 1);
+00271 }
+00272 #endif
+00273 
+00274 // ======================================================================================================
+00275 inline  void            IStream::serial(std::string &b) 
+00276 {
+00277         sint32  len=0;
+00278         // Read/Write the length.
+00279         if(isReading())
+00280         {
+00281                 serial(len);
+00282                 nlassert( len<1000000 ); // limiting string size
+00283                 b.resize(len);
+00284         }
+00285         else
+00286         {
+00287                 len= b.size();
+00288                 serial(len);
+00289         }
+00290         // Read/Write the string.
+00291         for(sint i=0;i<len;i++)
+00292                 serial(b[i]);
+00293 }
+00294 
+00295 
+00296 // ======================================================================================================
+00297 inline  void            IStream::serial(ucstring &b) 
+00298 {
+00299         sint32  len=0;
+00300         // Read/Write the length.
+00301         if(isReading())
+00302         {
+00303                 serial(len);
+00304                 b.resize(len);
+00305         }
+00306         else
+00307         {
+00308                 len= b.size();
+00309                 serial(len);
+00310         }
+00311         // Read/Write the string.
+00312         for(sint i=0;i<len;i++)
+00313                 serial(b[i]);
+00314 }
+00315 
+00316 
+00317 
+00318 // ======================================================================================================
+00319 inline uint8                    IStream::serialBitField8(uint8  bf)
+00320 {
+00321         serial(bf);
+00322         return bf;
+00323 }
+00324 // ======================================================================================================
+00325 inline uint16                   IStream::serialBitField16(uint16  bf)
+00326 {
+00327         serial(bf);
+00328         return bf;
+00329 }
+00330 // ======================================================================================================
+00331 inline uint32                   IStream::serialBitField32(uint32  bf)
+00332 {
+00333         serial(bf);
+00334         return bf;
+00335 }
+00336 
+00337 
+00338 }
+00339 
+00340 
+00341 #endif // NL_STREAM_INLINE_H
+00342 
+00343 /* End of stream_inline.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1