Mana
Loading...
Searching...
No Matches
messageout.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2004-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
25
26#include <cstdint>
27#include <string>
28
29namespace ManaServ {
30
37{
38 public:
39 MessageOut(uint16_t id);
40
42
46 void writeInt8(uint8_t value);
47
51 void writeInt16(uint16_t value);
52
56 void writeInt32(uint32_t value);
57
62 void writeString(const std::string &string, int length = -1);
63
67 char *getData() const { return mData; }
68
72 unsigned int getDataSize() const { return mDataSize; }
73
74 private:
82 void expand(size_t size);
83
85
86 char *mData;
87 unsigned int mPos;
88 unsigned int mDataSize;
90};
91
92} // namespace ManaServ
Used for building an outgoing message to manaserv.
Definition messageout.h:37
void writeInt16(uint16_t value)
Writes an unsigned 16-bit integer to the message.
bool mDebugMode
Include debugging information.
Definition messageout.h:89
void writeInt32(uint32_t value)
Writes an unsigned 32-bit integer to the message.
void expand(size_t size)
Expand the packet data to be able to hold more data.
unsigned int mPos
Position in the data.
Definition messageout.h:87
char * getData() const
Returns the content of the message.
Definition messageout.h:67
void writeValueType(ManaServ::ValueType type)
unsigned int mDataSize
Size of data.
Definition messageout.h:88
void writeInt8(uint8_t value)
Writes an unsigned 8-bit integer to the message.
void writeString(const std::string &string, int length=-1)
Writes a string.
char * mData
Data building up.
Definition messageout.h:86
unsigned int getDataSize() const
Returns the length of the data.
Definition messageout.h:72
ValueType
The type of a value in a message.
unsigned char uint8_t
Definition sha256.cpp:81
unsigned int uint32_t
Definition sha256.cpp:82