Microsoft DirectX 8.1 (C++) |
At some point you might decide to alter or extend the format of your data. You will then wish you had a version number in all the old saved streams so you can tell, when you read them, whether they represent the old or new form. To assist you, this class writes and reads a version number. When it writes, it calls GetSoftwareVersion to inquire as to the version of the software being used at the moment. (In effect, this is a version number of the data layout in the file.) It writes this as the first thing in the data. If you want to change the version, implement (override) GetSoftwareVersion. It reads the version number from the file into mPS_dwFileVersion before calling ReadFromStream, so in ReadFromStream you can check mPS_dwFileVersion to see if you are reading an old version file. Usually you should accept files whose version is no newer than the software version that is reading them.
Protected Data Members
mPS_dwFileVersion | Version number of the file. |
mPS_fDirty | Data for this stream must be saved. |
Member Functions
CPersistStream | Constructs a CPersistStream object. |
SetDirty | Indicates that the object must be saved to the stream. |
Overridable Member Functions
GetClassID | Retrieves the class identifier of this stream. |
GetSoftwareVersion | Retrieves the version number for this file format. |
ReadFromStream | Reads the filter's data from the stream. |
SizeMax | Retrieves the number of bytes needed for data (not including version number). |
WriteToStream | Writes the filter's data to the stream. |
CPersistStream implements IPersistStream. For more implementation information, see the COM Reference in the Microsoft Platform SDK.
Implemented IPersistStream Methods
GetSizeMax | Retrieves the number of bytes needed for data (including version number). |
IsDirty | Checks if the object must be saved. |
Load | Loads the data from the stream into memory. |
Save | Saves the data from memory to the stream. |