11#pragma once
22
33#include " event_enums.h"
4+ #include " writer_flags.h"
5+
46#include " json/json.h"
57
68typedef struct instance_item_s {
79 pfc::string8 name;
810 pfc::string8 filename;
911 pfc::string8 format_string;
10- bool write_to_file;
11- bool log_mode;
12- bool enable_delay;
12+ bool write_to_file = false ;
13+ bool log_mode = false ;
14+ bool enable_delay = false ;
1315 uint32_t delay = 0 ;
1416 bool events[EVENT_COUNT];
15- bool on_exit;
17+ bool on_exit = false ;
1618 pfc::string8 on_exit_str;
17- uint8_t encoding;
18- bool changes_only;
19- bool clipboard;
19+ uint8_t encoding = ENCODING_UTF8 ;
20+ bool changes_only = false ;
21+ bool clipboard = false ;
2022 bool _breserved2 = false ;
2123 bool _breserved3 = false ;
2224 bool _breserved4 = false ;
@@ -29,43 +31,10 @@ typedef struct instance_item_s {
2931 pfc::string8 _sreserved3;
3032 pfc::string8 _sreserved4;
3133
32- instance_item_s (const char * p_name, const char * p_filename, const char * p_format_string,
33- const bool p_write_to_file, const bool p_log_mode, const bool p_enable_delay, const uint32_t p_delay,
34- const bool (&p_events)[EVENT_COUNT], const bool p_on_exit, const char *p_on_exit_str, const uint8_t p_encoding,
35- const bool p_changes_only, const bool p_clipboard)
36- : name(p_name), filename(p_filename), format_string(p_format_string), log_mode(p_log_mode),
37- enable_delay(p_enable_delay), delay(p_delay), on_exit(p_on_exit), on_exit_str(p_on_exit_str),
38- encoding(p_encoding), changes_only(p_changes_only), clipboard(p_clipboard)
39- {
40- for (uint32_t i = 0 ; i < EVENT_COUNT; i++) {
41- events[i] = p_events[i];
42- pfc::string_formatter str;
43- console::print (str << p_events[i]);
44- }
45- }
46- instance_item_s (const char * p_name, const char * p_filename, const char * p_format_string, const bool p_write_to_file,
47- const bool p_log_mode, const bool p_enable_delay, const uint32_t p_delay, const std::initializer_list <uint32_t > p_events,
48- const bool p_on_exit, const char *p_on_exit_str, const uint8_t p_encoding, const bool p_changes_only,
49- const bool p_clipboard)
50- : name(p_name), filename(p_filename), format_string(p_format_string), log_mode(p_log_mode),
51- enable_delay(p_enable_delay), delay(p_delay), write_to_file(p_write_to_file), on_exit(p_on_exit),
52- on_exit_str(p_on_exit_str), encoding(p_encoding), changes_only(p_changes_only), clipboard(p_clipboard)
53- {
34+ instance_item_s (const char *p_name) : name(p_name) {
5435 reset_events ();
55-
56- for (auto f : p_events) {
57- if (f >= EVENT_COUNT) {
58- pfc::string_formatter str;
59- console::info (str << " WARNING: got invalid event during 'instance_item_s' initialization: " << f);
60- }
61- else {
62- events[f] = true ;
63- }
64- }
6536 }
6637 instance_item_s (Json::Value &p_data) {
67-
68-
6938 if (!p_data[" name" ].isString ()) {
7039 throw std::invalid_argument (" 'name' expected type string" );
7140 }
0 commit comments