ezEngine  Release 25.03
ezDocumentManager Class Referenceabstract
Inheritance diagram for ezDocumentManager:

Classes

struct  Event
 
struct  Request
 

Public Types

using CustomAction = ezVariant(*)(const ezDocument *)
 

Public Member Functions

ezStatus CanOpenDocument (ezStringView sFilePath) const
 
ezStatus CreateDocument (ezStringView sDocumentTypeName, ezStringView sPath, ezDocument *&out_pDocument, ezBitflags< ezDocumentFlags > flags=ezDocumentFlags::None, const ezDocumentObject *pOpenContext=nullptr)
 Creates a new document. More...
 
ezStatus OpenDocument (ezStringView sDocumentTypeName, ezStringView sPath, ezDocument *&out_pDocument, ezBitflags< ezDocumentFlags > flags=ezDocumentFlags::AddToRecentFilesList|ezDocumentFlags::RequestWindow, const ezDocumentObject *pOpenContext=nullptr)
 Opens an existing document. More...
 
virtual ezStatus CloneDocument (ezStringView sPath, ezStringView sClonePath, ezUuid &inout_cloneGuid)
 
void CloseDocument (ezDocument *pDocument)
 
void EnsureWindowRequested (ezDocument *pDocument, const ezDocumentObject *pOpenContext=nullptr)
 
const ezDynamicArray< ezDocument * > & GetAllOpenDocuments () const
 Returns a list of all currently open documents that are managed by this document manager.
 
ezDocumentGetDocumentByPath (ezStringView sPath) const
 
bool EnsureDocumentIsClosed (ezStringView sPath)
 If the given document is open, it will be closed. User is not asked about it, unsaved changes are discarded. Returns true if the document was open and needed to be closed. This function only operates on documents opened by this manager. Use EnsureDocumentIsClosedInAllManagers() to close documents of any type.
 
void CloseAllDocumentsOfManager ()
 
void GetSupportedDocumentTypes (ezDynamicArray< const ezDocumentTypeDescriptor * > &inout_documentTypes) const
 
- Public Member Functions inherited from ezReflectedClass
virtual const ezRTTIGetDynamicRTTI () const
 
bool IsInstanceOf (const ezRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
 
template<typename T >
EZ_ALWAYS_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.
 

Static Public Member Functions

static const ezHybridArray< ezDocumentManager *, 16 > & GetAllDocumentManagers ()
 
static ezResult FindDocumentTypeFromPath (ezStringView sPath, bool bForCreation, const ezDocumentTypeDescriptor *&out_pTypeDesc)
 
static ezDocumentGetDocumentByGuid (const ezUuid &guid)
 
static bool EnsureDocumentIsClosedInAllManagers (ezStringView sPath)
 If the given document is open, it will be closed. User is not asked about it, unsaved changes are discarded. Returns true if the document was open and needed to be closed.
 
static void CloseAllDocuments ()
 
static const ezDocumentTypeDescriptorGetDescriptorForDocumentType (ezStringView sDocumentType)
 
static const ezMap< ezString, const ezDocumentTypeDescriptor * > & GetAllDocumentDescriptors ()
 
- Static Public Member Functions inherited from ezNoBase
static const ezRTTIGetStaticRTTI ()
 

Static Public Attributes

static ezCopyOnBroadcastEvent< const Event & > s_Events
 
static ezEvent< Request & > s_Requests
 
static ezMap< ezString, CustomAction > s_CustomActions
 

Protected Member Functions

virtual void InternalCloneDocument (ezStringView sPath, ezStringView sClonePath, const ezUuid &documentId, const ezUuid &seedGuid, const ezUuid &cloneGuid, ezAbstractObjectGraph *pHeader, ezAbstractObjectGraph *pObjects, ezAbstractObjectGraph *pTypes)
 

Member Function Documentation

◆ CreateDocument()

ezStatus ezDocumentManager::CreateDocument ( ezStringView  sDocumentTypeName,
ezStringView  sPath,
ezDocument *&  out_pDocument,
ezBitflags< ezDocumentFlags flags = ezDocumentFlags::None,
const ezDocumentObject pOpenContext = nullptr 
)

Creates a new document.

Parameters
szDocumentTypeNameDocument type to create. See ezDocumentTypeDescriptor.
szPathAbsolute path to the document to be created.
out_pDocumentOut parameter for the resulting ezDocument. Will be nullptr on failure.
flagsFlags to define various options like whether a window should be created.
pOpenContextAn generic context object. Allows for custom data to be passed along into the construction. E.g. inform a sub-document which main document it belongs to.
Returns
Returns the error in case the operations failed.

◆ OpenDocument()

ezStatus ezDocumentManager::OpenDocument ( ezStringView  sDocumentTypeName,
ezStringView  sPath,
ezDocument *&  out_pDocument,
ezBitflags< ezDocumentFlags flags = ezDocumentFlags::AddToRecentFilesList | ezDocumentFlags::RequestWindow,
const ezDocumentObject pOpenContext = nullptr 
)

Opens an existing document.

Parameters
szDocumentTypeNameDocument type to open. See ezDocumentTypeDescriptor.
szPathAbsolute path to the document to be opened.
out_pDocumentOut parameter for the resulting ezDocument. Will be nullptr on failure.
flagsFlags to define various options like whether a window should be created.
pOpenContextAn generic context object. Allows for custom data to be passed along into the construction. E.g. inform a sub-document which main document it belongs to.
Returns
Returns the error in case the operations failed.
Returns the error in case the operations failed.

The documentation for this class was generated from the following files: