CustomFileStreamAPI/CustomFileStreamAPI.h File Reference

CustomFileStreamAPI.h File Reference
#include <tchar.h>
#include <wtypes.h>
#include <ObjIdl.h>
#include <vector>
#include <memory>

Classes

struct  CustomFileStreamHeader
 stream header consists of WORD version number, a private flag DWORD, and a public flag DWORD More...
 
class  IUnknownDestructorPolicy
 Helper class for controlling IStorage and IStream deletion. More...
 

Namespaces

 MaxSDK
 This API is used to support OLE structured storage streams containing user specified string data in 3ds Max scene files or other OLE Structured Storage based files.
 
 MaxSDK::CustomFileStreamAPI
 

Macros

#define DllExport   __declspec( dllimport )
 

Enumerations

enum  kCustomFileStreamEnum { kPersistentStream = 1, kSaveNonPersistentStream = 2, kNoLoadOnSceneLoad = 4 }
 enum values for the private DWORD flag - bits, so powers of 2 More...
 
enum  kDeleteStream_result {
  kOk, kBadArgument, kFileStorageOpenFailed, kCustomDataStorageOpenFailed,
  kStreamDoesNotExist, kDestroyElementFailed
}
 
enum  kGetLastCharacterOfContent_result {
  kOk, kBadArgument, kStreamSeekFailure, kStreamReadFailure,
  kNoStreamContent
}
 

Functions

DllExport bool DoesCustomFileStreamStorageExist (const TCHAR *fileName)
 Checks if a file exists and contains a storage called CustomFileStreamDataStorage. More...
 
DllExport IStorage * OpenStorageForWrite (const TCHAR *fileName, IStorage *&pFileIStorage)
 Open a file as an OLE structured storage file with read/write access. More...
 
DllExport IStorage * OpenStorageForRead (const TCHAR *fileName, IStorage *&pFileIStorage)
 Open a file as an OLE structured storage file with read access. More...
 
DllExport IStream * OpenStreamForWrite (IStorage *pIStorage, const TCHAR *streamName, DWORD privateFlags, DWORD publicFlags=0, WORD version=kCustomFileStreamVersion)
 Open a stream with read/write access, creating it if not present. More...
 
DllExport IStream * OpenStreamForRead (IStorage *pIStorage, const TCHAR *streamName)
 Open a stream with read access. More...
 
DllExport bool ValidateStream (IStream *pIStream, CustomFileStreamHeader *stream_header=nullptr)
 Validates that stream was created via CustomFileStream methods, captures private and public flag values if wanted, leaves IStream positioned immediately past header. More...
 
DllExport unsigned __int64 GetStreamContentByteCount (IStream *pIStream)
 Get the byte count of the content of the stream (the data past the header) More...
 
DllExport bool SeekToStartOfStreamContent (IStream *pIStream)
 Sets the stream position to the beginning of the content (the data past the header) More...
 
DllExport bool IsStreamContentAnArray (IStream *pIStream)
 Determine if stream content is an array of strings. More...
 
DllExport bool ReadStreamContents (IStream *pIStream, std::wstring &content)
 Read the stream contents (the data past the header). More...
 
DllExport bool ReadStreamContents (IStream *pIStream, std::vector< std::wstring > &content)
 Read the stream contents (the data past the header) More...
 
DllExport bool WriteStreamContents (IStream *pIStream, const std::wstring &content)
 Write the stream contents (the data past the header), erasing any previous content. More...
 
DllExport bool WriteStreamContents (IStream *pIStream, const std::vector< std::wstring > &content)
 Write the stream contents (the data past the header), erasing any previous content. More...
 
DllExport bool GetStreamNames (IStorage *pIStorage, std::vector< std::wstring > &streamNames)
 Read the CustomFileStream names. More...
 
DllExport kDeleteStream_result DeleteFileStream (const TCHAR *fileName, const TCHAR *streamName)
 Delete the specified CustomFileStream stream from the specified file. More...
 
DllExport kGetLastCharacterOfContent_result GetLastCharacterOfContent (IStream *pIStream, wchar_t &theChar)
 Get the last character of content in a stream. More...
 

Variables

static const WORD kCustomFileStreamVersion = 1
 the current stream format version number More...
 
static const TCHAR * kCustomFileStreamStorageName = _T("CustomFileStreamDataStorage")
 the CustomFileStream IStorage name More...
 
static const int kMaxStreamNameLength = 31
 OLE limit of 31 chars for stream name. More...
 

Macro Definition Documentation

#define DllExport   __declspec( dllimport )