aboutsummaryrefslogtreecommitdiff
path: root/backend/String.h
blob: e41222e7bd93203684dc3251f99b16d9dfc139e6 (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
#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;

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

};