nomlib
Loading...
Searching...
No Matches
strings.hpp
1/******************************************************************************
2
3 nomlib - C++11 cross-platform game engine
4
5Copyright (c) 2013, 2014, 2015, 2016 Jeffrey Carpenter <i8degrees@gmail.com>
6All rights reserved.
7
8Redistribution and use in source and binary forms, with or without
9modification, are permitted provided that the following conditions are met:
10
111. Redistributions of source code must retain the above copyright notice, this
12 list of conditions and the following disclaimer.
132. Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation
15 and/or other materials provided with the distribution.
16
17THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28******************************************************************************/
29#ifndef NOMLIB_CORE_STRINGS_HPP
30#define NOMLIB_CORE_STRINGS_HPP
31
32#include "nomlib/config.hpp"
33
34#include <memory>
35#include <string>
36
37namespace nom {
38
43const nom::size_type MAX_STRING_LENGTH = 255;
44
59const char*
60create_string(const char* str, nom::size_type num_bytes);
61
75const char*
76create_string(const char* str);
77
100int string_to_int(const char* str, int input_base);
101
124uint string_to_uint(const char* str, int input_base);
125
143int string_to_int(const char* str);
144
162uint string_to_uint(const char* str);
163
164const char* integer_to_cstr(int number);
165std::string integer_to_string(int number);
166
167nom::size_type string_length(const char* str);
168nom::size_type string_length(const std::string& str);
169
170int
171compare_cstr_insensitive(const char* str1, const char* str2,
172 nom::size_type len);
173
174int compare_cstr_insensitive(const char* str1, const char* str2);
175
176int
177compare_cstr_sensitive(const char* str1, const char* str2,
178 nom::size_type len);
179
180int compare_cstr_sensitive(const char* str1, const char* str2);
181
182int
183compare_string_insensitive(const std::string& str1, const std::string& str2,
184 nom::size_type len);
185int compare_string_insensitive(const std::string& str1, const std::string& str2);
186
187int
188compare_string_sensitive(const std::string& str1, const std::string& str2,
189 nom::size_type len);
190int compare_string_sensitive(const std::string& str1, const std::string& str2);
191
192void copy_string(const char* source, char* dest);
193
201const char* duplicate_string(const char* str, nom::size_type length);
202
203const char* duplicate_string(const std::string& str, nom::size_type length);
204
205void free_string(const char* ptr);
206
207const char* to_lowercase_cstr(const char* str, nom::size_type len);
208const char* to_lowercase_cstr(const char* str);
209
210std::string to_lowercase_string(const std::string& str, nom::size_type len);
211std::string to_lowercase_string(const std::string& str);
212
213const char* to_uppercase_cstr(const char* str, nom::size_type len);
214const char* to_uppercase_cstr(const char* str);
215
216std::string to_uppercase_string(const std::string& str, nom::size_type len);
217std::string to_uppercase_string(const std::string& str);
218
219} // namespace nom
220
221#endif // include guard defined