DWFToolkit::DWFResource Class Reference
[DWF Package API]

#include "dwf/package/Resource.h"

Inheritance diagram for DWFToolkit::DWFResource:

Inheritance graph
[legend]
Collaboration diagram for DWFToolkit::DWFResource:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class contains the base functionality for all resources in DWF section.

Since:
7.0.1
A resource is the common encapsulation of a set of data within a section.
Examples:

3DPublish/3DPublish_UTF8.cpp, and GlobalSectionWriter/GlobalSectionWriter.cpp.

Definition at line 172 of file package/Resource.h.

Public Types

typedef DWFSkipList< uint32_t,
DWFResource * > 
tOrderedList
 This type defines an integer ordered list of DWFResource pointers.
typedef DWFWCharKeySkipList<
DWFResource * > 
tMap
 This type defines a mapped collection of DWFResource pointers.
typedef std::multimap< const
wchar_t *, DWFResource *,
tDWFWCharCompareLess
tMultiMap
 This type defines a multi-value mapped collection of DWFResource pointers.
typedef DWFIterator< DWFStringtStringIterator
 This type defines an iterator over a collection of DWFStrings.
typedef DWFIterator< DWFResource * > tIterator
 This type defines a basic iterator on a collection of DWFResource pointers.
typedef DWFConstIterator<
DWFResource * > 
tConstIterator
 This type defines a basic const iterator on a collection of DWFResource pointers.
typedef DWFCachingIterator<
DWFResource * > 
tCachingIterator
 This type defines a caching iterator on a collection of DWFResource pointers.

Public Member Functions

typedef _DWFTK_STD_VECTOR (DWFResource *) tList
 This type defines a list of DWFResource pointers.
_DWFTK_API DWFResource (DWFPackageReader *pPackageReader) throw ()
_DWFTK_API DWFResource (const DWFString &zTitle, const DWFString &zRole, const DWFString &zMIME, const DWFString &zHREF=L"") throw ()
virtual _DWFTK_API ~DWFResource () throw ()
_DWFTK_API const DWFStringtitle () const throw ()
_DWFTK_API void setTitle (const DWFString &zTitle) throw ()
_DWFTK_API const DWFStringrole () const throw ()
_DWFTK_API void setRole (const DWFString &zRole) throw ()
_DWFTK_API const DWFStringmime () const throw ()
_DWFTK_API void setMIME (const DWFString &zMIME) throw ()
_DWFTK_API const DWFStringhref () const throw ()
virtual _DWFTK_API bool addContentID (const DWFString &zContentID) throw ( DWFException )
_DWFTK_API bool removeContentID (const DWFString &zContentID) throw ()
_DWFTK_API size_t contentIDCount () const throw ()
_DWFTK_API tStringIteratorcontentIDs () throw ()
_DWFTK_API const DWFStringobjectID () const throw ()
virtual _DWFTK_API void setObjectID (const DWFString &zObjectID) throw ()
_DWFTK_API const DWFStringinternalID () const throw ()
virtual _DWFTK_API void setInternalID (const DWFString &zInternalID) throw ()
_DWFTK_API const DWFStringparentID () const throw ()
_DWFTK_API void setParentResource (const DWFResource *pResource) throw ()
_DWFTK_API void setParentObjectID (const DWFString &zObjectID) throw ()
_DWFTK_API void setHRef (const DWFString &zHRef) throw ()
_DWFTK_API void setTargetHRef (const DWFString &zTargetHRef) throw ()
_DWFTK_API const size_t size () const throw ()
virtual _DWFTK_API void setPublishedIdentity (const DWFString &zSectionName, const DWFString &zObjectID) throw ()
_DWFTK_API const DWFStringpublishedIdentity () const throw ()
virtual _DWFTK_API void setRequestedName (const DWFString &zName) throw ()
virtual _DWFTK_API const DWFStringrequestedName () throw ()
virtual _DWFTK_API DWFInputStreamgetInputStream (bool bCache=false) throw ( DWFException )
virtual _DWFTK_API void parseAttributeList (const char **ppAttributeList) throw ( DWFException )
_DWFTK_API void setInputStream (DWFInputStream *pStream, size_t nBytes=0) throw ( DWFException )
virtual _DWFTK_API void serializeXML (DWFXMLSerializer &rSerializer, unsigned int nFlags) throw ( DWFException )
_DWFTK_API DWFZipFileDescriptor::teFileMode customZipMode () throw ()
_DWFTK_API bool useCustomZipMode () throw ()
_DWFTK_API void enableCustomZipMode (bool bUseCustomZipMode, DWFZipFileDescriptor::teFileMode eZipMode=DWFZipFileDescriptor::eZip) throw ()
_DWFTK_API void addRelationship (DWFResourceRelationship *pResourceRel) throw (DWFException)
_DWFTK_API void addRelationship (const DWFResource *pResource, const DWFString &zType) throw (DWFException)
_DWFTK_API DWFResourceRelationship::tList::ConstIteratorgetRelationships () throw (DWFException)
_DWFTK_API void removeRelationship (DWFResourceRelationship *pResourceRel, bool bDelete=false) throw ( DWFException )
_DWFTK_API void setNotificationSink (DWFResource::NotificationSink *pSink) throw ()
_DWFTK_API void removeNotificationSink (DWFResource::NotificationSink *pSink) throw ()
_DWFTK_API void notifyBeforeHRefChanged () throw ()
_DWFTK_API void notifyAfterHRefChanged () throw ()

