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 "export.hpp"
33#include "nomlib/config.hpp"
34
35#include <memory>
36#include <string>
37
38namespace nom {
39
44const nom::size_type MAX_STRING_LENGTH = 255;
45
60NOM_EXPORT const char*
61create_string(const char* str, nom::size_type num_bytes);
62
76NOM_EXPORT const char*
77create_string(const char* str);
78
101NOM_EXPORT int string_to_int(const char* str, int input_base);
102
125NOM_EXPORT uint string_to_uint(const char* str, int input_base);
126
144NOM_EXPORT int string_to_int(const char* str);
145
163NOM_EXPORT uint string_to_uint(const char* str);
164
165NOM_EXPORT const char* integer_to_cstr(int number);
166NOM_EXPORT std::string integer_to_string(int number);
167NOM_EXPORT nom::size_type string_length(const char* str);
168NOM_EXPORT
169nom::size_type string_length(const std::string& str);
170
171NOM_EXPORT
172int compare_cstr_insensitive(const char* str1, const char* str2,
173 nom::size_type len);
174
175NOM_EXPORT
176int compare_cstr_insensitive(const char* str1, const char* str2);
177
178NOM_EXPORT
179int compare_cstr_sensitive(const char* str1, const char* str2,
180 nom::size_type len);
181
182NOM_EXPORT int compare_cstr_sensitive(const char* str1, const char* str2);
183
184NOM_EXPORT int
185compare_string_insensitive(const std::string& str1, const std::string& str2,
186 nom::size_type len);
187NOM_EXPORT int
188compare_string_insensitive(const std::string& str1, const std::string& str2);
189
190NOM_EXPORT
191int compare_string_sensitive(const std::string& str1, const std::string& str2,
192 nom::size_type len);
193NOM_EXPORT
194int compare_string_sensitive(const std::string& str1, const std::string& str2);
195
196NOM_EXPORT
197void copy_string(const char* source, char* dest);
198
206NOM_DEPRECATED_EXPORT
207const char* duplicate_string(const char* str, nom::size_type length);
208
209NOM_EXPORT
210const char* duplicate_string(const std::string& str, nom::size_type length);
211
212NOM_EXPORT void free_string(const char* ptr);
213
214NOM_EXPORT
215const char* to_lowercase_cstr(const char* str, nom::size_type len);
216NOM_EXPORT const char* to_lowercase_cstr(const char* str);
217
218NOM_EXPORT
219std::string to_lowercase_string(const std::string& str, nom::size_type len);
220NOM_EXPORT std::string to_lowercase_string(const std::string& str);
221
222NOM_EXPORT
223const char* to_uppercase_cstr(const char* str, nom::size_type len);
224NOM_EXPORT const char* to_uppercase_cstr(const char* str);
225
226NOM_EXPORT
227std::string to_uppercase_string(const std::string& str, nom::size_type len);
228NOM_EXPORT std::string to_uppercase_string(const std::string& str);
229
230} // namespace nom
231
232#endif // include guard defined