Shadowrun: Awakened 29 September 2011 - Build 871
Static Public Member Functions
SraNetwork::Helpers Class Reference

#include <NetworkHelper.h>

List of all members.

Static Public Member Functions

static int GetIntFromBuffer (const char *buffer, int *offset)
static RakNet::RakString GetStringFromBuffer (RakNet::BitStream *stream)
static void GetWStringFromBuffer (const char *buffer, const size_t strlen, wchar_t *target)
 Returns a wstring from a char buffer /summary>
static int StoreIntInBuffer (const int source, char *target)
static int StoreStringInBuffer (const std::string source, RakNet::BitStream *stream)
static void StoreWStringInBuffer (const wchar_t *source, char *target)

Detailed Description

Definition at line 35 of file NetworkHelper.h.


Member Function Documentation

static int SraNetwork::Helpers::GetIntFromBuffer ( const char *  buffer,
int *  offset 
) [inline, static]

summary> Stores a wstring from in a char /summary>

Definition at line 66 of file NetworkHelper.h.

static RakNet::RakString SraNetwork::Helpers::GetStringFromBuffer ( RakNet::BitStream stream) [inline, static]

Definition at line 60 of file NetworkHelper.h.

References RakNet::StringCompressor::Instance(), and SraNetwork::MAX_STRLEN.

        {
            RakNet::RakString str = "";
            RakNet::StringCompressor::Instance()->DecodeString(&str, MAX_STRLEN, stream);           
        }
static void SraNetwork::Helpers::GetWStringFromBuffer ( const char *  buffer,
const size_t  strlen,
wchar_t *  target 
) [inline, static]

Definition at line 42 of file NetworkHelper.h.

        {
            wostringstream wstream;

            // Create the facet
            const ctype<wchar_t>& facet =
                use_facet< ctype<wchar_t> >( wstream.getloc() );

            // Now copy the characters
            for (size_t idx = 0; idx < strlen; ++idx)
            {
                wstream << facet.widen( buffer[idx] );
            }

            // And copy to the output
            wcscpy( target, wstream.str().c_str());
        }
static int SraNetwork::Helpers::StoreIntInBuffer ( const int  source,
char *  target 
) [inline, static]

Definition at line 104 of file NetworkHelper.h.

        {
            memcpy(target, &source, sizeof(source));
            return sizeof(source);
        }
static int SraNetwork::Helpers::StoreStringInBuffer ( const std::string  source,
RakNet::BitStream stream 
) [inline, static]

Definition at line 98 of file NetworkHelper.h.

References RakNet::StringCompressor::Instance(), SraNetwork::MAX_STRLEN, and stream.

        {
             RakNet::StringCompressor::Instance()->EncodeString(
                 source.c_str(), MAX_STRLEN, stream);
        }
static void SraNetwork::Helpers::StoreWStringInBuffer ( const wchar_t *  source,
char *  target 
) [inline, static]

summary> Stores a string from in a char /summary>

Definition at line 77 of file NetworkHelper.h.


The documentation for this class was generated from the following file:

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net