TrinityCore
Loading...
Searching...
No Matches
PacketUtilities.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3
*
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the
6
* Free Software Foundation; either version 2 of the License, or (at your
7
* option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#include "
PacketUtilities.h
"
19
#include "
Hyperlinks.h
"
20
#include <utf8.h>
21
22
WorldPackets::InvalidStringValueException::InvalidStringValueException
(std::string
const
& value) :
ByteBufferInvalidValueException
(
"string"
, value.c_str())
23
{
24
}
25
26
WorldPackets::InvalidUtf8ValueException::InvalidUtf8ValueException
(std::string
const
& value) :
InvalidStringValueException
(value)
27
{
28
}
29
30
WorldPackets::InvalidHyperlinkException::InvalidHyperlinkException
(std::string
const
& value) :
InvalidStringValueException
(value)
31
{
32
}
33
34
WorldPackets::IllegalHyperlinkException::IllegalHyperlinkException
(std::string
const
& value) :
InvalidStringValueException
(value)
35
{
36
}
37
38
bool
WorldPackets::Strings::Utf8::Validate
(std::string
const
& value)
39
{
40
if
(!utf8::is_valid(value.begin(), value.end()))
41
throw
InvalidUtf8ValueException
(value);
42
return
true
;
43
}
44
45
bool
WorldPackets::Strings::Hyperlinks::Validate
(std::string
const
& value)
46
{
47
if
(!
Trinity::Hyperlinks::CheckAllLinks
(value))
48
throw
InvalidHyperlinkException
(value);
49
return
true
;
50
}
51
52
bool
WorldPackets::Strings::NoHyperlinks::Validate
(std::string
const
& value)
53
{
54
if
(value.find(
'|'
) != std::string::npos)
55
throw
IllegalHyperlinkException
(value);
56
return
true
;
57
}
58
59
WorldPackets::PacketArrayMaxCapacityException::PacketArrayMaxCapacityException
(std::size_t
requestedSize
, std::size_t
sizeLimit
)
60
{
61
message().assign(
"Attempted to read more array elements from packet "
+
Trinity::ToString
(
requestedSize
) +
" than allowed "
+
Trinity::ToString
(
sizeLimit
));
62
}
Hyperlinks.h
PacketUtilities.h
ByteBufferInvalidValueException
Definition
ByteBuffer.h:62
WorldPackets::Array
Definition
PacketUtilities.h:120
WorldPackets::IllegalHyperlinkException
Definition
PacketUtilities.h:52
WorldPackets::IllegalHyperlinkException::IllegalHyperlinkException
IllegalHyperlinkException(std::string const &value)
Definition
PacketUtilities.cpp:34
WorldPackets::InvalidHyperlinkException
Definition
PacketUtilities.h:46
WorldPackets::InvalidHyperlinkException::InvalidHyperlinkException
InvalidHyperlinkException(std::string const &value)
Definition
PacketUtilities.cpp:30
WorldPackets::InvalidStringValueException
Definition
PacketUtilities.h:29
WorldPackets::InvalidStringValueException::InvalidStringValueException
InvalidStringValueException(std::string const &value)
Definition
PacketUtilities.cpp:22
WorldPackets::InvalidUtf8ValueException
Definition
PacketUtilities.h:40
WorldPackets::InvalidUtf8ValueException::InvalidUtf8ValueException
InvalidUtf8ValueException(std::string const &value)
Definition
PacketUtilities.cpp:26
WorldPackets::PacketArrayMaxCapacityException::PacketArrayMaxCapacityException
PacketArrayMaxCapacityException(std::size_t requestedSize, std::size_t sizeLimit)
Definition
PacketUtilities.cpp:59
Trinity::Hyperlinks::CheckAllLinks
bool TC_GAME_API CheckAllLinks(std::string_view str)
Definition
Hyperlinks.cpp:367
Trinity::ToString
std::string ToString(Type &&val, Params &&... params)
Definition
StringConvert.h:271
WorldPackets::Strings::Hyperlinks::Validate
static bool Validate(std::string const &value)
Definition
PacketUtilities.cpp:45
WorldPackets::Strings::NoHyperlinks::Validate
static bool Validate(std::string const &value)
Definition
PacketUtilities.cpp:52
WorldPackets::Strings::Utf8::Validate
static bool Validate(std::string const &value)
Definition
PacketUtilities.cpp:38
server
game
Server
Packets
PacketUtilities.cpp
Generated on Sun May 10 2026 02:30:17 for TrinityCore by
1.9.8