Re: IPropertyBag2 - Can I use it this way?
geekgrrl <geekgrrl71@hotmail.com> wrote:
I ended up imlementing the std::map<CString, VARIANT> for now with my
own interface methods to get/set these values. I believe that I could
keep my internal map, and use that to implememt the Read/Write methods
for IPropertyBag.
I was interested in the IPropertyBag as while I am not currently
loading/saving my property list to a file on disk, I can forsee that
this would be attractive to user, and by using IPropertyBag I could
eventually expand to use IPersistPropertyBag.
Note that IPersistPropertyBag typically works the other way round. The
object implements IPersistPropertyBag; its container implements
IPropertyBag and passes it to IPersistPropertyBag::Save. The object
writes its properties into the container-provided bag. The container
then persists these properties any way it sees fit. Similarly on load:
the container reads the data from whatever persistent storage it uses,
packs the properties into IPropertyBag instance it implements, and
finally passes the bag to the control's implementation of
IPersistPropertyBag::Load. The object extracts properties from the bag
and stores them in its internal data structures.
In other words, the control implementing IPropertyBag is not a
prerequisite, nor is it in any way helpful, for implementing
IPersistPropertyBag.
Currently the client has
to call SetProperty( name, value) for each property they want to set.
I can see them wanting to suck this up from a file on disk.
Clearly then, it's the client that would have to implement IPropertyBag,
not the object.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925