-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add array-like category type #9
Comments
Fair idea, someone also proposed that to me privately before, so I guess it's not such a terrible idea. The question is how would we address them in the API? We still need some ID for them. Maybe just something like size_t getArrayLikeSpecialCount(const char* name); and then std::any getArraySpecialConfigValue(const char* cat, const char* value, size_t idx); ? edit: fwiw, this syntax would support key-based categories too, no reason to disallow keys from being there. |
That seems reasonable. Can't be easily iteratable in for loop as it is with iterators but I don't think that's an issue. Plus, an additional API can be added. Something like: std::vector<std::any> getArrayLikeSpecial(const char* name); |
we cannot share stl types across lib and app, so that would be a bit painful to query for all strings. |
Ah, didn't know that. Still, your suggestion is good. I can't think of any other way that will be better. |
I'd love to be able to define multiple instances of a category inside an array.
Currently there's special category that can be defined multiple times to hold config data. Such as:
However, a special category is required to have a primary key which is then used to retrieve it's config values.
If I wanted to define an unlimited number of categories of the same type I'd then have to use an incremental primary key which I would need to keep track of. Especially it would be even more difficult when I would remove several definitions. A gap in primary key sequence would occur and then I'd have to look for the highest ones and lower them in order to keep them unique and continuous.
So I propose a new syntax for defining multiple instance of the same category without a primary key (similar to json):
I tihnk that the comma separating categories isn't necessary.
The text was updated successfully, but these errors were encountered: