2021-08-02 16:34:47 +00:00
|
|
|
/*************************************************************************/
|
2021-08-18 14:03:52 +00:00
|
|
|
/* char_string.hpp */
|
2021-08-02 16:34:47 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/*************************************************************************/
|
2022-03-15 09:17:53 +00:00
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
2021-08-02 16:34:47 +00:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
#ifndef GODOT_CPP_CHAR_STRING_HPP
|
|
|
|
#define GODOT_CPP_CHAR_STRING_HPP
|
2017-03-04 02:04:16 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdint>
|
2017-03-04 02:04:16 +00:00
|
|
|
|
|
|
|
namespace godot {
|
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
class CharString {
|
|
|
|
friend class String;
|
|
|
|
|
|
|
|
const char *_data = nullptr;
|
|
|
|
int _length = 0;
|
2018-11-23 22:09:41 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
CharString(const char *str, int length);
|
2019-12-04 20:12:59 +00:00
|
|
|
|
2017-03-04 02:04:16 +00:00
|
|
|
public:
|
2021-08-18 14:03:52 +00:00
|
|
|
int length() const;
|
|
|
|
const char *get_data() const;
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2022-02-09 10:36:22 +00:00
|
|
|
CharString(CharString &&p_str);
|
|
|
|
void operator=(CharString &&p_str);
|
|
|
|
CharString() {}
|
2021-08-18 14:03:52 +00:00
|
|
|
~CharString();
|
|
|
|
};
|
2018-03-07 10:27:34 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
class Char16String {
|
|
|
|
friend class String;
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
const char16_t *_data = nullptr;
|
|
|
|
int _length = 0;
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
Char16String(const char16_t *str, int length);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
public:
|
|
|
|
int length() const;
|
|
|
|
const char16_t *get_data() const;
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2022-02-09 10:36:22 +00:00
|
|
|
Char16String(Char16String &&p_str);
|
|
|
|
void operator=(Char16String &&p_str);
|
|
|
|
Char16String() {}
|
2021-08-18 14:03:52 +00:00
|
|
|
~Char16String();
|
|
|
|
};
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
class Char32String {
|
|
|
|
friend class String;
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
const char32_t *_data = nullptr;
|
|
|
|
int _length = 0;
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
Char32String(const char32_t *str, int length);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
public:
|
|
|
|
int length() const;
|
|
|
|
const char32_t *get_data() const;
|
|
|
|
|
2022-02-09 10:36:22 +00:00
|
|
|
Char32String(Char32String &&p_str);
|
|
|
|
void operator=(Char32String &&p_str);
|
|
|
|
Char32String() {}
|
2021-08-18 14:03:52 +00:00
|
|
|
~Char32String();
|
|
|
|
};
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
class CharWideString {
|
|
|
|
friend class String;
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
const wchar_t *_data = nullptr;
|
|
|
|
int _length = 0;
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
CharWideString(const wchar_t *str, int length);
|
|
|
|
|
|
|
|
public:
|
|
|
|
int length() const;
|
|
|
|
const wchar_t *get_data() const;
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2022-02-09 10:36:22 +00:00
|
|
|
CharWideString(CharWideString &&p_str);
|
|
|
|
void operator=(CharWideString &&p_str);
|
|
|
|
CharWideString() {}
|
2021-08-18 14:03:52 +00:00
|
|
|
~CharWideString();
|
2017-03-04 02:04:16 +00:00
|
|
|
};
|
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
} // namespace godot
|
2017-03-04 02:04:16 +00:00
|
|
|
|
2021-08-18 14:03:52 +00:00
|
|
|
#endif // ! GODOT_CPP_CHAR_STRING_HPP
|