Guitarix
gx_json.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
3 * Copyright (C) 2011 Pete Shorthose
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 * --------------------------------------------------------------------------
19 */
20
21/* ------- This is the System namespace ------- */
22
23#pragma once
24
25#ifndef SRC_HEADERS_GX_JSON_H_
26#define SRC_HEADERS_GX_JSON_H_
27
28namespace gx_engine {
29class GxMachine;
30class GxMachineRemote;
31}
32
33namespace gx_system {
34
35/****************************************************************
36 ** class JsonParser, class JsonWriter, class JsonException
37 ** classes for reading and writing JSON files
38 */
39
40class JsonException: public exception {
41 protected:
42 Glib::ustring what_str;
43 public:
44 JsonException(const Glib::ustring& desc);
45 ~JsonException() throw() { }
46 virtual const char* what() const throw() { return what_str.c_str(); }
47};
48
50 public:
51 JsonExceptionEOF(const char* desc): JsonException(desc) {}
52 ~JsonExceptionEOF() throw() { }
53};
54
56 private:
57 ostream *os;
58 bool first;
60 string indent;
61 void snl(bool v) { if (deferred_nl >= 0) deferred_nl = (v ? 1 : 0); }
62 void komma();
63 void space();
64 void iplus();
65 void iminus();
66 public:
67 JsonWriter(ostream* o = 0, bool enable_newlines = true);
68 virtual ~JsonWriter();
69 void reset();
70 void set_stream(ostream* o) { os = o; }
71 bool good() { return os->good(); }
72 void flush();
73 virtual void close();
74 bool is_closed() { return !os; }
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); }
81 void write_kv(const char *key, float v) { write_key(key); write(v, true); }
82 void write_kv(const char *key, double v) { write_key(key); write(v, true); }
83 void write_kv(const char *key, int i) { write_key(key); write(i, true); }
84 void write_kv(const char *key, unsigned int i) { write_key(key); write(i, true); }
85 void write_kv(const char *key, const char* p) { write_key(key); write(p, true); }
86 void write_kv(const char *key, const std::string& s) { write_key(key); write(s, true); }
87 void write_lit(const string& s, bool nl = false);
88 void begin_object(bool nl = false);
89 void end_object(bool nl = false);
90 void begin_array(bool nl = false);
91 void end_array(bool nl = false);
92 void write_key(const char* p, bool nl = false);
93 void write_key(const string& p, bool nl = false);
94 void write_null(bool nl = false) { write_lit("null", nl); }
95 void newline() { snl(true); }
96};
97
98
100private:
101 ostringstream stream;
102public:
104 void send_notify_begin(const char *method);
106 void reset() { stream.str(""); }
107 void finish() { stream << endl; }
108 std::string get_string() { return stream.str(); }
109};
110
111
113 public:
114 JsonParser(istream* i = 0);
115 virtual ~JsonParser();
116 virtual void close();
117 void reset();
118 bool is_closed() { return !is; }
119 void set_stream(istream* i) { is = i; }
120 istream *get_stream() { return is; }
121 enum token {
122 no_token = 0x0000,
123 end_token = 0x0001,
125 end_object = 0x0004,
126 begin_array = 0x0008,
127 end_array = 0x0010,
128 value_string = 0x0020,
129 value_number = 0x0040,
130 value_key = 0x0080,
131 value_null = 0x0100,
132 value_false = 0x0200,
133 value_true = 0x0400,
134 value_bool = 0x0600, // value_false | value_true
135 };
136 const char* get_token_name(token tok);
137 bool good() { return is->good(); }
139 token peek() { return next_tok; }
140 streampos get_streampos() { return next_pos + streamoff(-1); }
141 void set_streampos(streampos pos);
142 void check_expect(token expect) { if ((cur_tok & expect) == 0) throw_unexpected(expect); }
143 inline string current_value() const { return str; }
144 int current_value_int() { return atoi(str.c_str()); }
145 unsigned int current_value_uint() { return atoi(str.c_str()); }
147 istringstream b(str);
148 float f;
149 b >> f;
150 return f;
151 }
153 istringstream b(str);
154 double d;
155 b >> d;
156 return d;
157 }
158 bool read_kv(const char *key, float& v);
159 bool read_kv(const char *key, double& v);
160 bool read_kv(const char *key, int& i);
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) {
165 int i;
166 if (read_kv(key, i)) {
167 v = static_cast<T>(i);
168 return true;
169 }
170 return false;
171 }
175 private:
176 istream* is;
177 int depth;
179 string str;
180 bool nl;
183 string next_str;
184 string log_tok;
185 streampos next_pos;
186 const char* readcode();
187 string readstring();
189 string readnumber(char c);
190 void read_next();
191};
192
193
195private:
196 std::streampos position;
197public:
198 JsonSubParser(JsonParser& jp, streampos pos);
200};
201
203private:
204 std::stringstream stream;
205public:
207 void put(char c) { stream.put(c); }
208 std::ostream& get_ostream() { return stream; }
209 void start_parser() { stream.seekg(0); set_stream(&stream); }
210 std::string get_string() { return stream.str(); }
211 void reset() { stream.str(""); JsonParser::reset(); }
212 char peek_first_char() { stream >> ws; return stream.peek(); }
213};
214
215
216/****************************************************************
217 ** Setting file handling
218 ** class SettingsFileHeader, class StateFile, class PresetFile,
219 ** class AbstractStateIO, class AbstractPresetIO
220 ** class PresetBanks
221 ** class GxSettingsBase
222 */
223
228public:
229 enum {
230 major = 1,
231 minor = 2
232 };
233 static const string gx_version; // = GX_VERSION
237 static void write(JsonWriter&);
239 int get_major() const { return file_major; }
240 int get_minor() const { return file_minor; }
241 string get_revision() const { return file_gx_version; }
242 bool is_major_diff() const { return major != file_major; }
243 bool is_minor_diff() const { return minor != file_minor; }
244 bool is_current() const { return !is_major_diff() && !is_minor_diff(); }
245 bool is_equal() const { return is_current() && gx_version == file_gx_version; }
246 string display() const { ostringstream s; s << file_major << "." << file_minor << "." << file_gx_version; return s.str(); }
247 Glib::ustring version_string() const { return Glib::ustring::compose("%1.%2", file_major, file_minor); }
248 inline Glib::ustring current_version_string() const { return Glib::ustring::compose("%1.%2", int(major), int(minor)); }
249 static bool make_empty_settingsfile(const string& name);
253};
254
256private:
257 string filename;
258 istream *is;
259 time_t mtime;
261 void open();
262public:
264 : filename(), is(0), mtime(), header() {}
265 ~StateFile() { delete is; }
266 void set_filename(const string& fn);
267 const SettingsFileHeader& get_header() const { return header; }
268 string get_filename() const { return filename; }
270 JsonWriter *create_writer(bool *preserve_preset);
272};
273
275private:
276 string filename;
277 string tmpfile;
278 ofstream os;
279protected:
280 istream *is;
281public:
284 void close();
286 void abort();
287 PresetTransformer(string filename, istream* is);
289};
290
291enum {
295};
296
297class PresetFileGui;
298
299class PresetFile : boost::noncopyable {
300public:
302protected:
303 class Position {
304 public:
305 Glib::ustring name;
306 streampos pos;
307 Position(Glib::ustring n, streampos p): name(n), pos(p) {}
308 };
309 std::string filename;
310 ifstream *is;
311 time_t mtime;
313 std::vector<Position> entries;
314 Glib::ustring name;
315 int tp;
316 int flags;
318protected:
319 void open();
320public:
321 typedef std::vector<Position>::iterator iterator;
323 ~PresetFile() { delete is; }
326 bool open_file(const Glib::ustring& name, const std::string& path, int tp, int flags);
327 bool create_file(const Glib::ustring& name, const std::string& path, int tp, int flags);
328 bool set_factory(const Glib::ustring& name_, const std::string& path);
329 bool readJSON(const std::string& dirpath, JsonParser &jp, bool *mtime_diff);
331 void reopen() { if (!is && !filename.empty()) open(); }
332 void open(const std::string& fname);
333 void close() { delete is; is = 0; }
334 bool fail();
337 const std::string& get_filename() const { return filename; }
339 int size();
340 void fill_names(vector<Glib::ustring>&);
341 const Glib::ustring& get_name(int n);
342 int get_index(const Glib::ustring& name);
344 JsonParser *create_reader(const Glib::ustring& name) {
345 return create_reader(get_index(name)); }
347 return create_writer(get_name(n)); }
348 JsonWriter *create_writer(const Glib::ustring& name);
349 JsonWriter *create_writer_at(const Glib::ustring& pos, const Glib::ustring& name);
351 bool clear();
352 bool erase(const Glib::ustring& name);
353 bool rename(const Glib::ustring& name, Glib::ustring newname);
354 bool has_entry(const Glib::ustring& name) { return get_index(name) >= 0; }
355 void append(const Glib::ustring& name);
356 void insert_before(const Glib::ustring& nm, const Glib::ustring& newentry);
357 void insert_after(const Glib::ustring& nm, const Glib::ustring& newentry);
358 int get_flags() const { return flags; }
359 void set_flags(int f) { flags = f; }
360 void set_flag(int flag, bool v) { flags = (flags & ~flag) | (v ? flag : 0); }
361 int get_type() const { return tp; }
362 const Glib::ustring& get_name() const { return name; }
363 bool set_name(const Glib::ustring& n, const std::string& newfile);
366 iterator end() { return entries.end(); }
367 bool is_moveable() const { return tp == PRESET_SCRATCH || tp == PRESET_FILE; }
368 bool is_mutable() const { return is_moveable() && !flags; }
370 bool is_newer(time_t m);
371};
372
373class PresetFileGui: private PresetFile {
374private:
377 friend class PresetFile;
380public:
382 using PresetFile::size;
389 using PresetFile::begin;
390 using PresetFile::end;
393 operator PresetFile*() { return this; }
394};
395
396inline PresetFileGui *PresetFile::get_guiwrapper() { return static_cast<PresetFileGui*>(this); }
397
399public:
401 virtual void read_state(JsonParser&,const SettingsFileHeader&) = 0;
402 virtual void commit_state() = 0;
403 virtual void write_state(JsonWriter&, bool) = 0;
404};
405
407public:
409 virtual void read_preset(JsonParser&,const SettingsFileHeader&) = 0;
410 virtual void commit_preset() = 0;
411 virtual void write_preset(JsonWriter&) = 0;
413};
414
416private:
417 typedef std::list<PresetFile*> bl_type;
419 std::string filepath;
420 time_t mtime;
421 std::string preset_dir;
422 void parse_factory_list(const std::string& path);
423 void parse_bank_list(bl_type::iterator pos);
424 void collect_lost_banks(const char* scratchpad_name, const char* scratchpad_file);
426public:
427 class iterator {
428 private:
429 bl_type::iterator it;
430 public:
431 iterator(bl_type::iterator i): it(i) {}
432 bool operator!=(const iterator& i) const { return it != i.it; }
433 iterator& operator++() { ++it; return *this; }
434 PresetFile* operator->() { return *it; }
435 PresetFile* operator*() { return *it; }
436 };
441 void parse(const std::string& bank_path, const std::string& preset_dir,
442 const std::string& factory_path, const char* scratchpad_name, const char* scratchpad_file);
443 PresetFile* get_file(const Glib::ustring& bank) const;
444 int get_index(const Glib::ustring& bank) const;
445 iterator begin() { return iterator(banklist.begin()); }
446 iterator end() { return iterator(banklist.end()); }
447 bool remove(const Glib::ustring& bank);
449 void save();
450 int size() { return banklist.size(); }
451 Glib::ustring get_name(int n);
452 void insert(PresetFile* f, int position = 0);
453 bool has_entry(const Glib::ustring& bank) const { return get_file(bank) != 0; }
454 bool has_file(const std::string& file) const;
455 bool rename(const Glib::ustring& oldname, const Glib::ustring& newname, const std::string& newfile);
456 void reorder(const std::vector<Glib::ustring>& neworder);
457 static void make_valid_utf8(Glib::ustring& s);
458 static std::string add_preset_postfix(const std::string& filename);
459 static bool strip_preset_postfix(std::string& name);
460 void make_bank_unique(Glib::ustring& name, std::string *file = 0);
461};
462
464protected:
469 Glib::ustring current_bank;
470 Glib::ustring current_name;
472 sigc::signal<void> selection_changed;
473 sigc::signal<void> presetlist_changed;
474 bool loadsetting(PresetFile *p, const Glib::ustring& name);
475protected:
476 void loadstate();
478public:
479 inline sigc::signal<void>& signal_selection_changed() {
480 return selection_changed; }
481 inline sigc::signal<void>& signal_presetlist_changed() {
482 return presetlist_changed; }
485 const Glib::ustring& get_current_bank() { return current_bank; }
487 const Glib::ustring& get_current_name() { return current_name; }
488 void set_statefilename(const std::string& fn) { statefile.set_filename(fn); }
489 void save_to_state(bool preserve_preset=false);
491 void erase_preset(const Glib::ustring& name);
492 bool setting_is_preset() { return !current_bank.empty(); }
494 void reorder_preset(PresetFile& pf, const std::vector<Glib::ustring>& neworder);
495 void erase_preset(PresetFile& pf, const Glib::ustring& name);
496 void save(PresetFile& pf, const Glib::ustring& name);
497 void append(PresetFile& pf, const Glib::ustring& src, PresetFile& pftgt, const Glib::ustring& name);
498 void insert_before(PresetFile& pf, const Glib::ustring& src, PresetFile& pftgt, const Glib::ustring& pos, const Glib::ustring& name);
499 void insert_after(PresetFile& pf, const Glib::ustring& src, PresetFile& pftgt, const Glib::ustring& pos, const Glib::ustring& name);
500 void load_preset(PresetFile *pf, const Glib::ustring& name);
501 bool rename_bank(const Glib::ustring& oldname, const Glib::ustring& newname, const std::string& newfile);
502 bool remove_bank(const Glib::ustring& bank);
503 bool rename_preset(PresetFile& pf, const Glib::ustring& oldname, const Glib::ustring& newname);
504};
505
506} /* end of gx_system namespace */
507#endif // SRC_HEADERS_GX_JSON_H_
gx_system::JsonWriter * jw
Definition: machine.h:406
virtual void write_preset(JsonWriter &)=0
virtual void commit_preset()=0
virtual void read_preset(JsonParser &, const SettingsFileHeader &)=0
virtual void copy_preset(JsonParser &, const SettingsFileHeader &, JsonWriter &)=0
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
Definition: gx_json.h:472
AbstractStateIO * state_io
Definition: gx_json.h:465
bool rename_bank(const Glib::ustring &oldname, const Glib::ustring &newname, const std::string &newfile)
bool convert_preset(PresetFile &pf)
sigc::signal< void > presetlist_changed
Definition: gx_json.h:473
Glib::ustring current_bank
Definition: gx_json.h:469
sigc::signal< void > & signal_selection_changed()
Definition: gx_json.h:479
void reorder_preset(PresetFile &pf, const std::vector< Glib::ustring > &neworder)
void set_io(AbstractStateIO *st, AbstractPresetIO *pr)
Definition: gx_json.h:477
void save_to_state(bool preserve_preset=false)
const Glib::ustring & get_current_name()
Definition: gx_json.h:487
bool remove_bank(const Glib::ustring &bank)
Glib::ustring current_name
Definition: gx_json.h:470
void save(PresetFile &pf, const Glib::ustring &name)
bool loadsetting(PresetFile *p, const Glib::ustring &name)
gx_engine::EngineControl & seq
Definition: gx_json.h:471
const Glib::ustring & get_current_bank()
Definition: gx_json.h:485
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()
Definition: gx_json.h:481
void set_statefilename(const std::string &fn)
Definition: gx_json.h:488
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()
Definition: gx_json.h:486
AbstractPresetIO * preset_io
Definition: gx_json.h:466
void erase_preset(PresetFile &pf, const Glib::ustring &name)
JsonExceptionEOF(const char *desc)
Definition: gx_json.h:51
Glib::ustring what_str
Definition: gx_json.h:42
virtual const char * what() const
Definition: gx_json.h:46
JsonException(const Glib::ustring &desc)
const char * get_token_name(token tok)
bool read_kv(const char *key, double &v)
float current_value_float()
Definition: gx_json.h:146
double current_value_double()
Definition: gx_json.h:152
bool read_kv(const char *key, Glib::ustring &s)
bool read_kv(const char *key, std::string &s)
void set_streampos(streampos pos)
streampos next_pos
Definition: gx_json.h:185
void set_stream(istream *i)
Definition: gx_json.h:119
void throw_unexpected(token expect)
istream * get_stream()
Definition: gx_json.h:120
bool read_kv(const char *key, float &v)
unsigned int current_value_uint()
Definition: gx_json.h:145
bool read_kv(const char *key, int &i)
const char * readcode()
token read_value_token(char c)
streampos get_streampos()
Definition: gx_json.h:140
bool read_kv(const char *key, T &v)
Definition: gx_json.h:164
token next(token expect=no_token)
virtual void close()
void copy_object(JsonWriter &jw)
JsonParser(istream *i=0)
void check_expect(token expect)
Definition: gx_json.h:142
bool read_kv(const char *key, unsigned int &i)
string current_value() const
Definition: gx_json.h:143
string readnumber(char c)
std::ostream & get_ostream()
Definition: gx_json.h:208
std::string get_string()
Definition: gx_json.h:210
std::stringstream stream
Definition: gx_json.h:204
void send_notify_begin(const char *method)
std::string get_string()
Definition: gx_json.h:108
ostringstream stream
Definition: gx_json.h:101
std::streampos position
Definition: gx_json.h:196
JsonSubParser(JsonParser &jp, streampos pos)
void write_key(const string &p, bool nl=false)
void write_kv(const char *key, float v)
Definition: gx_json.h:81
void write(const string &s, bool nl=false)
Definition: gx_json.h:80
void write(const char *p, bool nl=false)
void snl(bool v)
Definition: gx_json.h:61
void write(double v, bool nl=false)
void write_kv(const char *key, int i)
Definition: gx_json.h:83
void begin_object(bool nl=false)
void write(int i, bool nl=false)
void write_kv(const char *key, unsigned int i)
Definition: gx_json.h:84
JsonWriter(ostream *o=0, bool enable_newlines=true)
void write(float v, bool nl=false)
void set_stream(ostream *o)
Definition: gx_json.h:70
void write_kv(const char *key, const char *p)
Definition: gx_json.h:85
virtual void close()
void begin_array(bool nl=false)
void end_object(bool nl=false)
void write_kv(const char *key, const std::string &s)
Definition: gx_json.h:86
void write_kv(const char *key, double v)
Definition: gx_json.h:82
void write_key(const char *p, bool nl=false)
void write_null(bool nl=false)
Definition: gx_json.h:94
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)
Definition: gx_json.h:431
bool operator!=(const iterator &i) const
Definition: gx_json.h:432
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)
std::string filepath
Definition: gx_json.h:419
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
Definition: gx_json.h:453
void reorder(const std::vector< Glib::ustring > &neworder)
bool remove(const Glib::ustring &bank)
PresetFile * get_file(const Glib::ustring &bank) const
iterator begin()
Definition: gx_json.h:445
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::string preset_dir
Definition: gx_json.h:421
std::list< PresetFile * > bl_type
Definition: gx_json.h:417
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)
Definition: gx_json.h:307
int get_type() const
Definition: gx_json.h:361
void insert_before(const Glib::ustring &nm, const Glib::ustring &newentry)
void fill_names(vector< Glib::ustring > &)
iterator end()
Definition: gx_json.h:366
void readJSON_remote(JsonParser &jp)
std::string filename
Definition: gx_json.h:309
std::vector< Position >::iterator iterator
Definition: gx_json.h:321
PresetTransformer * create_transformer()
std::vector< Position > entries
Definition: gx_json.h:313
PresetFileGui * get_guiwrapper()
Definition: gx_json.h:396
const Glib::ustring & get_name() const
Definition: gx_json.h:362
int get_index(const Glib::ustring &name)
bool has_entry(const Glib::ustring &name)
Definition: gx_json.h:354
const SettingsFileHeader & get_header()
bool set_factory(const Glib::ustring &name_, const std::string &path)
JsonWriter * create_writer(int n)
Definition: gx_json.h:346
void writeJSON(JsonWriter &jw)
JsonWriter * create_writer(const Glib::ustring &name)
void set_flag(int flag, bool v)
Definition: gx_json.h:360
int get_flags() const
Definition: gx_json.h:358
bool is_newer(time_t m)
JsonParser * create_reader(const Glib::ustring &name)
Definition: gx_json.h:344
void set_flags(int f)
Definition: gx_json.h:359
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 is_moveable() const
Definition: gx_json.h:367
bool rename(const Glib::ustring &name, Glib::ustring newname)
SettingsFileHeader header
Definition: gx_json.h:312
bool is_mutable() const
Definition: gx_json.h:368
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)
Glib::ustring name
Definition: gx_json.h:314
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
Definition: gx_json.h:337
SettingsFileHeader header
Definition: gx_json.h:283
PresetTransformer(string filename, istream *is)
static void write(JsonWriter &)
void read_major_minor(JsonParser &jp)
bool is_major_diff() const
Definition: gx_json.h:242
static void write_current_major_minor(JsonWriter &jw)
static const string gx_version
Definition: gx_json.h:233
Glib::ustring current_version_string() const
Definition: gx_json.h:248
static bool make_empty_settingsfile(const string &name)
string display() const
Definition: gx_json.h:246
void write_major_minor(JsonWriter &jw)
Glib::ustring version_string() const
Definition: gx_json.h:247
string get_revision() const
Definition: gx_json.h:241
bool is_minor_diff() const
Definition: gx_json.h:243
const SettingsFileHeader & get_header() const
Definition: gx_json.h:267
JsonParser * create_reader()
SettingsFileHeader header
Definition: gx_json.h:260
void set_filename(const string &fn)
JsonWriter * create_writer(bool *preserve_preset)
string get_filename() const
Definition: gx_json.h:268
@ PRESET_FLAG_INVALID
Definition: gx_json.h:294
@ PRESET_FLAG_READONLY
Definition: gx_json.h:293
@ PRESET_FLAG_VERSIONDIFF
Definition: gx_json.h:292