aboutsummaryrefslogtreecommitdiff
path: root/backend/String.h
blob: cf4304fe1e2163596120190bb6b451f4dc377c6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once

#include <stddef.h>
#include <stdarg.h>

class String {
public:
	String();
	String(const char * c_str);
	String(const String &);
	~String();
public:
	static String va_fmt(va_list args, const char * fmt);
	static String fmt(const char * fmt, ...);

public:
	const char * c_str() const;
	char * data() const;
	size_t size() const;
	bool empty() const;

public:
	String & operator = (const String &);

private:
	void set(const char * data);
	void set(const char * data, size_t data_len);
private:
	char * _data = nullptr;
	size_t _data_len = 0;

};