Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

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:

GlobalSectionWriter/GlobalSectionWriter.cpp.

Definition at line 53 of file Resource.h.

Public Types

typedef vector< DWFResource * > tList
 This type defines a list of DWFResource pointers.
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 multimap< const wchar_t *,
DWFResource *, tDWFWCharCompareLess
tMultiMap
 This type defines a multi-value mapped collection of DWFResource pointers.

Public Member Functions

_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 ()
_DWFTK_API void setHRef (const DWFString &zHRef) throw ()
_DWFTK_API const DWFStringobjectID () const throw ()
_DWFTK_API void setObjectID (const DWFString &zObjectID) 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 const size_t size () const throw ()
_DWFTK_API void setPublishedIdentity (const DWFString &zSectionName, const DWFString &zObjectID) throw ()
_DWFTK_API const DWFStringpublishedIdentity () const 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 )

Protected Attributes

size_t _nSize


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 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.

Todo:
Detect invalid stream pointer and either throw an exception or return NULL.
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.

Examples:
SimpleW3DStreamProcessor/SimpleW3DStreamProcessor.cpp.

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

Returns the resource HREF.

Returns:
The HREF.
Exceptions:
None 

Definition at line 224 of file 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 197 of file Resource.h.

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

Returns the resource object ID.

Returns:
The object ID.
Exceptions:
None 

Definition at line 253 of file 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 279 of file Resource.h.

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

Receives and processes an attribute list from the parser; using it to initialize class members.

Example:

                 size_t iAttrib = 0;
       
                 for(; ppAttributeList[iAttrib]; iAttrib += 2)
                 {
                    //
                    // dump attribute 
                    //
                    cout << "Attribute Name: " << ppAttributeList[iAttrib] << " ";
                    cout << "Attribute Value: " << ppAttributeList[iAttrib+1] << endl;
                }

Parameters:
ppAttributeList An array of null-terminated atribute name, value string pairs. The array itself is zero-terminated.
Exceptions:
None 

Implements DWFToolkit::DWFXMLBuildable.

Reimplemented in DWFToolkit::DWFFontResource, DWFToolkit::DWFGraphicResource, and DWFToolkit::DWFImageResource.

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

Returns the publishing target HREF for the resource.

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.

Definition at line 362 of file Resource.h.

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

Returns the resource role.

Returns:
The role.
Exceptions:
None 

Definition at line 170 of file Resource.h.

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

Writes an XML representation of the object into a stream.

Parameters:
rSerializer The object that accepts the serialization of the object.
nFlags An implementation-defined set of options for altering the serialization process of this object.

Implements DWFToolkit::DWFXMLSerializable.

Reimplemented in DWFToolkit::DWFFontResource, DWFToolkit::DWFGraphicResource, DWFToolkit::DWFImageResource, and DWFToolkit::DWFObjectDefinitionResource.

_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. The resource location is usually a composition of the section name and resource object ID which is assigned at publish time.
Exceptions:
None 

Definition at line 240 of file 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, and SimpleEPlotWriter/SimpleEPlotWriter_UTF8.cpp.

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

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 

Definition at line 211 of file Resource.h.

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

Sets the resource object ID.

Parameters:
zObjectID A unique identifier.
Exceptions:
None 

Definition at line 266 of file 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 314 of file 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 

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

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.

_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 184 of file 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 157 of file Resource.h.

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

Returns the total uncompressed byte count of the resource data.

Returns:
The number of bytes.
Exceptions:
None 

Definition at line 327 of file Resource.h.

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

Returns the resource title.

Returns:
The title.
Exceptions:
None 

Definition at line 144 of file Resource.h.


Member Data Documentation

size_t DWFToolkit::DWFResource::_nSize [protected]
 

The total number of uncompressed bytes in the resource.

Definition at line 454 of file Resource.h.


The documentation for this class was generated from the following file:
Generated on Tue May 17 12:39:07 2005 for Autodesk DWF Toolkit by  doxygen 1.4.1