PageRenderTime 22ms CodeModel.GetById 8ms app.highlight 11ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/llmessage/llmessagebuilder.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 101 lines | 57 code | 15 blank | 29 comment | 0 complexity | f7fab1d217eeae9ed1a929689c86067f MD5 | raw file
  1/** 
  2 * @file llmessagebuilder.h
  3 * @brief Declaration of LLMessageBuilder class.
  4 *
  5 * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#ifndef LL_LLMESSAGEBUILDER_H
 28#define LL_LLMESSAGEBUILDER_H
 29
 30#include <string>
 31
 32#include "stdtypes.h"
 33
 34class LLMsgData;
 35class LLQuaternion;
 36class LLSD;
 37class LLUUID;
 38class LLVector3;
 39class LLVector3d;
 40class LLVector4;
 41
 42class LLMessageBuilder
 43{
 44public:
 45
 46	//CLASS_LOG_TYPE(LLMessageBuilder);
 47	
 48	virtual ~LLMessageBuilder();
 49	virtual void newMessage(const char* name) = 0;
 50
 51	virtual void nextBlock(const char* blockname) = 0;
 52	virtual BOOL removeLastBlock() = 0; // TODO: babbage: remove this horror
 53
 54	/** All add* methods expect pointers to canonical strings. */
 55	virtual void addBinaryData(
 56		const char* varname,
 57		const void* data, 
 58		S32 size) = 0;
 59	virtual void addBOOL(const char* varname, BOOL b) = 0;
 60	virtual void addS8(const char* varname, S8 s) = 0;
 61	virtual void addU8(const char* varname, U8 u) = 0;
 62	virtual void addS16(const char* varname, S16 i) = 0;
 63	virtual void addU16(const char* varname, U16 i) = 0;
 64	virtual void addF32(const char* varname, F32 f) = 0;
 65	virtual void addS32(const char* varname, S32 s) = 0;
 66	virtual void addU32(const char* varname, U32 u) = 0;
 67	virtual void addU64(const char* varname, U64 lu) = 0;
 68	virtual void addF64(const char* varname, F64 d) = 0;
 69	virtual void addVector3(const char* varname, const LLVector3& vec) = 0;
 70	virtual void addVector4(const char* varname, const LLVector4& vec) = 0;
 71	virtual void addVector3d(const char* varname, const LLVector3d& vec) = 0;
 72	virtual void addQuat(const char* varname, const LLQuaternion& quat) = 0;
 73	virtual void addUUID(const char* varname, const LLUUID& uuid) = 0;
 74	virtual void addIPAddr(const char* varname, const U32 ip) = 0;
 75	virtual void addIPPort(const char* varname, const U16 port) = 0;
 76	virtual void addString(const char* varname, const char* s) = 0;
 77	virtual void addString(const char* varname, const std::string& s) = 0;
 78
 79	virtual BOOL isMessageFull(const char* blockname) const = 0;
 80	virtual void compressMessage(U8*& buf_ptr, U32& buffer_length) = 0;
 81	virtual S32 getMessageSize() = 0;
 82
 83	virtual BOOL isBuilt() const = 0;
 84	virtual BOOL isClear() const = 0;
 85	virtual U32 buildMessage(
 86		U8* buffer,
 87		U32 buffer_size,
 88		U8 offset_to_data) = 0; 
 89        /**< Return built message size */
 90	virtual void clearMessage() = 0;
 91
 92	// TODO: babbage: remove this horror
 93	virtual void setBuilt(BOOL b) = 0;
 94
 95	virtual const char* getMessageName() const = 0;
 96
 97	virtual void copyFromMessageData(const LLMsgData& data) = 0;
 98	virtual void copyFromLLSD(const LLSD& data) = 0;
 99};
100
101#endif //  LL_LLMESSAGEBUILDER_H