Class: TArchive

Declaration: Archive.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

None.

Purpose:

TArchive provides persistent storage of localized objects. Any streamable object can be stored in an archive and an archive can store objects of multiple types. Each object in an archive is given a name and is associated with a specific locale. An archive will generally contain multiple localized versions of an object, each associated with a different locale. A TArchive object represents an access path to the physical archive on disk. Creating a TArchive object does not necessarily create a physical archive nor does destroying a TArchive object necessarily destroy the physical archive. Depending on the chosen access mode, more than one TArchive object may refer to the same physical archive. A TArchive object is constructed by passing in the name and directory of the physical archive on disk.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

This class is designed to be used directly. Do not derive.

Concurrency:

Not Multithread safe.

Resource Use:

No special requirements.

Member Function: TArchive::~TArchive

virtual ~ TArchive ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not Multithread safe.

Other Considerations:

None.

Member Function: TArchive::GetObjectCount

  1. virtual unsigned long GetObjectCount () const
  2. virtual unsigned long GetObjectCount (const TLocale & locale) const

Interface Category:

API.

Purpose:

  1. Returns the number of objects contained by all locales in this archive.
  2. Returns the number of objects contained by the given locale in this archive.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.

Parameters:

Return Value:

The number of objects contained by this archive.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not Multithread safe.

Other Considerations:

None.

Member Function: TArchive::CreateArchiveIterator

  1. virtual TArchiveIterator * CreateArchiveIterator () const
  2. virtual TArchiveIterator * CreateArchiveIterator (const TLocale & locale, bool includeInheritedItems =false) const

Interface Category:

API.

Purpose:

  1. Returns an iterator that iterates over all objects in this archive.
  2. Returns an iterator that iterates over all objects in the given locale in this archive.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.

Parameters:

Return Value:

Returns a pointer to a heap allocated TArchiveIterator object for this archive. The caller owns the returned iterator object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not Multithread safe.

Other Considerations:

None.

Member Function: TArchive::GetLocalesContainingObject

virtual void GetLocalesContainingObject (TCollectionOf < TLocale > &, const TText & objectName) const

Interface Category:

API.

Purpose:

Fills in the given collection with the locales that contain the specified object. The caller is responsible for the locale objects contained in the collection.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not Multithread safe.

Other Considerations:

None.

Member Function: TArchive::GetLocaleCount

virtual unsigned long GetLocaleCount () const

Interface Category:

API.

Purpose:

Returns the number of locales that contain objects in this archive.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The number of locales that contain objects in this archive.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not Multithread safe.

Other Considerations:

None.

Member Function: TArchive::CreateLocaleIterator

virtual TArchiveLocaleIterator * CreateLocaleIterator () const

Interface Category:

API.

Purpose:

Returns an iterator that iterates through all the locales that contain objects in this archive.

Calling Context:

Call this function directly.

Parameters:

Return Value:

A pointer to a heap allocated TArchiveLocaleIterator object for this archive. The caller owns the returned iterator.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not Multithread safe.

Other Considerations:

None.

Member Function: TArchive::GetFileSystemEntity

TFileSystemEntity GetFileSystemEntity ()

Interface Category:

API.

Purpose:

Return the file system entity for this TArchive's physical archive.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The file system entity that stores this archive.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not Multithread safe.

Other Considerations:

None.

Member Function: TArchive::SetDestroyFileOnDelete

void SetDestroyFileOnDelete (bool doIt =false)

Interface Category:

API.

Purpose:

Set flag indicating if the physical archive should be deleted when this TArchive object is destroyed.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not Multithread safe.

Other Considerations:

None.

Member Function: TArchive::RemoveAllObjects

  1. virtual void RemoveAllObjects ()
  2. virtual void RemoveAllObjects (const TLocale & locale)

Interface Category:

API.

Purpose:

  1. Remove all objects from the archive.
  2. Remove all objects contained in the given locale from the archive.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not Multithread safe.

Other Considerations:

None.

Member Function: TArchive::RemoveObject

  1. virtual bool RemoveObject (const TText & objectName)
  2. virtual bool RemoveObject (const TText & objectName, const TLocale & locale)

Interface Category:

API.

Purpose:

  1. Remove the object with the given name from all locales in this archive.
  2. Remove the object with the given name from the given locale in this archive.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.

Parameters:

Return Value:

Returns true if specified object was actually in the archive before removal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not Multithread safe.

Other Considerations:

None.

Member Function: TArchive::Member

virtual bool Member (const TText & objectName, const TLocale & locale) const

Interface Category:

API.

Purpose:

Returns true if there is an object of a given name associated with the given locale in this archive.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if an object of the given name is associated with the given locale in this archive. Returns false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not Multithread safe.

Other Considerations:

None.

Member Function: TArchive::CopyArchiveForSharedLibrary

  1. static TArchive * CopyArchiveForSharedLibrary ()
  2. static TArchive * CopyArchiveForSharedLibrary (const TFile & whichLibrary)

Interface Category:

API.

Purpose:

  1. Returns a TArchive for the archive associated with the shared library in which the calling function is defined.
  2. Returns a TArchive for the archive associated with the given shared library.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.

Parameters:

Return Value:

Returns a pointer to a heap allocated TArchive for the desired archive. The caller is responsible for the storage of the returned TArchive object. The returned TArchive object is opened for read only.

Exceptions:

Throws TArchiveNotFound if no archive can be found for the specified shared library. Passes other exceptions through.

Concurrency:

Not Multithread safe.

Other Considerations:

None.

Member Function: TArchive::TArchive

  1. TArchive (const TDirectory & parentDirectory, const TFileSystemEntityName & archiveName, ECreationMode createMode =kCreateOrOpen, EAccessMode accessMode =kReadWrite)
  2. TArchive ()

Interface Category:

API.

Purpose:

  1. Create a TArchive object for the physical archive specified by parentDirectory and archiveName.
  2. Default constructor.

Calling Context:

  1. Call this function directly.
  2. Unimplemented -do not use.

Parameters:

Return Value:

None.

Exceptions:

Throws TArchiveNotFound if createMode is kOpen and the specified archive is not found on disk. Throws TArchiveAlreadyExists if createMode is kCreate and the specified archive is found on disk. Passes all other exceptions through.

Concurrency:

Not Multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.