Plasma Engine  2.0
Loading...
Searching...
No Matches
plDocumentManager Class Referenceabstract
Inheritance diagram for plDocumentManager:

Classes

struct  Event
 
struct  Request
 

Public Types

using CustomAction = plVariant (*)(const plDocument*)
 

Public Member Functions

plStatus CanOpenDocument (plStringView sFilePath) const
 
plStatus CreateDocument (plStringView sDocumentTypeName, plStringView sPath, plDocument *&out_pDocument, plBitflags< plDocumentFlags > flags=plDocumentFlags::None, const plDocumentObject *pOpenContext=nullptr)
 Creates a new document.
 
plStatus OpenDocument (plStringView sDocumentTypeName, plStringView sPath, plDocument *&out_pDocument, plBitflags< plDocumentFlags > flags=plDocumentFlags::AddToRecentFilesList|plDocumentFlags::RequestWindow, const plDocumentObject *pOpenContext=nullptr)
 Opens an existing document.
 
virtual plStatus CloneDocument (plStringView sPath, plStringView sClonePath, plUuid &inout_cloneGuid)
 
void CloseDocument (plDocument *pDocument)
 
void EnsureWindowRequested (plDocument *pDocument, const plDocumentObject *pOpenContext=nullptr)
 
const plDynamicArray< plDocument * > & GetAllOpenDocuments () const
 Returns a list of all currently open documents that are managed by this document manager.
 
plDocumentGetDocumentByPath (plStringView sPath) const
 
bool EnsureDocumentIsClosed (plStringView 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 (plDynamicArray< const plDocumentTypeDescriptor * > &inout_documentTypes) const
 
- Public Member Functions inherited from plReflectedClass
virtual const plRTTIGetDynamicRTTI () const
 
bool IsInstanceOf (const plRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
 
template<typename T >
PL_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 plHybridArray< plDocumentManager *, 16 > & GetAllDocumentManagers ()
 
static plResult FindDocumentTypeFromPath (plStringView sPath, bool bForCreation, const plDocumentTypeDescriptor *&out_pTypeDesc)
 
static plDocumentGetDocumentByGuid (const plUuid &guid)
 
static bool EnsureDocumentIsClosedInAllManagers (plStringView 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 plDocumentTypeDescriptorGetDescriptorForDocumentType (plStringView sDocumentType)
 
static const plMap< plString, const plDocumentTypeDescriptor * > & GetAllDocumentDescriptors ()
 
- Static Public Member Functions inherited from plNoBase
static const plRTTIGetStaticRTTI ()
 

Static Public Attributes

static plCopyOnBroadcastEvent< const Event & > s_Events
 
static plEvent< Request & > s_Requests
 
static plMap< plString, CustomAction > s_CustomActions
 

Protected Member Functions

virtual void InternalCloneDocument (plStringView sPath, plStringView sClonePath, const plUuid &documentId, const plUuid &seedGuid, const plUuid &cloneGuid, plAbstractObjectGraph *pHeader, plAbstractObjectGraph *pObjects, plAbstractObjectGraph *pTypes)
 

Member Function Documentation

◆ CreateDocument()

plStatus plDocumentManager::CreateDocument ( plStringView sDocumentTypeName,
plStringView sPath,
plDocument *& out_pDocument,
plBitflags< plDocumentFlags > flags = plDocumentFlags::None,
const plDocumentObject * pOpenContext = nullptr )

Creates a new document.

Parameters
szDocumentTypeNameDocument type to create. See plDocumentTypeDescriptor.
szPathAbsolute path to the document to be created.
out_pDocumentOut parameter for the resulting plDocument. 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()

plStatus plDocumentManager::OpenDocument ( plStringView sDocumentTypeName,
plStringView sPath,
plDocument *& out_pDocument,
plBitflags< plDocumentFlags > flags = plDocumentFlags::AddToRecentFilesList | plDocumentFlags::RequestWindow,
const plDocumentObject * pOpenContext = nullptr )

Opens an existing document.

Parameters
szDocumentTypeNameDocument type to open. See plDocumentTypeDescriptor.
szPathAbsolute path to the document to be opened.
out_pDocumentOut parameter for the resulting plDocument. 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: