Melon
A C++ library designed for RadishOS.
Loading...
Searching...
No Matches
CString.hpp
1#pragma once
2
3#include "../../Typing.hpp"
4
5namespace Melon::Memory
6{
11 class CString
12 {
13 char *data;
14
15 public:
20 CString(const char *s);
21
23 ~CString();
24
30 CString &copy(this const CString &self, CString &dest, Typing::USize chars);
31
35 bool has(this const CString &self, char ch);
36
41 Typing::USize length(this const CString &self);
42
44 const char *begin(this const CString &self);
45
47 const char *end(this const CString &self);
48
51 const char *get(this const CString &self);
52
56 bool operator ==(this const CString &self, const CString &other);
57
61 bool operator !=(this const CString &self, const CString &other);
62
66 bool operator <(this const CString &self, const CString &other);
67
71 bool operator >(this const CString &self, const CString &other);
72
76 bool operator <=(this const CString &self, const CString &other);
77
81 bool operator >=(this const CString &self, const CString &other);
82
86 char &operator [](this CString &self, Typing::USize index);
87 };
88} // namespace Melon::Memory
Typing::USize length(this const CString &self)
Computes the length of this string.
Definition CString.cpp:36
CString & copy(this const CString &self, CString &dest, Typing::USize chars)
Copies somes bytes from the internal buffer to another string's internal buffer.
Definition CString.cpp:21
const char * get(this const CString &self)
Gets the internal buffer.
Definition CString.cpp:51
bool operator==(this const CString &self, const CString &other)
Checks if a string is the same than this one.
Definition CString.cpp:56
bool has(this const CString &self, char ch)
Checks if this string contains a given character.
Definition CString.cpp:27
bool operator>=(this const CString &self, const CString &other)
Checks if this string is bigger than or equals another.
Definition CString.cpp:81
const char * end(this const CString &self)
Gets a pointer to the end of the internal buffer.
Definition CString.cpp:46
bool operator<(this const CString &self, const CString &other)
Checks if this string is smaller than another.
Definition CString.cpp:66
char & operator[](this CString &self, Typing::USize index)
Gets a character by its index in the string.
Definition CString.cpp:86
bool operator<=(this const CString &self, const CString &other)
Checks if this string is smaller than or equals another.
Definition CString.cpp:76
const char * begin(this const CString &self)
Gets a pointer to the base of the internal buffer.
Definition CString.cpp:41
bool operator!=(this const CString &self, const CString &other)
Checks if a string is different to this one.
Definition CString.cpp:61
bool operator>(this const CString &self, const CString &other)
Checks if this string is bigger than another.
Definition CString.cpp:71
CString(const char *s)
Constructs the object from a given null-terminated string.
Definition CString.cpp:9
Contains various classes and functions for memory management.
Definition Buffer.hpp:10
size_t USize
Biggest unsigned type.
Definition Typing.hpp:38