10-04-2016, 11:33 PM
(10-04-2016, 06:06 PM)Rick Johnson Wrote: If several plugins (mine plus other developers') all do an async POST or GET at startup, will their respective responses be directed back to the proper plugins, or do I need to somehow find a later "safe" time to initiate that?
Callbacks will always be executed in the correct context. Don't worry about other plugins and whatnot.
(10-04-2016, 06:06 PM)Rick Johnson Wrote: Trying to cast an std::auto_ptr<PrefData> to an std::auto_ptr<StringPref> typically fails to build when system memory headers refuse to acknowledge the typecast.
You cannot directly cast an auto_ptr<SomeType> to an auto_ptr<AnotherType>. The auto_ptr class simply contains a pointer to an object of a given type, and automatically handles the memory for said object. As such, simply cast the raw pointer it contains by acquiring said pointer with auto_ptr::get().
(10-04-2016, 06:06 PM)Rick Johnson Wrote: The header notes make frequent references to "JSON node to get from the top-level" which makes me question the relevance of a multi-level tree structure, at least as far as an iterator can see. Is a record that contains a few strings considered a Dictionary type that should be parsed in a separate operation?
There is no reason that any arbitrary hierarchy can't be used, and the entirety of the JSON string you provide is parsed (you do not need to separately parse sections of it). Container-type subclasses of the PrefData class can contain any other PrefData subclass in as deep of a hierarchy as you'd like. Perhaps you need to review the structure and "types" that JSON supports? And review all the hdi::core:refData subclasses? Any possible structure/data that can be represented by JSON can be handled by the various PrefData subclasses.
(10-04-2016, 06:06 PM)Rick Johnson Wrote: So far, iter.value() has been useless; my fallback has been dict.member(name, data), but I can't be certain no two fields will have the same name, especially if it parses more than one level. E.g., every SQL record will have an ID no., unique within its own table. Is there any syntax that simply pulls a string or number from iter.value()?
Well, obviously two entries in a dictionary cannot have the same name, so if that's what you're referring to then you need to rethink your dictionary structure. If you mean that you might have multiple dictionaries with identically-named entries contained within an array, then of course only the entry with the name you provide will be accessed in the target dictionary, and not some other dictionary contained within the array.
Lastly, I wonder why you are relying on dictionary member iteration at all. If you're writing the server-side code that generates the JSON, then you're in complete control of the structure and the names of the members in said structure. As such, you should be able to create a structure with stable/known entry names and use hdi::core:ictionaryPref::member() or hdi::core:ictionaryPref::get*Member() to get the job done.