Catos Engine (Source) 0.0.1
Lightweight Game engine
Loading...
Searching...
No Matches
string.h
Go to the documentation of this file.
1//
2// Created by allos on 8/22/2024.
3//
4
5#ifndef CATOS_STRING_H
6#define CATOS_STRING_H
7
8namespace catos {
9
11 class string {
12
13 public:
14
16 string() : buf(nullptr), size(0) {};
17
19 string(const char* buffer);
20
22 string(const string& obj);
23
25 string(string&& obj);
26
28 string& operator=(const string& obj);
29
31 string& operator=(string&& obj);
32
34 string operator+(const string& obj);
35
37 unsigned int length() { return size; };
38
40 const char* c_str() const { return buf; };
41
42
43
45 ~string();
46
47 private:
48 void cleanUp();
49
50 char* buf = nullptr;
51 unsigned int size = 0;
52
53 };
54
55
56
57}
58
59
60
61#endif //CATOS_STRING_H
Definition application.h:13
Custom string class that functions as dynamic C_str.
Definition string.h:11
string operator+(const string &obj)
Adds a string to itself.
Definition string.cpp:67
string()
Initializes the internal buff to nullptr and size to 0.
Definition string.h:16
const char * c_str() const
Returns the internal buffer;.
Definition string.h:40
~string()
Deletes the allocated char array.
Definition string.cpp:8
string & operator=(const string &obj)
Same as the string(const string& obj) constructor.
Definition string.cpp:28
unsigned int length()
Returns the size of the internal buffer.
Definition string.h:37