![]() |
Platforms, Frameworks & Libraries »
ATL »
General
Intermediate
Structured Storage Class for ATL & MFCBy Ales KrajncA wrapper class for most common IStorage methods and API calls. |
VC6, Windows, MFC, ATL, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
Structured storage is a useful tool in the software development. It allows us to open a single binary file and section it into several storages (which may be nested). Each storage may have one or more streams, which are used to write and retrieve the program specific information.
All this functionality is built around COM objects that MS provides with the Windows OS. We access it via IStorage and IStream interfaces and a few API function calls. This, however, is a tedious job and I decided to write a thin wrapper around these interfaces and API calls.
StructuredStorage ss; // // Let's create a file. This also creates the root storage. // ss.CreateFile(L"SSTest.bin"); // // Let's create a storage on the root one. // ss.CreateStorage(L"FirstLevel"); // // Create a stream and write to it // CComPtrspIStr; ss.CreateStream(&spIStr, L"A stream"); CComBSTR bs(L"Some text to be written into the stream!"); bs.WriteToStream(spIStr); // // ...
CString and CList
and is therefore bound
with MFC library. We need the structured storage functionality
in a COM control and therefore the linkage to MFC is not desired.
Although my solution eliminates the shortcomings above, it adds some new:
"ATLBase.h"). Again, some
people dislike this header in MFC code.
If the root storage is also the root of the structured file, say "C:\test\StructFile.bin", level 1 is "Level 1", level 2 is "Level 2", ... then the path to the current storage is:
"C:\test\StructFile.bin|Level1|Level2|...|LevelN"
Vertical char | is used to emphasize the borderline between the storages. Note, that the part of the path "Level1|Level2|...|LevelN" is hidden inside the "StructFile.bin" file.
The front and the back of the vector are the most important storages. The former presents the root storage, while the later presents the current storage.
StructuredStorage.h file, will notice
a lot of commented text and funny commands. They are required by the
Doxygen documentation system.
It is a free documentation utility that is able to
generate HTML, HTML help, LaTeX, RTF, ... documents.
I hope you will find the class useful!
| You must Sign In to use this message board. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 20 Jul 2000 Editor: Chris Maunder |
Copyright 2000 by Ales Krajnc Everything else Copyright © CodeProject, 1999-2009 Web18 | Advertise on the Code Project |