Protected Attributes

size_t _nSize
DWFString _zTargetHRef
DWFOrderedVector< DWFString_oContentID
DWFResourceRelationship::tList _oRelationships
DWFPackageReader_pPackageReader
bool _bDWFXProtected

Classes

class  _DWFTK_EXPORT_API_MEMORY_CONTROL_BASE


Constructor & Destructor Documentation

_DWFTK_API DWFToolkit::DWFResource::DWFResource DWFPackageReader pPackageReader  )  throw ()
 

Constructor

This constructor is generally only used by the parsing process when the DWFPackageReader associated with (and providing read access to) the DWF package file is available. The subsequent binding makes it possible to read resource content data from the DWF package.

Parameters:
pPackageReader Provides access to resource content in the DWF package.
Exceptions:
None 

_DWFTK_API DWFToolkit::DWFResource::DWFResource const DWFString zTitle,
const DWFString zRole,
const DWFString zMIME,
const DWFString zHREF = L""
throw ()
 

Constructor

This constructor is generally only used by the parsing process when the DWFPackageReader associated with (and providing read access to) the DWF package file is available. The subsequent binding makes it possible to read resource content data from the DWF package.

Parameters:
zTitle The descriptive and display friendly title text.
zRole A functional description of the resource; see the DWFToolkit::DWFXML class for the well-known roles.
zMIME The MIME type of the resource data; see the DWFCore::DWFMIME class for well-known types.
zHREF The location of the resource within the DWF package layout. This parameter should not be set manually by client applications in most cases. The resource location is usually a composition of the section name and resource object ID which is assigned at publish time.
Exceptions:
None 

virtual _DWFTK_API DWFToolkit::DWFResource::~DWFResource  )  throw () [virtual]
 

Destructor

Exceptions:
None 


Member Function Documentation

virtual _DWFTK_API bool DWFToolkit::DWFResource::addContentID const DWFString zContentID  )  throw ( DWFException ) [virtual]
 

Add this content ID to the list of IDs of content associated with the resource. Certain resource, for example the content presentation resources, may be associated with more than one global content. For example a presentation may reference objects from two different global contents. Derived resources may dissallow multiple contents by overriding this method.

Parameters:
zContentID The content ID.
Returns:
True if the ID was added, false if the ID already exists and hence was not added.
Exceptions:
DWFException 

_DWFTK_API void DWFToolkit::DWFResource::addRelationship const DWFResource pResource,
const DWFString zType
throw (DWFException)
 

Add a relationship between this resource and another resource.

Parameters:
pResource A pointer to the related resource.
zType A description of the relationship.
Exceptions:
DWFException 
Since:
7.4.0

_DWFTK_API void DWFToolkit::DWFResource::addRelationship DWFResourceRelationship pResourceRel  )  throw (DWFException)
 

Add a relationship between this resource and another resource.

Parameters:
pResourceRel A pointer to the relationship object to be added.
Exceptions:
DWFException 
Since:
7.4.0

_DWFTK_API size_t DWFToolkit::DWFResource::contentIDCount  )  const throw () [inline]
 

Returns the number content ID associated with this resource

Returns:
The number of associated content IDs.
Exceptions:
None 
Since:
7.2.0

Definition at line 462 of file package/Resource.h.

_DWFTK_API tStringIterator* DWFToolkit::DWFResource::contentIDs  )  throw () [inline]
 

Access all associated content IDs using an iterator.

Returns:
An iterator over the content IDs. The caller owns the iterator and is responsible for releasing it with the DWFCORE_FREE_OBJECT macro.
Exceptions:
None 
Since:
7.2.0

Definition at line 478 of file package/Resource.h.

