Help - Search - Members - Calendar
Full Version: cfg_var array
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
Alexi
Hello

Does anyone know if there's any mechanism for saving an array of config values?
I am looking for something like cfg_int but for an array.

Thanks
Alex
foosion
For a fixed size array you can use a define a struct and use cfg_struct<T>:
CODE
struct my_array_struct {
    COLORREF colors[16];
};
static const my_array_struct g_default_value = {...};
static cfg_struct<my_array_struct> g_var(some_guid, g_default_value);


Otherwise you can use a list based cfg_var. See cfg_structlist_t<T> and cfg_guidlist in foobar2000_sdk_helpers for examples.
Alexi
QUOTE(foosion @ Aug 13 2007, 09:31) *

For a fixed size array you can use a define a struct and use cfg_struct<T>:
CODE
struct my_array_struct {
    COLORREF colors[16];
};
static const my_array_struct g_default_value = {...};
static cfg_struct<my_array_struct> g_var(some_guid, g_default_value);


Otherwise you can use a list based cfg_var. See cfg_structlist_t<T> and cfg_guidlist in foobar2000_sdk_helpers for examples.


Sweet. thanks for the code snippet!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.