38 lines
907 B
C
38 lines
907 B
C
#pragma once
|
|
|
|
#include "Base.h"
|
|
|
|
// Need to sort out how formatted strings and string builders are allocated
|
|
// Maybe just use context.allocator?
|
|
// What about temp strings? use context.temp?
|
|
|
|
struct string {
|
|
s64 count;
|
|
u8* data;
|
|
// Construct from a string literal or C-string
|
|
string() { // default constructor
|
|
count = 0;
|
|
data = nullptr;
|
|
}
|
|
|
|
string(const char* cstr) {
|
|
count = strlen(cstr);
|
|
data = (u8*)cstr;
|
|
}
|
|
};
|
|
|
|
bool strings_match(string first_string, string second_string);
|
|
|
|
// ~ API ~ #TODO
|
|
// string string_view(string n_string, int start_index, int view_count);
|
|
// string copy_string(string original_string);
|
|
// string copy_string(char* c_string);
|
|
// void free(string& n_string);
|
|
|
|
bool is_valid(string n_string);
|
|
bool is_c_string(string n_string);
|
|
|
|
char* to_c_string(string n_string);
|
|
|
|
string format_string(char* format, ...);
|
|
string string_from_literal(char* literal); |