_DWFTK_API DWFZipFileDescriptor::teFileMode DWFToolkit::DWFResource::customZipMode  )  throw () [inline]
 

Get the custom zip mode of the resource. This is meaningful only if useCustomZipMode returns true.

Returns:
The zip mode that should be use to serialize this resource.
Exceptions:
None 
Since:
7.3.0

Definition at line 798 of file package/Resource.h.

_DWFTK_API void DWFToolkit::DWFResource::enableCustomZipMode bool  bUseCustomZipMode,
DWFZipFileDescriptor::teFileMode  eZipMode = DWFZipFileDescriptor::eZip
throw ()
 

Set whether or not to use a custom zip mode to serialize the resource. If false, the second argument will be ignored.

Parameters:
bUseCustomZipMode True if the custom zip mode should be use to serialize this resource.
eZipMode If enabling custom zip mode, this sets the mode to use.
Exceptions:
None 
Since:
7.3.0

virtual _DWFTK_API DWFInputStream* DWFToolkit::DWFResource::getInputStream bool  bCache = false  )  throw ( DWFException ) [virtual]
 

Provides a stream for reading the resource data.

Warning:
If an input stream is bound to the resource using setInputStream() for publishing, this method will return that stream pointer. This is very important to realize: the caller must delete that stream pointer by contract of this interface, as such, this method will return a bogus pointer from that point on. Do not call this method more than once if setInputStream() binds the stream pointer.
Parameters:
bCache If true, the uncompressed resource file will be stored in a temporary disk file for faster subsequent access.
Returns:
A pointer to a data stream. The caller is responsible for releasing the pointer with the DWFCORE_FREE_OBJECT macro.
Exceptions:
DWFException 

Reimplemented in DWFToolkit::DWFObjectDefinitionResource, and DWFToolkit::DWFContentPresentationResource.

_DWFTK_API DWFResourceRelationship::tList::ConstIterator* DWFToolkit::DWFResource::getRelationships  )  throw (DWFException) [inline]
 

Return an iterator of all current relationships from this resource.

Returns:
A pointer to an iterator that must be deleted by the caller with the DWFCORE_FREE_OBJECT macro.
Exceptions:
DWFException 
Since:
7.4.0

Definition at line 864 of file package/Resource.h.

_DWFTK_API const DWFString& DWFToolkit::DWFResource::href  )  const throw () [inline]
 

Returns the resource HREF.

Returns:
The HREF.
Exceptions:
None 

Definition at line 418 of file package/Resource.h.

_DWFTK_API const DWFString& DWFToolkit::DWFResource::internalID  )  const throw () [inline]
 

For internal use only.

Returns the resource's internal ID. These are unique only at the package level and are reset every time during serialization.

Returns:
The internal ID.
Exceptions:
None 
Since:
7.4.0

Definition at line 519 of file package/Resource.h.

_DWFTK_API const DWFString& DWFToolkit::DWFResource::mime  )  const throw () [inline]
 

Returns the resource MIME type.

Returns:
The MIME type.
Exceptions:
None 

Definition at line 394 of file package/Resource.h.

_DWFTK_API void DWFToolkit::DWFResource::notifyAfterHRefChanged  )  throw ()
 

Inform all NotificationSink's that the href of this resource has changed.

Exceptions:
none 
Since:
7.4.0

_DWFTK_API void DWFToolkit::DWFResource::notifyBeforeHRefChanged  )  throw ()
 

Inform all NotificationSink's that the href of this resource is about to change.

Exceptions:
none 
Since:
7.4.0

_DWFTK_API const DWFString& DWFToolkit::DWFResource::objectID  )  const throw () [inline]
 

Returns the resource object ID.

Returns:
The object ID.
Exceptions:
None 

Definition at line 491 of file package/Resource.h.

_DWFTK_API const DWFString& DWFToolkit::DWFResource::parentID  )  const throw () [inline]
 

Returns the object ID of the parent resource.

Returns:
The parent object ID.
Exceptions:
None 

Definition at line 548 of file package/Resource.h.

virtual _DWFTK_API void DWFToolkit::DWFResource::parseAttributeList const char **  ppAttributeList  )  throw ( DWFException ) [virtual]
 

Implements DWFCore::DWFXMLBuildable.

_DWFTK_API const DWFString& DWFToolkit::DWFResource::publishedIdentity  )  const throw () [inline]
 

For internal use only.

Returns the publishing target HREF for the resource. This is used for the DWF6 package publishing.

