![]() | InDesign SDK 20.5 |
#include <IDataBase.h>
Classes | |
| struct | InstantiateFunctionObj |
| class | SaveRestoreModifiedState |
Public Member Functions | |
| virtual | ~IDataBase () |
| virtual UID | NewUID (ClassID clsID)=0 |
| virtual DBResultCode | DeleteUID (UID id)=0 |
| virtual DBResultCode | UndeleteUID (UID id, ClassID clsID)=0 |
| virtual DBResultCode | DestroyDeletedUID (UID id)=0 |
| virtual IPMUnknown * | Instantiate (UID id, PMIID interfaceID)=0 |
| virtual IPMUnknown * | QueryInstance (UID id, PMIID interfaceID)=0 |
| virtual bool8 | IsValidUID (UID id) const =0 |
| virtual UID | GetRootUID () const =0 |
| virtual ClassID | GetClass (UID id) const =0 |
| virtual IUIDIterator * | NewUIDIterator (bool8 includeDeletedUIDs=kFalse) const =0 |
| virtual void | DeleteUIDIterator (IUIDIterator **iterator) const =0 |
| virtual void | AssertOnModification ()=0 |
| virtual void | AttachDataObserver (IDatabaseObserver *observer)=0 |
| virtual void | DetachDataObserver (IDatabaseObserver *observer)=0 |
| virtual uint32 | GetSaveCount () const =0 |
| virtual bool16 | IsReadOnly () const =0 |
| virtual bool16 | IsModified () const =0 |
| virtual IDataBase::DBResultCode | SetVersionNumber (const int32 &majorVersion, const int32 &minorVersion)=0 |
| virtual void | GetVersionNumber (int32 *majorVersion, int32 *minorVersion) const =0 |
| virtual ByteSwapOrder | GetByteSwap () const =0 |
| virtual const IDFile * | GetSysFile () const =0 |
| virtual DBResultCode | New (ProtectionLevel protLevel)=0 |
| virtual DBResultCode | Open (const IDFile &whatFile, ProtectionLevel protLevel, OpenFlags openFlag=kWrite)=0 |
| virtual DBResultCode | Revert ()=0 |
| virtual DBResultCode | Recover (const IDFile *damagedFile, ProtectionLevel protLevel, ProtectionLevel oldProtLevel, const IDFile *miniSaveFile=nil)=0 |
| virtual DBResultCode | Save ()=0 |
| virtual DBResultCode | SaveAs (const IDFile &destFile, SaveFlags saveFlag=kSaveAs)=0 |
| virtual void | SetModified (bool16 modified)=0 |
| virtual void | SetPlatformFileInfo (void *fileInfo)=0 |
| virtual DBProgressFunction | SetProgressCallback (DBProgressFunction callback)=0 |
| virtual DBResultCode | BeginTransaction ()=0 |
| virtual DBResultCode | EndTransaction ()=0 |
| virtual int32 | GetTransactionLevel () const =0 |
| virtual ProtectionLevel | GetProtectionLevel () const =0 |
| virtual uint32 | SetMiniSaveInterval (uint32 msecs)=0 |
| virtual uint32 | GetMiniSaveInterval () const =0 |
| virtual const IDFile * | GetMiniSaveFile () const =0 |
| virtual DBResultCode | GetErrorCode ()=0 |
| virtual void | ClearError ()=0 |
| virtual UID | NewContiguousUID (uint16 type, bool16 externallyWritable)=0 |
| virtual bool16 | GetContiguousUIDChangeMarker (UID id) const =0 |
| virtual void | SetContiguousUIDChangeMarker (UID id, bool16 changed)=0 |
| virtual void | DestructInstance (UID id)=0 |
| virtual void | ClearDirty (IPMPersist *flushThis)=0 |
| virtual void | DirtyObject (IPMPersist *flushThis, ClassID clsID, ImplementationID tag, bool16 allowModification=kTrue, bool16 firstDirtyInterface=kTrue)=0 |
| virtual void | SetError (DBResultCode dbErrCode, const IDFile *userProvidedFile=nullptr)=0 |
| virtual void | PurgeMemory (int32 level)=0 |
| virtual void | AdviseMemoryState (int32 level)=0 |
| virtual void | RegisterRootObject (IPMUnknown *root)=0 |
| virtual IPubFile * | GetPubFile ()=0 |
| virtual void | IterateInstantiatedObjects (IInstanceProcessor *i)=0 |
| virtual InstanceProfiler * | NewInstanceProfiler ()=0 |
| virtual DBResultCode | GetCreationTime (IDTime >)=0 |
| virtual DBResultCode | GetModificationTime (IDTime >)=0 |
| virtual uint64 | GetSequenceNumberAtOpen () const =0 |
| virtual uint64 | GetCurrentSequenceNumber () const =0 |
| virtual uint32 | GetCacheFaultRate () const =0 |
| virtual uint32 | GetCacheTotalFaults () const =0 |
| virtual CachePolicy | GetCachePolicy () const =0 |
| virtual void | SetCachePolicy (CachePolicy policy)=0 |
| virtual const IDFile * | GetSysFileFromOpen () const =0 |
| virtual UndoSupport | GetUndoSupport () const =0 |
| virtual IDBChangesMonitor * | GetDBChangesMonitor () const =0 |
| virtual IDatabaseSnapshot * | GetLastDBSnapshotBeforePubFileSharing () const =0 |
| virtual void | SetDBChangesMonitor (IDBChangesMonitor *dbChangesMonitor, UndoSupport undoSupport)=0 |
| virtual void | SetFauxUserFile (const IDFile &newFile)=0 |
| virtual bool16 | IsFauxUserFile () const =0 |
| virtual bool16 | PlacementNewUID (ClassID clsID, UID id)=0 |
| virtual bool16 | PlacementUIDIsAvailable (UID id)=0 |
| virtual void | FlushDirtyObjectsForRIDXQuery ()=0 |
| virtual IDataBase * | Clone ()=0 |
| virtual DatabaseSnapshotPtr | CloneADatabaseSnapshot ()=0 |
| virtual bool | SwitchExecutionContext ()=0 |
| virtual bool | PrepareForExecutionContextSwitch ()=0 |
| virtual DBResultCode | Merge (IDataBase *clone)=0 |
| virtual DBResultCode | DestroyDeletedUID_AfterLastReferenceIsReleased (UID id)=0 |
| virtual void | AllowPurge ()=0 |
| virtual void | DisallowPurge ()=0 |
| virtual void | DoScheduledPurge ()=0 |
| virtual bool | IsPurgeAllowed () const =0 |
| virtual DBResultCode | AttemptMiniSave ()=0 |
| virtual bool | PubFileIsShared () const =0 |
| virtual PMString | GetDocumentID ()=0 |
| virtual InstantiateFunction | SetInstantiateFunction (InstantiateFunction overrideInstantiate=nil)=0 |
| virtual InstantiateFunction | GetInstantiateFunction () const =0 |
A database is the underlying data structure used for storage of documents, preferences, books, etc. It handles allocation, serialization, deletion of objects in the files. It also handles caching of objects.
An IDataBase ptr is NOT a reference to a standard boss object. It is a virtual C++ class, but does not inherit from IPMUnknown.
| typedef DBResultCode(* IDataBase::DBProgressFunction)(int32 stepsDone, int32 stepCount) |
Prototype for a progress callback to be installed with SetProgressCallback() below. If a callback returns something different than kNoError the database will cancel and return this error code.
Internal use only.
The return type for most DataBase methods
| Enumerator | |
|---|---|
| kNoError | Success |
| kUserCanceled | User cancelled the operation, such as with the cancel button on a progress bar |
| kUnknownError | Catch-all error code not handled elsewhere |
| kLowMemoryError | Insufficient memory |
| kFileDamagedError | File damaged but may be recoverable |
| kFileCorruptError | File damaged and is not recoverable |
| kFileNotFoundError | File not found |
| kFileIsOpenError | File is already open |
| kFileIsReadOnlyError | File is read-only |
| kDiskFullError | Disk is full or insufficient disk space to complete operation |
| kNotFoundError | File not found |
| kFileChangedError | An edited but unsaved file could not be recovered because the original file on disk was already changed by another user |
| kWrongVersionError | Wrong version |
| kFileIsNotOpenError | File is not open |
| kInvalidFileFormatError | File format invalid - magic bytes don't match.
|
| kTooManyFilesError | The database cannot open another file because too many are already open. |
| kOutstandingClonesSaveError | The database cannot be saved at this point because it has outstanding clones. |
| kOutstandingTransactionsSaveError | The database cannot be saved at this point because it has outstanding transactions |
| kDBMergeFailed | The database cannot be merged with clone. |
| kDBModeSwitchFailed | We could not switch modes (read only shared or read write exclusive) on the underlying file |
| kMiniSaveFileVerificationFailedError | File damaged and is not recoverable - size too small |
| enum IDataBase::OpenFlags |
Flags to determine how to a database is opened
Selecting the protection level of a database allows you to trade off performance and file-size versus fault-tolerance level when dealing with databases, depending on how important the data is in the database.
| enum IDataBase::SaveFlags |
The return type of GetUndoSupport
There are three kinds: kNoUndoSupport : when the database has no support for tracking UID changes.
kFullUndoSupport : when the database has support for tracking UID changes and the database is revisioned so that when undo is invoked, older revisions of the database a restored.
kPartialUndoSupport : when the database has support for tracking UID changes but no revisioning. This means that when errors occurr, a transaction is reverted through automatic error handling. However, once a transaction is committed, it becomes irreversible.
Internal use only.
| inlinevirtual |
The database destructor closes an open database, and thus there is no explicit Close() method. Note that any changes to the database made since the last Save()/SaveAs() are lost.
| pure virtual |
Internal use only.
| pure virtual |
Internal Use only
| pure virtual |
Internal use only.
| pure virtual |
Attaches an observer to the database. The observer will be called when certain database operations happen.
| observer | to attach |
| pure virtual |
Starts a transaction. You should not normally need to call this directly. Changes to the document or preferences should be enclosed in Commands, and then this will be called for you by the command maanger. If you change the database via direct modifications it may result in corrupted documents. If you receive an assert about a database change outside of a transaction it is usually caused by either a modification outside of a command, a command with an incorrect target, or a command that modifies more than one database. The appropriate solution is normally to use commands correctly as opposed to inserting a call to BeginTransaction which just alleviates the assert instead of addressing the underlying issue.
| pure virtual |
Internal use only.
| pure virtual |
Resets error state
| pure virtual |
Marks the object with the given UID for deletion. The object can longer be instantiated. Existing references remain valid. You can use the command named kDeleteUIDCmdBoss as a client rather than call this.
| UID | of the object to delete |
| pure virtual |
Delete an UIDIterator. Every call NewUIDIterator must have a matching call to DeleteUIDIterator.
| iterator | to delete. |
| pure virtual |
Frees up space for a previously deleted object with the given UID. The object can no longer be resurrected with UndeleteUID. This is normally called for you.
| UID | of the object to destroy |
| pure virtual |
Internal use only.
| pure virtual |
Internal use only.
| pure virtual |
Detach an observer registered with AttachDataObserver. Every call to AttachDataObserver must have a matching call to DetachDataObserver.
| observer | to detach |
| pure virtual |
Internal use only.
| pure virtual |
Ends a transaction. Note: There is no commit/rollback - EndTransaction implies a commit.
| pure virtual |
Internal use only.
| pure virtual |
Returns the byte order of the database
| pure virtual |
Internal use only.
| pure virtual |
Internal use only.
| pure virtual |
Internal use only.
Get the class of the object.
| id | of the object |
| pure virtual |
Internal use only.
| pure virtual |
Gets the creation time of the database file
| gt | Set to the creation time of the database file on success |
| pure virtual |
Internal use only.
| pure virtual |
Internal use only.
| pure virtual |
FOR INTERNAL USE ONLY FOR EXTERNAL USE : Recommended to use IAdobeMediaMgmtMetaData::GetDocumentID
Sets the document ID of a document. [OUT]: Returns the documentID of the document associated with the database.
| pure virtual |
Gets the error information
| pure virtual |
Internal use only.
| pure virtual |
Inquires the temporary file used for mini save, recovery, and spill from memory
| pure virtual |
Returns the current interval (in milliseconds) in which the database performs it's mini-save
| pure virtual |
Gets the modification time of the database file
| gt | Set to the modification time of the database file on success |
| pure virtual |
Gets the level of protection for the file Note: This value is defined at New/Open and there is no way to change it.
| pure virtual |
Internal use only.
| pure virtual |
| pure virtual |
Returns the number of times the database has been saved
| pure virtual |
Internal use only.
| pure virtual |
Returns the file associated with the database (if the database has been opened or saved). Returns nil if there is no file associated yet.
| pure virtual |
Support for better error handling. Returns the file that was used in the Open or Recover operation on the database. This is useful for better error handling because GetSysFile() return nil after Open() fails, yet we want to ask the database what IDFile the call failed on.
| pure virtual |
Gets the current transaction level on this database. Client code typically has no need for this.
| pure virtual |
Returns the undo support type of the database.
| pure virtual |
Returns the version number of the application that was used to create the database
| int32* | majorVersion major version number (return value!) |
| int32* | minorVersion minor version number (return value!) |
| pure virtual |
Creates an in-memory version of the db-based object with the given UID, or simply returns a reference to the object if it is already instantiated. Does a QueryInterface for the requested interface. Returns nil if the UID doesn't exist, or if it's been deleted, or if the requested interface doesn't exist. Pass IID_IUNKNOWN if you don't care what interface you get. Normally this is called from InterfacePtr, instead of directly.
| id | of the object to instantiate |
| interfaceID | which interface of the object to return |
| pure virtual |
Internal use only.
| pure virtual |
Returns kTrue if the database has been modified since last save.
| pure virtual |
Returns kTrue if the database was opened read only
| pure virtual |
Returns kTrue if the given UID exists and is a reference to a valid object in the database. Returns false if the UID has never been allocated, or if it's been allocated and subsequently deleted. If it's been deleted, then undeleted, it returns true.
| id | of the object |
| pure virtual |
Internal use only.
| pure virtual |
Creates a new file.
| protLevel | protection level |
| pure virtual |
Internal use only.
| pure virtual |
Internal use only.
Creates a new persistent object in the database. Note that you can also use the NewUIDCmd (kNewUIDCmdBoss), which will handle the Undo for you.
| ClassID | for the new object |
| pure virtual |
Creates and returns a new UIDIterator. Use it to iterate over all UIDs in the database. Call DeleteUIDIterator when you are done with it. See UIDIterator.h
| includeDeletedUIDs | false to skip over deleted UIDs, true otherwise |
| pure virtual |
Opens an existing file.
| whatFile | file to open |
| protLevel | protection level |
| openFlag | open read-only, writeable, or as a copy |
| pure virtual |
Internal use only.
| pure virtual |
Internal use only.
| pure virtual |
Like Instantiate(), but only returns a pointer if the requested interface is currently instantiated. If the interface would have to be accessed from the database, nil is returned.
| id | of the object to instantiate |
| interfaceID | which interface of the object to return |
| pure virtual |
Recovers damagedFile.
| damagedFile | file to recover |
| protLevel | protection level |
| oldProtLevel | |
| miniSaveFile |
| pure virtual |
Internal use only.
| pure virtual |
Reverts the database to the last saved state. This is only allowed when there are no outstanding references to anything in the database.
| pure virtual |
Saves changes to the file. You should not save a database on which there is an outstanding transaction, which is why save commands typically do not target the actual database being saved.
| pure virtual |
Saves the database to a new file. You should not save a database on which there is an outstanding transaction, which is why save commands typically do not target the actual database being saved.
| destFile | file to save to |
| saveFlag | saveAs or saveACopy |
| pure virtual |
Internal use only.
| pure virtual |
Internal use only.
| pure virtual |
Internal use only.
| pure virtual |
Internal use only.
| pure virtual |
Internal use only.
| pure virtual |
Sets the interval (in milliseconds) in which the database should perform it's mini-save Returns the new interval (which might be different from msecs since there are certain limits)
| msecs | new interval in milliseconds |
| pure virtual |
Sets the database to a "modified" state – regardless whether db has been modified or not.
| modified |
| pure virtual |
This is used to set the Macintosh file creator and file type. On the Macintosh, this is expected to be a pointer to a file creator, followed by a file type (both OSType).
| fileInfo | creator & type |
| pure virtual |
Sets the progress callback function of the database and returns the previous one.
| callback |
| pure virtual |
Restores the previously deleted object with the given UID and ClassID. You will want to use exactly the same ClassID that was used to create the object. This is often called by Commands during an Undo operation.
| UID | of the object to restore |
| ClassID | for the restored object |