yum-slop/TaSTT
Free self-hosted STT for VRChat.
git clone https://git.yummers.dev/yum-slop/TaSTT
97dcd16
master
RYML has decided to stop working and I don't want to spend any more time trying to figure out why.
Let's make a parser that implements the small subset of YAML that Config.{h,cpp} rely on.
Config needs to serialize the following types:
- std::string
- bool
- int
Bool will be serialized like ints, with additional requirements on deserialization.
Serialization looks like this:
ConfigMarshall cm(out_);
cm.Append("microphone", microphone_); // string
cm.Append("rows", rows_); // int
cm.Append("use_cpu", use_cpu_); // bool
cm.Write("config.yml");
Deserialization looks like this:
ConfigMarshall cm(out_);
cm.Load("config.yml");
cm.Get("microphone", microphone_); // string
cm.Get("rows", rows_); // int
cm.Get("use_cpu", use_cpu_); // bool
Interface:
class ConfigMarshal {
public:
ConfigMarshall(wxTextCtrl *out);
bool Save(const std::filesystem::path& path);
bool Load(const std::filesystem::path& path);
template <typename T>
bool Append(const std::string& key, const T& value);
template <typename T>
bool Get(const std::string& key, T& value);
private:
std::map<std::string, std::string> kv_str_;
std::map<std::string, int> kv_int_;
std::map<std::string, bool> kv_bool_;
}
1RYML has decided to stop working and I don't want to spend any more time trying 2to figure out why. 3 4Let's make a parser that implements the small subset of YAML that 5Config.{h,cpp} rely on. 6 7Config needs to serialize the following types: 8 9* std::string 10* bool 11* int 12 13Bool will be serialized like ints, with additional requirements on 14deserialization. 15 16Serialization looks like this: 17``` 18ConfigMarshall cm(out_); 19cm.Append("microphone", microphone_); // string 20cm.Append("rows", rows_); // int 21cm.Append("use_cpu", use_cpu_); // bool 22cm.Write("config.yml"); 23``` 24 25Deserialization looks like this: 26``` 27ConfigMarshall cm(out_); 28cm.Load("config.yml"); 29cm.Get("microphone", microphone_); // string 30cm.Get("rows", rows_); // int 31cm.Get("use_cpu", use_cpu_); // bool 32``` 33 34Interface: 35``` 36class ConfigMarshal { 37public: 38ConfigMarshall(wxTextCtrl *out); 39 40bool Save(const std::filesystem::path& path); 41bool Load(const std::filesystem::path& path); 42 43template <typename T> 44bool Append(const std::string& key, const T& value); 45 46template <typename T> 47bool Get(const std::string& key, T& value); 48 49private: 50std::map<std::string, std::string> kv_str_; 51std::map<std::string, int> kv_int_; 52std::map<std::string, bool> kv_bool_; 53} 54``` 55