This method is used during publishing by DWFPackageWriter::write() to discover the final HREF of the resource in the DWF package. This is different than the "standard" HREF attribute since the package writer needs to recharacterize and identify sections as they are written out; thus, the final resource location will change. The original property is not modified since the resource may be used elsewhere; the package writer does not assume that it is the final user of the object.

Returns:
The final published location of the resource.
Exceptions:
None 

Definition at line 672 of file package/Resource.h.

_DWFTK_API bool DWFToolkit::DWFResource::removeContentID const DWFString zContentID  )  throw () [inline]
 

Remove this content ID from the list of IDs of content associated with the resource.

Parameters:
zContentID The content ID.
Returns:
Return true if the ID was found and removed.
Exceptions:
None 

Definition at line 447 of file package/Resource.h.

_DWFTK_API void DWFToolkit::DWFResource::removeNotificationSink DWFResource::NotificationSink *  pSink  )  throw ()
 

Remove a specific notification sink.

Parameters:
pSink The sink to remove.
Exceptions:
None 
Since:
7.4.0

_DWFTK_API void DWFToolkit::DWFResource::removeRelationship DWFResourceRelationship pResourceRel,
bool  bDelete = false
throw ( DWFException )
 

Remove a relationship with another resource

Parameters:
pResourceRel a pointer to the resource relationship that will be removed
bDelete specify wether to free the relationship object
Exceptions:
DWFException 
Since:
7.4.0

virtual _DWFTK_API const DWFString& DWFToolkit::DWFResource::requestedName  )  throw () [inline, virtual]
 

Return the requested name for the resource.

Returns:
The requested name.
Exceptions:
None 
Since:
7.4.0

Definition at line 704 of file package/Resource.h.

_DWFTK_API const DWFString& DWFToolkit::DWFResource::role  )  const throw () [inline]
 

Returns the resource role.

Returns:
The role.
Exceptions:
None 

Definition at line 367 of file package/Resource.h.

virtual _DWFTK_API void DWFToolkit::DWFResource::serializeXML DWFXMLSerializer rSerializer,
unsigned int  nFlags
throw ( DWFException ) [virtual]
 

Implements DWFCore::DWFXMLSerializableBase.

Reimplemented in DWFToolkit::DWFObjectDefinitionResource, and DWFToolkit::DWFContentPresentationResource.

_DWFTK_API void DWFToolkit::DWFResource::setHRef const DWFString zHRef  )  throw () [inline]
 

Assigns the resource location.

Parameters:
zHRef The location of the resource within the DWF package layout. This parameter should not be set manually by client applications in most cases.
Exceptions:
None 

Definition at line 598 of file package/Resource.h.

_DWFTK_API void DWFToolkit::DWFResource::setInputStream DWFInputStream pStream,
size_t  nBytes = 0
throw ( DWFException )
 

Binds a data source stream for providing the resource data.

This method is for use when publishing a resource. It is assumed that the source stream (provided here) will be read once and discarded.

Warning:
This function is provided to make the initial connection between source data and the DWF package I/O data object - the DWFResource. That is, it is a publish-time only method. This is important to understand since the first call to getInputStream() will return this pointer and the caller is obligated to delete it.
Todo:
A future revision of this class should address the potential inconsistency in this function pair; possibly introducing a stream provider/builder object that is given to the resource instead of the stream interface itself. This mediator could ensure the availability of new stream object with all data content for every call to getInputStream().
Parameters:
pStream A pointer to a data stream. This object must be allocated with the DWFCORE_ALLOC_OBJECT macro.
nBytes Represents the total size (in uncompressed bytes) of the resource. If zero, the number of available bytes in the stream initially will be used; however, there is no guarantee that this amount will always reflect the true size of the source content.
Examples:
GlobalSectionWriter/GlobalSectionWriter.cpp.

virtual _DWFTK_API void DWFToolkit::DWFResource::setInternalID const DWFString zInternalID  )  throw () [inline, virtual]
 

For internal use only.

Set the resource's internal ID. This has to be a hyperlink compatible string - so it must conform to the specification for xsd:ID. The ID is reset during serialization and is unique only for the package.

Parameters:
zInternalID A hyperlink compatible string - must conform to the specification for xsd:ID.
Exceptions:
None 
Since:
7.4.0

Definition at line 535 of file package/Resource.h.

_DWFTK_API void DWFToolkit::DWFResource::setMIME const DWFString zMIME  )  throw ()
 

Assigns the resource MIME type.

Parameters:
zMIME The MIME type of the resource data; see the DWFCore::DWFMIME class for well-known types.
Exceptions:
None 

_DWFTK_API void DWFToolkit::DWFResource::setNotificationSink DWFResource::NotificationSink *  pSink  )  throw ()
 

