flatten 20260225
This commit is contained in:
150
tjp/core/string/Str.h
Executable file
150
tjp/core/string/Str.h
Executable file
@@ -0,0 +1,150 @@
|
||||
// License: Modified MIT (NON-AI)
|
||||
// See the LICENSE file in the root directory for license information.
|
||||
// Copyright 2025 Timothy Prepscius
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "String.h"
|
||||
#include "StringView.h"
|
||||
|
||||
#include "../rtti/TypeName+custom.hpp"
|
||||
|
||||
namespace tjp::core {
|
||||
namespace str {
|
||||
|
||||
#define TJP_STR_INLINE inline
|
||||
|
||||
#define TJP_STR_USE_TEMPLATES
|
||||
#ifdef TJP_STR_USE_TEMPLATES
|
||||
constexpr int Str_DefaultN = 48;
|
||||
|
||||
template<int N=Str_DefaultN>
|
||||
struct Str;
|
||||
|
||||
#define TJP_STR_TEMPLATE template<int N1>
|
||||
#define TJP_STR_TEMPLATE2 template<int N2>
|
||||
|
||||
#define TJP_STR_TEMPLATE12 template<int N1, int N2>
|
||||
#define CONST_TEMPLATE_N1 N1
|
||||
|
||||
#define TJP_STR Str<N1>
|
||||
#define TJP_STR2 Str<N2>
|
||||
#define TJP_STR_TYPENAME typename TJP_STR
|
||||
|
||||
#define TJP_STR_DEFAULT Str<Str_DefaultN>
|
||||
#else
|
||||
struct Str;
|
||||
|
||||
#define TJP_STR_TEMPLATE
|
||||
#define TJP_STR_TEMPLATE12
|
||||
#define TJP_STR_TEMPLATE2
|
||||
#define CONST_TEMPLATE_N1 48
|
||||
|
||||
#define TJP_STR Str
|
||||
#define TJP_STR2 Str
|
||||
#define TJP_STR_TYPENAME TJP_STR
|
||||
|
||||
#define TJP_STR_DEFAULT Str
|
||||
#endif
|
||||
|
||||
|
||||
TJP_STR_TEMPLATE12
|
||||
bool operator ==(const TJP_STR &lhs, const TJP_STR2 &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator ==(const TJP_STR &lhs, const String &r);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator ==(const TJP_STR &lhs, const StringView &r);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator ==(const TJP_STR &lhs, const char *r);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator ==(const String &l, const TJP_STR &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator ==(const StringView &l, const TJP_STR &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator ==(const char *l, const TJP_STR &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE12
|
||||
bool operator !=(const TJP_STR &lhs, const TJP_STR2 &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator !=(const TJP_STR &lhs, const String &r);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator !=(const TJP_STR &lhs, const StringView &r);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator !=(const TJP_STR &lhs, const char *r);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator !=(const String &l, const TJP_STR &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator !=(const StringView &l, const TJP_STR &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator !=(const char *l, const TJP_STR &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE12
|
||||
bool operator <(const TJP_STR &lhs, const TJP_STR2 &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator <(const TJP_STR &lhs, const String &r);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator <(const TJP_STR &lhs, const StringView &r);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator <(const TJP_STR &lhs, const char *r);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator <(const String &l, const TJP_STR &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator <(const StringView &l, const TJP_STR &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
bool operator <(const char *l, const TJP_STR &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE12
|
||||
TJP_STR operator+(const TJP_STR &lhs, const TJP_STR2 &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
TJP_STR operator+(const String &lhs, const TJP_STR &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
TJP_STR operator+(const StringView &lhs, const TJP_STR &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
TJP_STR operator+(const char *lhs, const TJP_STR &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
TJP_STR operator+(const TJP_STR &lhs, const String &rhs);
|
||||
|
||||
TJP_STR_TEMPLATE
|
||||
TJP_STR operator+(const TJP_STR &lhs, const StringView &rhs);
|
||||
|
||||
TJP_STR_DEFAULT operator+(const char *lhs, const StringView &rhs);
|
||||
|
||||
} // namespace
|
||||
|
||||
#ifdef TJP_STR_USE_TEMPLATES
|
||||
template<int N1=str::Str_DefaultN>
|
||||
using StrN = str::TJP_STR;
|
||||
|
||||
using Str = StrN<str::Str_DefaultN>;
|
||||
using Str = Str;
|
||||
#else
|
||||
using Str = str::TJP_STR;
|
||||
using Str = Str;
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
TIMPREPSCIUS_CORE_RTTI_REPLACE_TYPENAME(tjp::core::Str);
|
||||
|
||||
Reference in New Issue
Block a user