3ds Max C++ API Reference
Loading...
Searching...
No Matches
CustomFileStreamAPI.h File Reference
#include <tchar.h>
#include <wtypes.h>
#include <ObjIdl.h>
#include <vector>
#include <memory>
#include <string>

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

namespace  MaxSDK
 
namespace  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.
 
DllExport IStorage * OpenStorageForWrite (const wchar_t *fileName, IStorage *&pFileIStorage)
 Open a file as an OLE structured storage file with read/write access.
 
DllExport IStorage * OpenStorageForRead (const wchar_t *fileName, IStorage *&pFileIStorage)
 Open a file as an OLE structured storage file with read access.
 
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.
 
DllExport IStream * OpenStreamForRead (IStorage *pIStorage, const wchar_t *streamName)
 Open a stream with read access.
 
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.
 
DllExport unsigned __int64 GetStreamContentByteCount (IStream *pIStream)
 Get the byte count of the content of the stream (the data past the header)
 
DllExport bool SeekToStartOfStreamContent (IStream *pIStream)
 Sets the stream position to the beginning of the content (the data past the header)
 
DllExport bool IsStreamContentAnArray (IStream *pIStream)
 Determine if stream content is an array of strings.
 
DllExport bool ReadStreamContents (IStream *pIStream, std::wstring &content)
 Read the stream contents (the data past the header).
 
DllExport bool ReadStreamContents (IStream *pIStream, std::vector< std::wstring > &content)
 Read the stream contents (the data past the header)
 
DllExport bool WriteStreamContents (IStream *pIStream, const std::wstring &content)
 Write the stream contents (the data past the header), erasing any previous content.
 
DllExport bool WriteStreamContents (IStream *pIStream, const std::vector< std::wstring > &content)
 Write the stream contents (the data past the header), erasing any previous content.
 
DllExport bool GetStreamNames (IStorage *pIStorage, std::vector< std::wstring > &streamNames)
 Read the CustomFileStream names.
 
DllExport kDeleteStream_result DeleteFileStream (const wchar_t *fileName, const wchar_t *streamName)
 Delete the specified CustomFileStream stream from the specified file.
 
DllExport kGetLastCharacterOfContent_result GetLastCharacterOfContent (IStream *pIStream, wchar_t &theChar)
 Get the last character of content in a stream.
 

Variables

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

Macro Definition Documentation

◆ DllExport

#define DllExport   __declspec( dllimport )