]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/inspstring.h
Fixes for bug #12
[user/henk/code/inspircd.git] / include / inspstring.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #ifndef IN_INSPSTRING_H
15 #define IN_INSPSTRING_H
16
17 // This (inspircd_config) is needed as inspstring doesn't pull in the central header
18 #include "inspircd_config.h"
19 #include <cstring>
20 //#include <cstddef>
21
22 #ifndef HAS_STRLCPY
23 /** strlcpy() implementation for systems that don't have it (linux) */
24 CoreExport size_t strlcpy(char *dst, const char *src, size_t siz);
25 /** strlcat() implementation for systems that don't have it (linux) */
26 CoreExport size_t strlcat(char *dst, const char *src, size_t siz);
27 #endif
28
29 /** charlcat() will append one character to a string using the same
30  * safety scemantics as strlcat().
31  * @param x The string to operate on
32  * @param y the character to append to the end of x
33  * @param z The maximum allowed length for z including null terminator
34  */
35 CoreExport int charlcat(char* x,char y,int z);
36 /** charremove() will remove all instances of a character from a string
37  * @param mp The string to operate on
38  * @param remove The character to remove
39  */
40 CoreExport bool charremove(char* mp, char remove);
41
42 /** Binary to hexadecimal conversion */
43 CoreExport std::string BinToHex(const std::string& data);
44 /** Base64 encode */
45 CoreExport std::string BinToBase64(const std::string& data, const char* table = NULL, char pad = 0);
46 /** Base64 decode */
47 CoreExport std::string Base64ToBin(const std::string& data, const char* table = NULL);
48
49 #endif
50