Lines Matching defs:string
1 //===-- A simple implementation of the string class -------------*- C++ -*-===//
18 #include "src/string/memory_utils/inline_memcpy.h"
19 #include "src/string/memory_utils/inline_memset.h"
20 #include "src/string/string_utils.h" // string_length
27 // This class mimics std::string but does not intend to be a full fledged
30 class string {
54 LIBC_INLINE constexpr string() {}
55 LIBC_INLINE string(const string &other) { this->operator+=(other); }
56 LIBC_INLINE constexpr string(string &&other)
60 LIBC_INLINE string(const char *cstr, size_t count) {
64 LIBC_INLINE string(const string_view &view)
65 : string(view.data(), view.size()) {}
66 LIBC_INLINE string(const char *cstr)
67 : string(cstr, ::LIBC_NAMESPACE::internal::string_length(cstr)) {}
68 LIBC_INLINE string(size_t size_, char value) {
73 LIBC_INLINE string &operator=(const string &other) {
78 LIBC_INLINE string &operator=(string &&other) {
86 LIBC_INLINE string &operator=(const string_view &view) {
87 return *this = string(view);
90 LIBC_INLINE ~string() {
152 LIBC_INLINE string &operator+=(const string &rhs) {
160 LIBC_INLINE string &operator+=(const char c) {
169 LIBC_INLINE bool operator==(const string &lhs, const string &rhs) {
172 LIBC_INLINE bool operator!=(const string &lhs, const string &rhs) {
175 LIBC_INLINE bool operator<(const string &lhs, const string &rhs) {
178 LIBC_INLINE bool operator<=(const string &lhs, const string &rhs) {
181 LIBC_INLINE bool operator>(const string &lhs, const string &rhs) {
184 LIBC_INLINE bool operator>=(const string &lhs, const string &rhs) {
188 LIBC_INLINE string operator+(const string &lhs, const string &rhs) {
189 string Tmp(lhs);
192 LIBC_INLINE string operator+(const string &lhs, const char *rhs) {
193 return lhs + string(rhs);
195 LIBC_INLINE string operator+(const char *lhs, const string &rhs) {
196 return string(lhs) + rhs;
200 template <typename T> string to_dec_string(T value) {
206 LIBC_INLINE string to_string(int value) {
209 LIBC_INLINE string to_string(long value) {
212 LIBC_INLINE string to_string(long long value) {
215 LIBC_INLINE string to_string(unsigned value) {
218 LIBC_INLINE string to_string(unsigned long value) {
221 LIBC_INLINE string to_string(unsigned long long value) {
226 // LIBC_INLINE string to_string(float value);
227 // LIBC_INLINE string to_string(double value);
228 // LIBC_INLINE string to_string(long double value);