Add a NotificationSink to listen to changes on this resource.

Parameters:
pSink A DWFResource::NotificationSink derived class
Exceptions:
none 
Since:
7.4.0

virtual _DWFTK_API void DWFToolkit::DWFResource::setObjectID const DWFString zObjectID  )  throw () [inline, virtual]
 

Sets the resource object ID.

Parameters:
zObjectID A unique identifier.
Exceptions:
None 

Definition at line 504 of file package/Resource.h.

_DWFTK_API void DWFToolkit::DWFResource::setParentObjectID const DWFString zObjectID  )  throw () [inline]
 

Defines a relationship between two resources.

This relationship is required when the contents of the child resource are directly applicable to the parent. One example of this is object definition resources as children of the graphic resource that define the entities to which the instances are bound.

Parameters:
zObjectID The object ID of the parent resource.
Exceptions:
None 

Definition at line 583 of file package/Resource.h.

_DWFTK_API void DWFToolkit::DWFResource::setParentResource const DWFResource pResource  )  throw ()
 

Defines a relationship between two resources.

This relationship is required when the contents of the child resource are directly applicable to the parent. One example of this is object definition resources as children of the graphic resource that define the entities to which the instances are bound.

Parameters:
pResource The parent resource or NULL to delete an existing relationship.
Exceptions:
None 

virtual _DWFTK_API void DWFToolkit::DWFResource::setPublishedIdentity const DWFString zSectionName,
const DWFString zObjectID
throw () [virtual]
 

For internal use only.

This method is used during the publishing process to construct a valid destination HREF for the resource.

Parameters:
zSectionName The unique section identifier.
zObjectID The object ID that will be used in the HREF. If the object ID of this resource is empty when this function call is made, it will be assigned.
Exceptions:
None 

virtual _DWFTK_API void DWFToolkit::DWFResource::setRequestedName const DWFString zName  )  throw () [inline, virtual]
 

To avoid automatically renaming the resource during every publish, we can request that this name to be set for the published identity. Note: The argument is only the base name without the path. It may include the extension.

Parameters:
zName The name to set for the resource - this excludes the path or the extension.
Exceptions:
None 
Since:
7.4.0

Definition at line 690 of file package/Resource.h.

_DWFTK_API void DWFToolkit::DWFResource::setRole const DWFString zRole  )  throw () [inline]
 

Assigns the resource role.

Parameters:
zRole A functional description of the resource; see the DWFToolkit::DWFXML class for the well-known roles.
Exceptions:
None 

Definition at line 381 of file package/Resource.h.

_DWFTK_API void DWFToolkit::DWFResource::setTargetHRef const DWFString zTargetHRef  )  throw () [inline]
 

Assigns the target resource location.

Parameters:
zTargetHRef The intended location of the resource within the DWF package layout. This parameter should not be set manually by client applications in most cases.
Exceptions:
None 

Definition at line 615 of file package/Resource.h.

_DWFTK_API void DWFToolkit::DWFResource::setTitle const DWFString zTitle  )  throw () [inline]
 

Assigns the resource title.

Parameters:
zTitle The descriptive and display friendly title text.
Exceptions:
None 

Definition at line 354 of file package/Resource.h.

_DWFTK_API const size_t DWFToolkit::DWFResource::size  )  const throw () [inline]
 

Returns the total uncompressed byte count of the resource data.

When a resource is being created for the purpose of serialization and if either no input stream has been provided or if no size was specified when providing the input stream then this method will return 0 since the stream will be queried for its size just before serialization.

Returns:
The number of bytes.
Exceptions:
None 

Definition at line 634 of file package/Resource.h.

_DWFTK_API const DWFString& DWFToolkit::DWFResource::title  )  const throw () [inline]
 

Returns the resource title.

Returns:
The title.
Exceptions:
None 

Definition at line 341 of file package/Resource.h.

_DWFTK_API bool DWFToolkit::DWFResource::useCustomZipMode  )  throw () [inline]
 

Determines whether or not to use a custom zip mode to serialize the resource.

Returns:
Returns true if the custom zip mode should be use to serialize this resource.
Exceptions:
None 
Since:
7.3.0

Definition at line 812 of file package/Resource.h.


Member Data Documentation

size_t DWFToolkit::DWFResource::_nSize [protected]
 

The total number of uncompressed bytes in the resource.

Definition at line 935 of file package/Resource.h.


The documentation for this class was generated from the following file:
Generated on Tue Jan 6 22:40:33 2009 for Autodesk DWF Toolkit by  doxygen 1.4.5