3ds Max C++ API 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
 
 MaxSDK::CustomFileStreamAPI
 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.
 

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 class  kDeleteStream_result {
  kOk , kBadArgument , kFileStorageOpenFailed , kCustomDataStorageOpenFailed ,
  kStreamDoesNotExist , kDestroyElementFailed
}
 
enum class  kGetLastCharacterOfContent_result {
  kOk , kBadArgument , kStreamSeekFailure , kStreamReadFailure ,
  kNoStreamContent
}
 

Functions

DllExport bool DoesCustomFileStreamStorageExist (const wchar_t *fileName)
 Checks if a file exists and contains a storage called CustomFileStreamDataStorage. More...
 
DllExport IStorage * OpenStorageForWrite (const wchar_t *fileName, IStorage *&pFileIStorage)
 Open a file as an OLE structured storage file with read/write access. More...
 
DllExport IStorage * OpenStorageForRead (const wchar_t *fileName, IStorage *&pFileIStorage)
 Open a file as an OLE structured storage file with read access. More...
 
DllExport IStream * OpenStreamForWrite (IStorage *pIStorage, const wchar_t *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 wchar_t *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 wchar_t *fileName, const wchar_t *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 wchar_t * kCustomFileStreamStorageName = L"CustomFileStreamDataStorage"
 the CustomFileStream IStorage name More...
 
static const int kMaxStreamNameLength = 31
 OLE limit of 31 chars for stream name. More...
 

Macro Definition Documentation

◆ DllExport

#define DllExport   __declspec( dllimport )