EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
utils_string.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Captnoord, Bloody.Rabbit
24 */
25 
26 #ifndef __UTILS__UTILS_STRING_H__INCL__
27 #define __UTILS__UTILS_STRING_H__INCL__
28 
29 #include "utils/Buffer.h"
30 
32 extern const std::string NULL_STRING;
33 
41 std::string GenerateKey( size_t length );
42 
51 bool IsNumber( char c );
61 bool IsNumber( const char* str, size_t len );
70 bool IsNumber( const std::string& str );
71 
80 bool IsHexNumber( char c );
90 bool IsHexNumber( const char* str, size_t len );
99 bool IsHexNumber( const std::string& str );
100 
109 bool IsPrintable( char c );
119 bool IsPrintable( const char* str, size_t len );
128 bool IsPrintable( const std::string& str );
129 
137 const char* itoa( int64 num );
138 
147 void ListToINString( const std::vector<int32>& ints, std::string& into, const char* if_empty = "" );
148 
155 void MakeUpperString( const char* source, char* target );
162 void MakeLowerString( const char* source, char* target );
163 
175 bool PyDecodeEscape( const char* str, Buffer& into );
176 
184 void SearchReplace( std::string& subject, const std::string& search, const std::string& replace );
185 
192 void SplitPath( const std::string& path, std::vector<std::string>& into );
193 
194 #endif /* !__UTILS__UTILS_STRING_H__INCL__ */
const char * itoa(int64 num)
Convers num to string.
std::string GenerateKey(size_t length)
Generates random key.
void MakeUpperString(const char *source, char *target)
toupper() for strings.
void ListToINString(const std::vector< int32 > &ints, std::string &into, const char *if_empty="")
bool PyDecodeEscape(const char *str, Buffer &into)
Decodes string escapes into actual characters.
void SplitPath(const std::string &path, std::vector< std::string > &into)
Splits path to its components.
void MakeLowerString(const char *source, char *target)
tolower() for strings.
bool IsNumber(char c)
Checks whether character is a number.
Generic class for buffers.
Definition: Buffer.h:40
bool IsHexNumber(char c)
Checks whether character is a hexadecimal number.
void SearchReplace(std::string &subject, const std::string &search, const std::string &replace)
Does search & replace on subject.
signed __int64 int64
Definition: eve-compat.h:51
const std::string NULL_STRING
std::string to use where you would use NULL for const char*.
bool IsPrintable(char c)
Checks whether character is printable.