Mercurial > foo_out_sdl
comparison foosdk/sdk/foobar2000/SDK/config_object.h @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 #ifndef _CONFIG_OBJECT_H_ | |
| 2 #define _CONFIG_OBJECT_H_ | |
| 3 | |
| 4 class config_object; | |
| 5 | |
| 6 class NOVTABLE config_object_notify_manager : public service_base | |
| 7 { | |
| 8 public: | |
| 9 virtual void on_changed(const service_ptr_t<config_object> & p_object) = 0; | |
| 10 static void g_on_changed(const service_ptr_t<config_object> & p_object); | |
| 11 | |
| 12 | |
| 13 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(config_object_notify_manager); | |
| 14 }; | |
| 15 | |
| 16 class NOVTABLE config_object : public service_base | |
| 17 { | |
| 18 public: | |
| 19 //interface | |
| 20 virtual GUID get_guid() const = 0; | |
| 21 virtual void get_data(stream_writer * p_stream,abort_callback & p_abort) const = 0; | |
| 22 virtual void set_data(stream_reader * p_stream,abort_callback & p_abort,bool p_sendnotify = true) = 0; | |
| 23 | |
| 24 //helpers | |
| 25 static bool g_find(service_ptr_t<config_object> & p_out,const GUID & p_guid); | |
| 26 | |
| 27 void set_data_raw(const void * p_data,t_size p_bytes,bool p_sendnotify = true); | |
| 28 t_size get_data_raw(void * p_out,t_size p_bytes); | |
| 29 t_size get_data_raw_length(); | |
| 30 | |
| 31 template<class T> void get_data_struct_t(T& p_out); | |
| 32 template<class T> void set_data_struct_t(const T& p_in); | |
| 33 template<class T> static void g_get_data_struct_t(const GUID & p_guid,T & p_out); | |
| 34 template<class T> static void g_set_data_struct_t(const GUID & p_guid,const T & p_in); | |
| 35 | |
| 36 void set_data_string(const char * p_data,t_size p_length); | |
| 37 void get_data_string(pfc::string_base & p_out); | |
| 38 | |
| 39 void get_data_bool(bool & p_out); | |
| 40 void set_data_bool(bool p_val); | |
| 41 void get_data_int32(t_int32 & p_out); | |
| 42 void set_data_int32(t_int32 p_val); | |
| 43 bool get_data_bool_simple(bool p_default); | |
| 44 t_int32 get_data_int32_simple(t_int32 p_default); | |
| 45 | |
| 46 static void g_get_data_string(const GUID & p_guid,pfc::string_base & p_out); | |
| 47 static void g_set_data_string(const GUID & p_guid,const char * p_data,t_size p_length = ~0); | |
| 48 | |
| 49 static void g_get_data_bool(const GUID & p_guid,bool & p_out); | |
| 50 static void g_set_data_bool(const GUID & p_guid,bool p_val); | |
| 51 static void g_get_data_int32(const GUID & p_guid,t_int32 & p_out); | |
| 52 static void g_set_data_int32(const GUID & p_guid,t_int32 p_val); | |
| 53 static bool g_get_data_bool_simple(const GUID & p_guid,bool p_default); | |
| 54 static t_int32 g_get_data_int32_simple(const GUID & p_guid,t_int32 p_default); | |
| 55 | |
| 56 | |
| 57 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(config_object); | |
| 58 }; | |
| 59 | |
| 60 class standard_config_objects | |
| 61 { | |
| 62 public: | |
| 63 static const GUID bool_remember_window_positions, bool_ui_always_on_top,bool_playlist_stop_after_current; | |
| 64 static const GUID bool_playback_follows_cursor, bool_cursor_follows_playback; | |
| 65 static const GUID bool_show_keyboard_shortcuts_in_menus; | |
| 66 static const GUID string_gui_last_directory_media,string_gui_last_directory_playlists; | |
| 67 static const GUID int32_dynamic_bitrate_display_rate; | |
| 68 | |
| 69 | |
| 70 inline static bool query_show_keyboard_shortcuts_in_menus() {return config_object::g_get_data_bool_simple(standard_config_objects::bool_show_keyboard_shortcuts_in_menus,true);} | |
| 71 inline static bool query_remember_window_positions() {return config_object::g_get_data_bool_simple(standard_config_objects::bool_remember_window_positions,true);} | |
| 72 | |
| 73 }; | |
| 74 | |
| 75 class config_object_notify : public service_base | |
| 76 { | |
| 77 public: | |
| 78 virtual t_size get_watched_object_count() = 0; | |
| 79 virtual GUID get_watched_object(t_size p_index) = 0; | |
| 80 virtual void on_watched_object_changed(const service_ptr_t<config_object> & p_object) = 0; | |
| 81 | |
| 82 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(config_object_notify); | |
| 83 }; | |
| 84 | |
| 85 #endif // _CONFIG_OBJECT_H_ |
