25#ifndef SRC_HEADERS_GX_JSON_H_
26#define SRC_HEADERS_GX_JSON_H_
46 virtual const char*
what()
const throw() {
return what_str.c_str(); }
75 void write(
float v,
bool nl =
false);
76 void write(
double v,
bool nl =
false);
77 void write(
int i,
bool nl =
false);
78 void write(
unsigned int i,
bool nl =
false);
79 void write(
const char* p,
bool nl =
false);
80 void write(
const string& s,
bool nl =
false) {
write(s.c_str(), nl); }
147 istringstream b(
str);
153 istringstream b(
str);
161 bool read_kv(
const char *key,
unsigned int& i);
162 bool read_kv(
const char *key, std::string& s);
163 bool read_kv(
const char *key, Glib::ustring& s);
164 template<
class T>
inline bool read_kv(
const char *key, T& v) {
167 v =
static_cast<T
>(i);
328 bool set_factory(
const Glib::ustring& name_,
const std::string& path);
332 void open(
const std::string& fname);
353 bool rename(
const Glib::ustring&
name, Glib::ustring newname);
357 void insert_after(
const Glib::ustring& nm,
const Glib::ustring& newentry);
363 bool set_name(
const Glib::ustring& n,
const std::string& newfile);
429 bl_type::iterator
it;
442 const std::string& factory_path,
const char* scratchpad_name,
const char* scratchpad_file);
455 bool rename(
const Glib::ustring& oldname,
const Glib::ustring& newname,
const std::string& newfile);
456 void reorder(
const std::vector<Glib::ustring>& neworder);
501 bool rename_bank(
const Glib::ustring& oldname,
const Glib::ustring& newname,
const std::string& newfile);
gx_system::JsonWriter * jw
virtual void write_preset(JsonWriter &)=0
virtual ~AbstractPresetIO()
virtual void commit_preset()=0
virtual void read_preset(JsonParser &, const SettingsFileHeader &)=0
virtual void copy_preset(JsonParser &, const SettingsFileHeader &, JsonWriter &)=0
virtual ~AbstractStateIO()
virtual void read_state(JsonParser &, const SettingsFileHeader &)=0
virtual void write_state(JsonWriter &, bool)=0
virtual void commit_state()=0
void erase_preset(const Glib::ustring &name)
GxSettingsBase(gx_engine::EngineControl &seq_)
sigc::signal< void > selection_changed
AbstractStateIO * state_io
bool rename_bank(const Glib::ustring &oldname, const Glib::ustring &newname, const std::string &newfile)
void set_source_to_state()
bool convert_preset(PresetFile &pf)
sigc::signal< void > presetlist_changed
Glib::ustring current_bank
sigc::signal< void > & signal_selection_changed()
void reorder_preset(PresetFile &pf, const std::vector< Glib::ustring > &neworder)
void set_io(AbstractStateIO *st, AbstractPresetIO *pr)
void save_to_state(bool preserve_preset=false)
const Glib::ustring & get_current_name()
bool remove_bank(const Glib::ustring &bank)
Glib::ustring current_name
void save(PresetFile &pf, const Glib::ustring &name)
bool loadsetting(PresetFile *p, const Glib::ustring &name)
gx_engine::EngineControl & seq
const Glib::ustring & get_current_bank()
void append(PresetFile &pf, const Glib::ustring &src, PresetFile &pftgt, const Glib::ustring &name)
bool rename_preset(PresetFile &pf, const Glib::ustring &oldname, const Glib::ustring &newname)
sigc::signal< void > & signal_presetlist_changed()
void set_statefilename(const std::string &fn)
void load_preset(PresetFile *pf, const Glib::ustring &name)
void insert_before(PresetFile &pf, const Glib::ustring &src, PresetFile &pftgt, const Glib::ustring &pos, const Glib::ustring &name)
void insert_after(PresetFile &pf, const Glib::ustring &src, PresetFile &pftgt, const Glib::ustring &pos, const Glib::ustring &name)
PresetFile * get_current_bank_file()
AbstractPresetIO * preset_io
void erase_preset(PresetFile &pf, const Glib::ustring &name)
JsonExceptionEOF(const char *desc)
virtual const char * what() const
JsonException(const Glib::ustring &desc)
const char * get_token_name(token tok)
bool read_kv(const char *key, double &v)
float current_value_float()
double current_value_double()
bool read_kv(const char *key, Glib::ustring &s)
bool read_kv(const char *key, std::string &s)
void set_streampos(streampos pos)
void set_stream(istream *i)
void throw_unexpected(token expect)
bool read_kv(const char *key, float &v)
unsigned int current_value_uint()
bool read_kv(const char *key, int &i)
token read_value_token(char c)
streampos get_streampos()
bool read_kv(const char *key, T &v)
token next(token expect=no_token)
void copy_object(JsonWriter &jw)
void check_expect(token expect)
bool read_kv(const char *key, unsigned int &i)
string current_value() const
string readnumber(char c)
std::ostream & get_ostream()
void send_notify_begin(const char *method)
JsonSubParser(JsonParser &jp, streampos pos)
void write_key(const string &p, bool nl=false)
void write_kv(const char *key, float v)
void write(const string &s, bool nl=false)
void write(const char *p, bool nl=false)
void write(double v, bool nl=false)
void write_kv(const char *key, int i)
void begin_object(bool nl=false)
void write(int i, bool nl=false)
void write_kv(const char *key, unsigned int i)
JsonWriter(ostream *o=0, bool enable_newlines=true)
void write(float v, bool nl=false)
void set_stream(ostream *o)
void write_kv(const char *key, const char *p)
void begin_array(bool nl=false)
void end_object(bool nl=false)
void write_kv(const char *key, const std::string &s)
void write_kv(const char *key, double v)
void write_key(const char *p, bool nl=false)
void write_null(bool nl=false)
void write_lit(const string &s, bool nl=false)
void end_array(bool nl=false)
void write(unsigned int i, bool nl=false)
iterator(bl_type::iterator i)
bool operator!=(const iterator &i) const
PresetFile * operator->()
void parse_bank_list(bl_type::iterator pos)
void readJSON_remote(gx_system::JsonParser &jp)
static std::string add_preset_postfix(const std::string &filename)
void parse(const std::string &bank_path, const std::string &preset_dir, const std::string &factory_path, const char *scratchpad_name, const char *scratchpad_file)
bool has_entry(const Glib::ustring &bank) const
void reorder(const std::vector< Glib::ustring > &neworder)
bool remove(const Glib::ustring &bank)
PresetFile * get_file(const Glib::ustring &bank) const
void parse_factory_list(const std::string &path)
bool rename(const Glib::ustring &oldname, const Glib::ustring &newname, const std::string &newfile)
void insert(PresetFile *f, int position=0)
static void make_valid_utf8(Glib::ustring &s)
std::list< PresetFile * > bl_type
Glib::ustring get_name(int n)
void make_bank_unique(Glib::ustring &name, std::string *file=0)
int get_index(const Glib::ustring &bank) const
bool has_file(const std::string &file) const
void collect_lost_banks(const char *scratchpad_name, const char *scratchpad_file)
static bool strip_preset_postfix(std::string &name)
Position(Glib::ustring n, streampos p)
void insert_before(const Glib::ustring &nm, const Glib::ustring &newentry)
void fill_names(vector< Glib::ustring > &)
void readJSON_remote(JsonParser &jp)
std::vector< Position >::iterator iterator
PresetTransformer * create_transformer()
std::vector< Position > entries
PresetFileGui * get_guiwrapper()
const Glib::ustring & get_name() const
int get_index(const Glib::ustring &name)
bool has_entry(const Glib::ustring &name)
const SettingsFileHeader & get_header()
bool set_factory(const Glib::ustring &name_, const std::string &path)
JsonWriter * create_writer(int n)
void writeJSON(JsonWriter &jw)
JsonWriter * create_writer(const Glib::ustring &name)
void set_flag(int flag, bool v)
JsonParser * create_reader(const Glib::ustring &name)
void open(const std::string &fname)
bool erase(const Glib::ustring &name)
bool create_file(const Glib::ustring &name, const std::string &path, int tp, int flags)
bool open_file(const Glib::ustring &name, const std::string &path, int tp, int flags)
bool rename(const Glib::ustring &name, Glib::ustring newname)
SettingsFileHeader header
const Glib::ustring & get_name(int n)
JsonWriter * create_writer_at(const Glib::ustring &pos, const Glib::ustring &name)
void append(const Glib::ustring &name)
bool set_name(const Glib::ustring &n, const std::string &newfile)
bool readJSON(const std::string &dirpath, JsonParser &jp, bool *mtime_diff)
void writeJSON_remote(JsonWriter &jw)
JsonParser * create_reader(int n)
void insert_after(const Glib::ustring &nm, const Glib::ustring &newentry)
const std::string & get_filename() const
const SettingsFileHeader & get_header() const
JsonParser * create_reader()
SettingsFileHeader header
void set_filename(const string &fn)
JsonWriter * create_writer(bool *preserve_preset)
string get_filename() const
@ PRESET_FLAG_VERSIONDIFF