1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Core: Add [[nodiscard]] to string-like classes

This commit is contained in:
Thaddeus Crews
2024-06-23 12:28:04 -05:00
parent 6a6a1168a5
commit 579feb387c
12 changed files with 22 additions and 21 deletions

View File

@@ -33,7 +33,7 @@
#include "core/string/string_name.h"
#include "core/string/ustring.h"
class NodePath {
class [[nodiscard]] NodePath {
struct Data {
SafeRefCount refcount;
Vector<StringName> path;

View File

@@ -37,7 +37,7 @@
class Main;
class StringName {
class [[nodiscard]] StringName {
struct Table;
struct _Data {

View File

@@ -127,7 +127,7 @@ constexpr int64_t str_compare(const L *l_ptr, const R *r_ptr) {
/*************************************************************************/
template <typename T>
class CharProxy {
class [[nodiscard]] CharProxy {
friend String;
friend CharStringT<T>;
@@ -170,7 +170,7 @@ public:
/*************************************************************************/
template <typename T>
class CharStringT {
class [[nodiscard]] CharStringT {
CowData<T> _cowdata;
static constexpr T _null = 0;
@@ -265,7 +265,7 @@ using Char16String = CharStringT<char16_t>;
/* String */
/*************************************************************************/
class String {
class [[nodiscard]] String {
CowData<char32_t> _cowdata;
static constexpr char32_t _null = 0;
static constexpr char32_t _replacement_char = 0xfffd;