November 13, 2006
Re-applied the 'INF' fix for constraint limits.
This commit is contained in:
ejcoumans
2006-12-19 02:33:05 +00:00
parent 818b672f60
commit a0f320764b
391 changed files with 9317 additions and 5101 deletions

View File

@@ -32,7 +32,7 @@ public:
/**
* Constructor
*/
daeArray();
DLLSPEC daeArray();
/**
* Copy Constructor
*/
@@ -45,7 +45,7 @@ public:
/**
* Destructor
*/
virtual ~daeArray();
virtual DLLSPEC ~daeArray();
/**
* Clears the contents of the array. Do not use this function if the array contains @c daeSmartRef objects and the
* @c dom* class the array belongs to has a @c _contents member.
@@ -55,7 +55,7 @@ public:
* objects will not be removed from @c _contents, which can cause problems when you
* save the data. We recommended that @c clear() not be used on arrays that are part of a @c dom* object.
*/
virtual void clear();
virtual DLLSPEC void clear();
/**
* Sets the size of an element in the array when creating a @c daeArray of a specific type.
* @param elementSize Size of an element in the array.
@@ -91,7 +91,7 @@ public:
* Increases the size of the @c daeArray.
* @param sz Size to grow the array to.
*/
void grow(size_t sz);
void DLLSPEC grow(size_t sz);
/**
* Removes an item at a specific index in the @c daeArray.
* @param index Index number of the item to delete.
@@ -100,7 +100,7 @@ public:
* objects in two places, the class member and the <i> @c _contents </i> array, when you remove something from the
* dom, you must remove it from both places.
*/
virtual daeInt removeIndex(size_t index);
virtual DLLSPEC daeInt removeIndex(size_t index);
};
/**
@@ -122,11 +122,11 @@ public:
*/
daeTArray( const daeTArray<T> &cpy ) : daeArray() {
_count = cpy._count;
_capacity = cpy._capacity;
//_capacity = cpy._capacity;
_data = NULL;
_elementSize = cpy._elementSize;
_type = cpy._type;
grow(_capacity);
grow(_count);
for(size_t i=0;i<_count;i++)
set( i, cpy[i] );
}
@@ -199,8 +199,11 @@ public:
* @param value Value to store at index in the array.
*/
inline void set(size_t index, const T& value) {
if (index >= _capacity)
grow(index);
if (index >= _count)
{
//grow(index);
setCount(index+1);
}
((T*)_data)[index] = value; }
/**
@@ -219,7 +222,7 @@ public:
*/
inline size_t append(const T& value) {
set(_count, value);
_count++;
//_count++;
return _count-1;
}
@@ -300,11 +303,14 @@ public:
grow( _count +1 );
}
//memmove( &(((T*)_data)[index+1]), &(((T*)_data)[index]), (_count - index)*_elementSize );
for (size_t i = _count; i > index; i-- ) {
set( i, ((T*)_data)[i-1] );
for (size_t i = _count; i > index; i-- )
{
T tmp = ((T*)_data)[i-1];
set( i, tmp );
//set( i, ((T*)_data)[i-1] );
}
set( index, value );
_count++;
//_count++;
}
/**
@@ -315,13 +321,312 @@ public:
inline daeTArray<T> &operator=( const daeTArray<T> &other ) {
clear();
_count = other._count;
_capacity = other._capacity;
grow(_capacity);
//_capacity = other._capacity;
grow(_count);
for(size_t i=0;i<_count;i++)
set( i, other[i] );
return *this;
}
//some helpers
/**
* Sets the array to the contain the two values specified.
* @param one The first value.
* @param two The second value.
*/
void set2( const T &one, const T &two )
{
setCount( 2 );
set( 0, one );
set( 1, two );
}
/**
* Sets the array to the contain the three values specified.
* @param one The first value.
* @param two The second value.
* @param three The third value.
*/
void set3( const T &one, const T &two, const T &three )
{
setCount( 3 );
set( 0, one );
set( 1, two );
set( 2, three );
}
/**
* Sets the array to the contain the four values specified.
* @param one The first value.
* @param two The second value.
* @param three The third value.
* @param four The fourth value.
*/
void set4( const T &one, const T &two, const T &three, const T &four )
{
setCount( 4 );
set( 0, one );
set( 1, two );
set( 2, three );
set( 3, four );
}
/**
* Sets the values in the array at the specified location to the contain the two
* values specified. This function will grow the array if needed.
* @param index The position in the array to start setting.
* @param one The first value.
* @param two The second value.
*/
void set2at( size_t index, const T &one, const T &two )
{
set( index, one );
set( index+1, two );
}
/**
* Sets the values in the array at the specified location to the contain the three
* values specified. This function will grow the array if needed.
* @param index The position in the array to start setting.
* @param one The first value.
* @param two The second value.
* @param three The third value.
*/
void set3at( size_t index, const T &one, const T &two, const T &three )
{
set( index, one );
set( index+1, two );
set( index+2, three );
}
/**
* Sets the values in the array at the specified location to the contain the four
* values specified. This function will grow the array if needed.
* @param index The position in the array to start setting.
* @param one The first value.
* @param two The second value.
* @param three The third value.
* @param four The fourth value.
*/
void set4at( size_t index, const T &one, const T &two, const T &three, const T &four )
{
set( index, one );
set( index+1, two );
set( index+2, three );
set( index+3, four );
}
/**
* Appends two values to the array.
* @param one The first value.
* @param two The second value.
*/
void append2( const T &one, const T &two )
{
append( one );
append( two );
}
/**
* Appends three values to the array.
* @param one The first value.
* @param two The second value.
* @param three The third value.
*/
void append3( const T &one, const T &two, const T &three )
{
append( one );
append( two );
append( three );
}
/**
* Appends four values to the array.
* @param one The first value.
* @param two The second value.
* @param three The third value.
* @param four The fourth value.
*/
void append4( const T &one, const T &two, const T &three, const T &four )
{
append( one );
append( two );
append( three );
append( four );
}
/**
* Inserts two values into the array at the specified location.
* @param index The position in the array to start inserting.
* @param one The first value.
* @param two The second value.
*/
void insert2at( size_t index, const T &one, const T &two )
{
if ( index > _count )
setCount( index +2 );
else
setCount( _count +2 );
for (size_t i = _count; i > index+2; i-- )
{
T tmp = ((T*)_data)[i-3];
set( i-1, tmp );
}
set( index, one );
set( index+1, two );
}
/**
* Inserts three values into the array at the specified location.
* @param index The position in the array to start inserting.
* @param one The first value.
* @param two The second value.
* @param three The third value.
*/
void insert3at( size_t index, const T &one, const T &two, const T &three )
{
if ( index > _count )
setCount( index +3 );
else
setCount( _count +3 );
for (size_t i = _count; i > index+3; i-- )
{
T tmp = ((T*)_data)[i-4];
set( i-1, tmp );
}
set( index, one );
set( index+1, two );
set( index+2, three );
}
/**
* Inserts four values into the array at the specified location.
* @param index The position in the array to start inserting.
* @param one The first value.
* @param two The second value.
* @param three The third value.
* @param four The fourth value.
*/
void insert4at( size_t index, const T &one, const T &two, const T &three, const T &four )
{
if ( index > _count )
setCount( index +4 );
else
setCount( _count +4 );
for (size_t i = _count; i > index+4; i-- )
{
T tmp = ((T*)_data)[i-5];
set( i-1, tmp );
}
set( index, one );
set( index+1, two );
set( index+2, three );
set( index+4, four );
}
/**
* Gets two values from the array at the specified location.
* @param index The position in the array to start getting.
* @param one Variable to store the first value.
* @param two Variable to store the second value.
* @return Returns The number of elements retrieved.
*/
daeInt get2at( size_t index, T &one, T &two )
{
daeInt retVal = 0;
if ( index < _count )
{
one = get(index);
retVal++;
}
if ( index+1 < _count )
{
two = get(index+1);
retVal++;
}
return retVal;
}
/**
* Gets three values from the array at the specified location.
* @param index The position in the array to start getting.
* @param one Variable to store the first value.
* @param two Variable to store the second value.
* @param three Variable to store the third value.
* @return Returns The number of elements retrieved.
*/
daeInt get3at( size_t index, T &one, T &two, T &three )
{
daeInt retVal = 0;
if ( index < _count )
{
one = get(index);
retVal++;
}
if ( index+1 < _count )
{
two = get(index+1);
retVal++;
}
if ( index+2 < _count )
{
two = get(index+2);
retVal++;
}
return retVal;
}
/**
* Gets four values from the array at the specified location.
* @param index The position in the array to start getting.
* @param one Variable to store the first value.
* @param two Variable to store the second value.
* @param three Variable to store the third value.
* @param four Variable to store the fourth value.
* @return Returns The number of elements retrieved.
*/
daeInt get4at( size_t index, T &one, T &two, T &three, T &four )
{
daeInt retVal = 0;
if ( index < _count )
{
one = get(index);
retVal++;
}
if ( index+1 < _count )
{
two = get(index+1);
retVal++;
}
if ( index+2 < _count )
{
two = get(index+2);
retVal++;
}
if ( index+3 < _count )
{
two = get(index+3);
retVal++;
}
return retVal;
}
/**
* Appends a number of elements to this array from a C native array.
* @param num The number of elements to append.
* @param array The C native array that contains the values to append.
*/
void appendArray( size_t num, T *array )
{
if ( array == NULL )
return;
for ( size_t i = 0; i < num; i++ )
append( array[i] );
}
/**
* Appends a number of elements to this array from another daeTArray.
* @param array The daeTArray that contains the values to append.
*/
void appendArray( const daeTArray<T> &array ){
size_t num = array.getCount();
for ( size_t i = 0; i < num; i++ )
append( array[i] );
}
};

View File

@@ -83,10 +83,10 @@ public:
/**
* Resolves a reference, if indeed this type is a reference type.
* @param element The containing element.
* @param ma The @c deaMetaAttribute where the resolved reference
* @param src Source of the raw data to resolve.
* should be placed.
*/
virtual void resolve(daeElementRef element, daeMetaAttributeRef ma);
virtual void resolve(daeElementRef element, daeChar* src);
/**
* Determines if this atomic type requires a special string-based
@@ -436,6 +436,14 @@ public:
* false if the operation would cause the destination buffer to overflow.
*/
virtual daeBool memoryToString(daeChar* src, daeChar* dst, daeInt dstSize);
/**
* Overrides the base class @c stringToMemoryFunction().
* Reads an atomic typed item into the destination runtime memory.
* @param src Source string.
* @param dst Raw binary to store the resulting value.
* @return Returns true if the operation was successful, false if not successful.
*/
virtual daeBool stringToMemory(daeChar* src, daeChar* dst);
};
/**
@@ -459,6 +467,14 @@ public:
* false if the operation would cause the destination buffer to overflow.
*/
virtual daeBool memoryToString(daeChar* src, daeChar* dst, daeInt dstSize);
/**
* Overrides the base class @c stringToMemoryFunction().
* Reads an atomic typed item into the destination runtime memory.
* @param src Source string.
* @param dst Raw binary to store the resulting value.
* @return Returns true if the operation was successful, false if not successful.
*/
virtual daeBool stringToMemory(daeChar* src, daeChar* dst);
};
/**
@@ -659,10 +675,10 @@ public:
* Overrides the base class @c resolve() function
* Resolves a reference, if indeed this type is a reference type
* @param element The containing element.
* @param ma The @c deaMetaAttribute where the resolved reference
* @param src Source of the raw data to resolve.
* should be placed.
*/
virtual void resolve(daeElementRef element, daeMetaAttributeRef ma);
virtual void resolve(daeElementRef element, daeChar* src);
/**
* Override base class function.
* Determines if this atomic type requires a special string-based
@@ -706,10 +722,10 @@ public:
* Overrides the base class @c resolve() function
* Resolves a reference, if indeed this type is a reference type.
* @param element The containing element.
* @param ma The @c deaMetaAttribute where the resolved reference
* @param src Source of the raw data to resolve.
* should be placed.
*/
virtual void resolve(daeElementRef element, daeMetaAttributeRef ma);
virtual void resolve(daeElementRef element, daeChar* src);
};

View File

@@ -29,7 +29,7 @@ public:
/**
* Destructor.
*/
virtual ~daeDatabase() {}
virtual DLLSPEC ~daeDatabase() {}
/** @name Documents */
//@{
@@ -42,7 +42,7 @@ public:
* @note The @c daeElement passed in as <tt><i>dom</i></tt> should always be a @c domCOLLADA object, the API may enforce this in the future.
* @deprecated This function will be removed in future versions. Please use createDocument.
*/
virtual daeInt insertDocument(daeString name, daeElement* dom, daeDocument** document = NULL) = 0;
virtual DLLSPEC daeInt insertDocument(daeString name, daeElement* dom, daeDocument** document = NULL) = 0;
/**
* Creates a new @c domCOLLADA root element and a new document; returns an error if the document name already exists.
* @param name Name of the new document, must be a valid URI.
@@ -50,7 +50,7 @@ public:
* @return Returns DAE_OK if the document was created successfully, otherwise returns a negative value as defined in daeError.h.
* @deprecated This function will be removed in future versions. Please use createDocument.
*/
virtual daeInt insertDocument(daeString name, daeDocument** document = NULL) = 0;
virtual DLLSPEC daeInt insertDocument(daeString name, daeDocument** document = NULL) = 0;
/**
* Creates a new document, defining its root as the <tt><i>dom</i></tt> object; returns an error if the document name already exists.
* @param name Name of the new document, must be a valid URI.
@@ -59,59 +59,59 @@ public:
* @return Returns @c DAE_OK if the document was created successfully, otherwise returns a negative value as defined in daeError.h.
* @note The @c daeElement passed in as <tt><i>dom</i></tt> should always be a @c domCOLLADA object, the API may enforce this in the future.
*/
virtual daeInt createDocument(daeString name, daeElement* dom, daeDocument** document = NULL) = 0;
virtual DLLSPEC daeInt createDocument(daeString name, daeElement* dom, daeDocument** document = NULL) = 0;
/**
* Creates a new @c domCOLLADA root element and a new document; returns an error if the document name already exists.
* @param name Name of the new document, must be a valid URI.
* @param document Pointer to a @c daeDocument pointer that receives the document created
* @return Returns DAE_OK if the document was created successfully, otherwise returns a negative value as defined in daeError.h.
*/
virtual daeInt createDocument(daeString name, daeDocument** document = NULL) = 0;
virtual DLLSPEC daeInt createDocument(daeString name, daeDocument** document = NULL) = 0;
/**
* Inserts an already existing document into the database.
* @param c The document to insert.
* @return Returns DAE_OK if the document was inserted successfully, otherwise returns a negative value as defined in daeError.h.
*/
virtual daeInt insertDocument( daeDocument *c ) = 0;
virtual DLLSPEC daeInt insertDocument( daeDocument *c ) = 0;
/**
* Removes a document from the database.
* @param document Document to remove from the database
* @return Returns DAE_OK if the document was successfully removed, otherwise returns a negative value as defined in daeError.h.
*/
virtual daeInt removeDocument(daeDocument* document) = 0;
virtual DLLSPEC daeInt removeDocument(daeDocument* document) = 0;
/**
* Gets the number of documents.
* @return Returns the number of documents.
*/
virtual daeUInt getDocumentCount() = 0;
virtual DLLSPEC daeUInt getDocumentCount() = 0;
/**
* Gets a document based on the document index.
* @param index Index of the document to get.
* @return Returns a pointer on the document, or NULL if not found.
*/
virtual daeDocument* getDocument(daeUInt index) = 0;
virtual DLLSPEC daeDocument* getDocument(daeUInt index) = 0;
/**
* Gets a document based on the document name.
* @param name The name of the document as a URI.
* @return Returns a pointer to the document, or NULL if not found.
* @note If the URI contains a fragment, the fragment is stripped off.
*/
virtual daeDocument* getDocument(daeString name) = 0;
virtual DLLSPEC daeDocument* getDocument(daeString name) = 0;
/**
* Gets a document name.
* @param index Index of the document to get.
* @return Returns the name of the document at the given index.
*/
virtual daeString getDocumentName(daeUInt index) = 0;
virtual DLLSPEC daeString getDocumentName(daeUInt index) = 0;
/**
* Indicates if a document is loaded or not.
* @param name Name of the document as a URI.
* @return Returns true if the document is loaded, false otherwise.
* @note If the URI contains a fragment, the fragment is stripped off.
*/
virtual daeBool isDocumentLoaded(daeString name) = 0;
virtual DLLSPEC daeBool isDocumentLoaded(daeString name) = 0;
//@}
/** @name Elements */
@@ -120,20 +120,20 @@ public:
* Gets the number of types in the database.
* @return Returns the number of different types of objects inserted in the database.
*/
virtual daeUInt getTypeCount() = 0;
virtual DLLSPEC daeUInt getTypeCount() = 0;
/**
* Retrieves the name of a type of object inserted in the database.
* @param index Index of the type; must be between 0 and <tt> daeDatabase::getTypeCount()-1 </tt>
* @return Returns the name of the type, NULL if the index is invalid.
*/
virtual daeString getTypeName(daeUInt index) = 0;
virtual DLLSPEC daeString getTypeName(daeUInt index) = 0;
/**
* Inserts a @c daeElement into the runtime database.
* @param document Document in which the @c daeElement lives.
* @param element @c daeElement to insert in the database
* @return Returns @c DAE_OK if element successfully inserted, otherwise returns a negative value as defined in daeError.h.
*/
virtual daeInt insertElement(daeDocument* document,
virtual DLLSPEC daeInt insertElement(daeDocument* document,
daeElement* element) = 0;
/**
* Removes a @c daeElement from the runtime database; not implemented in the reference STL implementation.
@@ -142,7 +142,7 @@ public:
* @return Returns @c DAE_OK if element successfully removed, otherwise returns a negative value as defined in daeError.h.
* @note This function is not implemented in the reference STL implementation.
*/
virtual daeInt removeElement(daeDocument* document,
virtual DLLSPEC daeInt removeElement(daeDocument* document,
daeElement* element) = 0;
/**
* Unloads all of the documents of the runtime database.
@@ -150,7 +150,7 @@ public:
* except any objects on which you still have a smart pointer reference (@c daeSmartRef).
* @return Returns @c DAE_OK if all documents successfully unloaded, otherwise returns a negative value as defined in daeError.h.
*/
virtual daeInt clear() = 0;
virtual DLLSPEC daeInt clear() = 0;
/**
* Optimizes the database.
* This function takes time; it is called by the interface at the end of a load operation.
@@ -158,7 +158,7 @@ public:
* need to be sorted. All database search functions call @c validate(); you should not need to
* call this function directly.
*/
virtual void validate() = 0;
virtual DLLSPEC void validate() = 0;
//@}
/** @name Queries */
@@ -175,7 +175,7 @@ public:
* @param file Name of the document or file, for example, "myDocument.xml", can be NULL
* @return Returns the number of elements matching this query.
*/
virtual daeUInt getElementCount(daeString name = NULL,
virtual DLLSPEC daeUInt getElementCount(daeString name = NULL,
daeString type = NULL,
daeString file = NULL) = 0;
/**
@@ -198,7 +198,7 @@ public:
* @param file Name of the document or file, for example, "myDocument.xml", can be NULL
* @return Returns DAE_OK upon success, returns DAE_ERR_QUERY_NO_MATCH if there is no match, otherwise, returns a negative value as defined in daeError.h.
*/
virtual daeInt getElement(daeElement** pElement,
virtual DLLSPEC daeInt getElement(daeElement** pElement,
daeInt index,
daeString name = NULL,
daeString type = NULL,
@@ -210,7 +210,7 @@ public:
* @return Returns DAE_OK if it succeeds, returns DAE_ERR_QUERY_NO_MATCH if there is no match, otherwise returns a negative value as defined in daeError.h.
* @note This function is not implemented.
*/
virtual daeInt queryElement(daeElement** pElement, daeString genericQuery) = 0;
virtual DLLSPEC daeInt queryElement(daeElement** pElement, daeString genericQuery) = 0;
//@}
/**
@@ -222,40 +222,40 @@ public:
* @param _topMeta Top meta object to use to create objects to fill the database.
* @return Returns DAE_OK if successful, otherwise returns a negative value defined in daeError.h.
*/
virtual daeInt setMeta(daeMetaElement *_topMeta) = 0;
virtual DLLSPEC daeInt setMeta(daeMetaElement *_topMeta) = 0;
public: //Depricated methods
inline daeInt insertCollection(daeString name, daeElement* dom, daeDocument** document = NULL) {
inline DLLSPEC daeInt insertCollection(daeString name, daeElement* dom, daeDocument** document = NULL) {
return insertDocument( name, dom, document );
}
inline daeInt insertCollection(daeString name, daeDocument** document = NULL) {
inline DLLSPEC daeInt insertCollection(daeString name, daeDocument** document = NULL) {
return insertDocument( name, document );
}
inline daeInt createCollection(daeString name, daeElement* dom, daeDocument** document = NULL) {
inline DLLSPEC daeInt createCollection(daeString name, daeElement* dom, daeDocument** document = NULL) {
return createDocument( name, dom, document );
}
inline daeInt createCollection(daeString name, daeDocument** document = NULL) {
inline DLLSPEC daeInt createCollection(daeString name, daeDocument** document = NULL) {
return createDocument( name, document );
}
inline daeInt insertCollection( daeDocument *c ) {
inline DLLSPEC daeInt insertCollection( daeDocument *c ) {
return insertDocument( c );
}
inline daeInt removeCollection(daeDocument* document) {
inline DLLSPEC daeInt removeCollection(daeDocument* document) {
return removeDocument( document );
}
inline daeUInt getCollectionCount() {
inline DLLSPEC daeUInt getCollectionCount() {
return getDocumentCount();
}
inline daeDocument* getCollection(daeUInt index) {
inline DLLSPEC daeDocument* getCollection(daeUInt index) {
return getDocument( index );
}
inline daeDocument* getCollection(daeString name) {
inline DLLSPEC daeDocument* getCollection(daeString name) {
return getDocument( name );
}
inline daeString getCollectionName(daeUInt index) {
inline DLLSPEC daeString getCollectionName(daeUInt index) {
return getDocumentName( index );
}
inline daeBool isCollectionLoaded(daeString name) {
inline DLLSPEC daeBool isCollectionLoaded(daeString name) {
return isDocumentLoaded( name );
}

View File

@@ -25,6 +25,12 @@
class daeDocument
{
public:
// sthomas
/**
* Destructor
*/
DLLSPEC ~daeDocument();
/**
* Accessor to get the @c domCollada associated with this document.
* @return A @c daeElementRef for the @c domCollada that is the root of this document.
@@ -37,7 +43,7 @@ public:
* @param domRoot the domCollada that is the root of this document
* @remarks Should really require a domColladaRef but we're trying to avoid having dae classes depend on generated dom classes.
*/
void setDomRoot(daeElement* domRoot) {dom = domRoot;}
void setDomRoot(daeElement* domRoot) {dom = domRoot; domRoot->setDocument(this); }
/**
* Accessor to get the URI associated with the document in this document;
* this is currently set to the URI from which the document was loaded, but
@@ -73,14 +79,14 @@ public:
* @note This function is called internally and not meant to be called by the client application.
* Calling this function from the client application may result in unexpected behavior.
*/
void insertElement( daeElementRef element );
DLLSPEC void insertElement( daeElementRef element );
/**
* This function is used to track how a document gets modified. It gets called internally.
* @param element The element that was removed from this document.
* @note This function is called internally and not meant to be called by the client application.
* Calling this function from the client application may result in unexpected behavior.
*/
void removeElement( daeElementRef element );
DLLSPEC void removeElement( daeElementRef element );
/**
* This function is used to track how a document gets modified. It gets called internally.
@@ -98,14 +104,14 @@ public:
* @note This function gets called internally from daeURI upon trying to resolve an element.
* Calling this function in your client code my result in unexpected behavior.
*/
void addExternalReference( daeURI &uri );
DLLSPEC void addExternalReference( daeURI &uri );
/**
* Removes a URI to the list of external references in this document.
* @param uri The URI that was the external reference.
* @note This function gets called internally from daeURI upon trying to resolve an element.
* Calling this function in your client code my result in unexpected behavior.
*/
void removeExternalReference( daeURI &uri );
DLLSPEC void removeExternalReference( daeURI &uri );
/**
* Gets a list of all the documents that are referenced from URI contained within this document.
* @return Returns a list of URI strings, each being a URI which is referenced from within this document.
@@ -116,7 +122,9 @@ public:
* @param docURI The URI string of the document that you want to resolve against.
* @note This function is called internally whenever a new document is loaded.
*/
void resolveExternals( daeString docURI);
DLLSPEC void resolveExternals( daeString docURI);
DLLSPEC const daeTArray<daeURI*> *getExternalURIs(daeStringRef docURI) const;
private:
/**

View File

@@ -22,6 +22,15 @@
//#include <malloc.h>
//#endif
namespace COLLADA_TYPE
{
#ifdef _MSC_VER
enum TypeEnum;
#else
typedef const int TypeEnum;
#endif
};
class daeMetaElement;
class daeIntegrationObject;
class daeDocument;
@@ -29,6 +38,18 @@ class daeURI;
template <typename T> class daeSmartRef;
//Contributed by Nus - Wed, 08 Nov 2006
/**
* Initializing resolve array.
*/
extern "C" void initializeResolveArray(void);
/**
* Terminating resolve array.
*/
extern "C" void terminateResolveArray(void);
//-------------------
/**
* The @c daeElement class represents an instance of a COLLADA "Element";
* it is the main base class for the COLLADA Dom.
@@ -58,7 +79,7 @@ protected:
public:
/** An enum that describes the state of user integration with this object */
enum IntegrationState {
DLLSPEC enum IntegrationState {
/** The user integration is not initialized */
int_uninitialized,
/** The user integration object has been created */
@@ -78,20 +99,22 @@ public:
* @note This should not be used externally.
* Use factories to create elements
*/
daeElement();
DLLSPEC daeElement();
/**
* Element Destructor.
* @note This should not be used externally,
* if daeSmartRefs are being used.
*/
virtual ~daeElement();
virtual DLLSPEC ~daeElement();
// sthomas (see https://collada.org/public_forum/viewtopic.php?t=325&)
static void releaseElements();
/**
* Decrements the reference count and deletes the object if reference count is zero.
* @note Should not be used externally if daeSmartRefs are being used, they call it
* automatically.
*/
void release() const;
DLLSPEC void release() const;
/**
* Increments the reference count of this element.
@@ -101,17 +124,17 @@ public:
inline void ref() const {_refCount++;}
/**
* Resolves all fields of type daeURI.
* This is done via database query of the URI.
* Resolves all fields of type daeURI and IDRef.
* This is done via database query of the URI or IDRef.
*/
void resolve();
DLLSPEC void resolve();
/**
* Sets up a @c daeElement. Called on all @c daeElements as part of their initialization.
* @param meta Meta element to use to configure this element.
* @note Should not be called externally.
*/
void setup(daeMetaElement* meta);
DLLSPEC void setup(daeMetaElement* meta);
/**
* Places an element as a child of @c this element.
@@ -124,7 +147,7 @@ public:
* @param element Element to be placed in the @c this container.
* @return Returns true if the element was successfully placed, false otherwise.
*/
daeBool placeElement(daeElement* element);
DLLSPEC daeBool placeElement(daeElement* element);
/**
* This function searches through the list of potential child elements
@@ -139,7 +162,7 @@ public:
* @param element is the element to be placed in the 'this' container.
* @return return whether or not the element was successfully placed.
*/
daeBool placeElementAt(daeInt index, daeElement* element);
DLLSPEC daeBool placeElementAt(daeInt index, daeElement* element);
/**
* Places an element as a child of @c this element.
@@ -149,7 +172,7 @@ public:
* @param element Element to be placed in the @c this container.
* @return Returns true if the element was successfully placed, false otherwise.
*/
daeBool placeElementBefore( daeElement* marker, daeElement *element );
DLLSPEC daeBool placeElementBefore( daeElement* marker, daeElement *element );
/**
* Places an element as a child of @c this element.
@@ -159,7 +182,7 @@ public:
* @param element Element to be placed in the @c this container.
* @return Returns true if the element was successfully placed, false otherwise.
*/
daeBool placeElementAfter( daeElement* marker, daeElement *element );
DLLSPEC daeBool placeElementAfter( daeElement* marker, daeElement *element );
/**
* Finds the last index into the array of children of the type specified.
@@ -167,7 +190,7 @@ public:
* @return Returns the index into the children array of the last element of type typeName. -1 if
* there are no children of type typeName.
*/
daeInt findLastIndexOf( daeString elementName );
DLLSPEC daeInt findLastIndexOf( daeString elementName );
/**
* Removes the specified element from it parent, the @c this element.
@@ -179,7 +202,7 @@ public:
* @param element Element to be removed in the @c this container.
* @return Returns true if the element was successfully removed, false otherwise.
*/
daeBool removeChildElement(daeElement* element);
DLLSPEC daeBool removeChildElement(daeElement* element);
/**
* Removes the specified element from its parent element.
@@ -209,7 +232,7 @@ public:
* @param attrValue String-based value to apply to the attribute.
* @return Returns true if the attribute was found and the value was set, false otherwise.
*/
virtual daeBool setAttribute(daeString attrName, daeString attrValue);
virtual DLLSPEC daeBool setAttribute(daeString attrName, daeString attrValue);
/**
* Checks if an attribute has been set either by being loaded from the COLLADA document or set
@@ -218,14 +241,14 @@ public:
* @return Returns true if the attribute has been set. False if the attribute hasn't been set
* or doesn't exist for this element.
*/
daeBool isAttributeSet( daeString attrName );
DLLSPEC daeBool isAttributeSet( daeString attrName );
/**
* Checks if this element can have the attribute specified.
* @param attrName The name of the attribute to look for.
* @return Returns true is this element can have an attribute with the name specified. False otherwise.
*/
daeBool hasAttribute( daeString attrName );
DLLSPEC daeBool hasAttribute( daeString attrName );
/**
* Gets a pointer to the value of the attribute specified.
@@ -233,7 +256,20 @@ public:
* @return Returns a daeMemoryRef (char *) to the value of the attribute. The return value will need
* to be typecast to the appropriate type. Returns NULL if the attribute does not exist.
*/
daeMemoryRef getAttributeValue( daeString attrName );
DLLSPEC daeMemoryRef getAttributeValue( daeString attrName );
/**
* Checks if this element can have a value.
* @return Returns true is this element can have a value. False otherwise.
*/
DLLSPEC daeBool hasValue();
/**
* Gets a pointer to the element's value.
* @return Returns a daeMemoryRef (char *) to the value of the element. The return value will need
* to be typecast to the appropriate type. Returns NULL if the element does not allow a value.
*/
DLLSPEC daeMemoryRef getValuePointer();
/**
* Finds the database document associated with @c this element.
@@ -251,34 +287,34 @@ public:
* Sets the database document associated with this element.
* @param c The daeDocument to associate with this element.
*/
void setDocument(daeDocument* c );
DLLSPEC void setDocument(daeDocument* c );
/**
* Deprecated.
*/
void setCollection(daeDocument* c );
DLLSPEC void setCollection(daeDocument* c );
/**
* Gets the URI of the document containing this element, note that this is NOT the URI of the element.
* @return Returns a pointer to the daeURI of the document containing this element.
*/
daeURI* getDocumentURI() const;
DLLSPEC daeURI* getDocumentURI() const;
/**
* Creates an element via the element factory system. This creation
* is based @em only on potential child elements of this element.
* @param className Class name of the subelement to create.
* @param elementName Class name of the subelement to create.
* @return Returns the created @c daeElement, if it was successfully created.
*/
daeSmartRef<daeElement> createElement(daeString className);
DLLSPEC daeSmartRef<daeElement> createElement(daeString elementName);
/**
* Creates a subelement via @c createElement() and places it via @c placeElement().
* Automatically adds the new element to the <tt><i> _contents </i></tt> of its parent, if the parent has one.
* This is the primary method used to construct the COLLADA dom hierarchy.
* @param className - Class name of the subelement to create.
* @param elementName - Class name of the subelement to create.
* @return Returns the created @c daeElement, if it was successfully created.
*/
daeElement* createAndPlace(daeString className);
DLLSPEC daeElement* createAndPlace(daeString elementName);
/**
* Create a sub-element via #createElement and place it via #placeElementAt
@@ -286,10 +322,10 @@ public:
* parent, if the parent has one.
* This is useful when constructing the COLLADA dom hierarchy
* @param index the position in the _contents array the newly created element is to be placed at
* @param className - the className of the sub-element to be created
* @param elementName - the className of the sub-element to be created
* @return the created element if it was in fact successfully created.
*/
daeElement* createAndPlaceAt(daeInt index, daeString className);
DLLSPEC daeElement* createAndPlaceAt(daeInt index, daeString elementName);
/**
* Gets the container element for @c this element.
@@ -328,25 +364,31 @@ public:
* @return Returns the @c daeIntegrationObject associated with this COLLADA element
* instance.
*/
daeIntegrationObject* getIntObject( IntegrationState from_state = int_converted, IntegrationState to_state = int_uninitialized );
DLLSPEC daeIntegrationObject* getIntObject( IntegrationState from_state = int_converted, IntegrationState to_state = int_uninitialized );
/**
* Gets the element type.
* @return Returns the COLLADA_TYPE::TypeEnum value corresponding to this element's type.
*/
virtual COLLADA_TYPE::TypeEnum getElementType() const { return (COLLADA_TYPE::TypeEnum)0; }
/**
* Gets the element type name for this element.
* @return Returns the string for the type name.
*/
daeString getTypeName() const;
DLLSPEC daeString getTypeName() const;
/**
* Gets this element's name.
* @return Returns the string for the name.
* @remarks This function returns NULL if the element's name is identical to it's type's name.
*/
daeString getElementName() const;
DLLSPEC daeString getElementName() const;
/**
* Sets this element's name.
* @param nm Specifies the string to use as the element's name.
* @remarks Use caution when using this function since you can easily create invalid COLLADA documents.
*/
void setElementName( daeString nm );
DLLSPEC void setElementName( daeString nm );
/**
* Gets the element ID if it exists.
@@ -354,7 +396,7 @@ public:
* an attribute on this element type.
* @return the string for the element ID if it exists.
*/
daeString getID() const;
DLLSPEC daeString getID() const;
/**
* Gets the children/sub-elements of this element.
@@ -364,7 +406,7 @@ public:
* @param array The return value. An elementref array to append this element's children to.
*/
//void getChildren( daeElementRefArray &array );
void getChildren( daeTArray<daeSmartRef<daeElement> > &array );
DLLSPEC void getChildren( daeTArray<daeSmartRef<daeElement> > &array );
/**
* Clones/deep copies this @c daeElement and all of it's subtree.
@@ -374,7 +416,7 @@ public:
* Default is no name mangling.
* @return Returns a @c daeElement smartref of the copy of this element.
*/
daeSmartRef<daeElement> clone( daeString idSuffix = NULL, daeString nameSuffix = NULL );
DLLSPEC daeSmartRef<daeElement> clone( daeString idSuffix = NULL, daeString nameSuffix = NULL );
public:
/**
@@ -383,7 +425,12 @@ public:
* This is used as part of post-parsing process of a COLLADA instance document,
* which results in a new document in the database.
*/
static void resolveAll();
static DLLSPEC void resolveAll();
/**
* Clears the resolveArray.
*/
static DLLSPEC void clearResolveArray();
public:
/**
* Releases the element passed in. This function is a static wrapper that invokes
@@ -391,7 +438,7 @@ public:
* if it is not NULL.
* @param elem Element to call @c release() for, if the element exists.
*/
static void release(const daeElement* elem) {if (elem != NULL) elem->release();}
static DLLSPEC void release(const daeElement* elem) {if (elem != NULL) elem->release();}
/**
* Increments the reference counter for the element passed in. This function is a static wrapper
@@ -399,7 +446,7 @@ public:
* if it is not NULL.
* @param elem Element to call @c ref() for, if the element exists.
*/
static void ref(const daeElement* elem) { if (elem != NULL) elem->ref(); }
static DLLSPEC void ref(const daeElement* elem) { if (elem != NULL) elem->ref(); }
/**
* Appends the passed in element to the list of elements that need to be resolved.
@@ -407,7 +454,7 @@ public:
* @param elem Element to add to the list of elements
* waiting for their @c daeURIs to be resolved.
*/
static void appendResolveElement(daeElement* elem);
static DLLSPEC void appendResolveElement(daeElement* elem);
};
#include <dae/daeSmartRef.h>
@@ -418,4 +465,12 @@ typedef daeTArray<daeElementRef> daeElementRefArray;
extern daeElementRef DAECreateElement(int nbytes);
template <typename T>
inline T *daeSafeCast( daeElement *element )
{
if ( element && element->getMeta() == T::_Meta )
return (T *)element;
return NULL;
}
#endif //__DAE_ELEMENT_H__

View File

@@ -41,6 +41,10 @@
* @param errorCode Error code returned by a function of the API.
* @return Returns an English string describing the error.
*/
#ifdef WIN32
__declspec( dllexport ) const char *daeErrorString(int errorCode);
#else
const char *daeErrorString(int errorCode);
#endif
#endif //__DAE__ERROR__

View File

@@ -21,7 +21,7 @@
* messages get handled in the client application. An example of this would be a class that reports
* the message to a gui front end instead of just printing on stdout.
*/
class daeErrorHandler {
class DLLSPEC daeErrorHandler {
public:
/**
* Constructor.

View File

@@ -0,0 +1,30 @@
/*
* Copyright 2006 Sony Computer Entertainment Inc.
*
* Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://research.scea.com/scea_shared_source_license.html
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing permissions and limitations under the
* License.
*/
#ifndef __DAE_GCC_PLATFORM_H__
#define __DAE_GCC_PLATFORM_H__
#define PLATFORM_INT8 char
#define PLATFORM_INT16 short
#define PLATFORM_INT32 int
#define PLATFORM_INT64 long long
#define PLATFORM_UINT8 unsigned char
#define PLATFORM_UINT16 unsigned short
#define PLATFORM_UINT32 unsigned int
#define PLATFORM_UINT64 unsigned long long
#define PLATFORM_FLOAT32 float
#define PLATFORM_FLOAT64 double
#define DLLSPEC
#endif

View File

@@ -11,21 +11,22 @@
* License.
*/
#ifndef __DAE_WIN32_PLATFORM_H__
#define __DAE_WIN32_PLATFORM_H__
#ifndef __DAE_GENERIC_PLATFORM_H__
#define __DAE_GENERIC_PLATFORM_H__
#include <limits.h>
#define PLATFORM_INT8 char
#define PLATFORM_INT16 short
#define PLATFORM_INT32 int
#define PLATFORM_INT64 long
#define PLATFORM_INT128 long long
#define PLATFORM_INT64 long long
#define PLATFORM_UINT8 unsigned char
#define PLATFORM_UINT16 unsigned short
#define PLATFORM_UINT32 unsigned int
#define PLATFORM_UINT64 unsigned long
#define PLATFORM_UINT128 unsigned long long
#define PLATFORM_UINT64 unsigned long long
#define PLATFORM_FLOAT32 float
#define PLATFORM_FLOAT64 double
#define DLLSPEC
#endif

View File

@@ -35,7 +35,7 @@ public:
/**
* An enum describing the status of the ID resolution process.
*/
enum ResolveState{
DLLSPEC enum ResolveState{
/** No ID specified */
id_empty,
/** ID specified but not resolved */
@@ -116,36 +116,36 @@ public:
/**
* Simple Constructor
*/
daeIDRef();
DLLSPEC daeIDRef();
/**
* Destructor
*/
~daeIDRef();
DLLSPEC ~daeIDRef();
/**
* Constructs an id reference via a string, using @c setID(); loads the status.
* @param id ID to construct a reference for, passed to @c setID() automatically.
*/
daeIDRef(daeString id);
DLLSPEC daeIDRef(daeString id);
/**
* Constructs a new id reference by copying an existing one.
* @param constructFromIDRef @c daeIDRef to copy into this one.
*/
daeIDRef(daeIDRef& constructFromIDRef);
DLLSPEC daeIDRef(daeIDRef& constructFromIDRef);
/**
* Copies <tt><i>ID</i></tt> into the <tt><i>id </i></tt> data member.
* After the call to @c setID(), the <tt><i>state</i></tt> is set to @c id_loaded
* @param ID String to use to configure this @c daeIDRef.
*/
void setID(daeString ID);
DLLSPEC void setID(daeString ID);
/**
* Gets the ID string
* @return Returns the full ID string from <tt><i>id.</i></tt>
*/
daeString getID() const;
DLLSPEC daeString getID() const;
/**
* Uses the @c daeIDRefResolver static API to try to resolve this ID
@@ -154,43 +154,57 @@ public:
* a database query, et cetera based on the @c daeIDRefResolver plugins
* implemented.
*/
void resolveElement( daeString typeNameHint = NULL );
DLLSPEC void resolveElement( daeString typeNameHint = NULL );
/**
* Configures the <tt><i>id</i></tt> string of this @c daeIDRef based on the element set its <tt><i>element</i></tt> data member.
* Uses @c daeElement::getID() to get the element's ID information to configure
* the <tt><i>id</i></tt> string.
*/
void resolveID();
DLLSPEC void resolveID();
/**
* Sets the <tt><i>state</i></tt> of this @c daeIDRef to @c id_pending, as it is awaiting a call to
* @c resolveElement().
*/
void validate();
DLLSPEC void validate();
/**
* Copies <tt><i>from</i></tt> into <tt><i>this.</i></tt>
* The function does a simple copy, and not "base validation".
* @param from @c daeIDRef to copy from.
*/
void copyFrom(daeIDRef& from);
DLLSPEC void copyFrom(daeIDRef& from);
/**
* Outputs all components of this @c daeIDRef to stderr.
*/
void print();
DLLSPEC void print();
/**
* Resets this @c daeIDRef; frees all string references
* and returns <tt><i>state</i></tt> to @c empty.
*/
void reset();
DLLSPEC void reset();
/**
* Initializes the @c daeIDREf, setting <tt><i>id, element,</i></tt> and <tt><i>container</i></tt> to NULL.
*/
void initialize();
DLLSPEC void initialize();
/**
* Comparison operator.
* @return Returns true if URI's are equal.
*/
inline bool operator==(const daeIDRef& other) const{
return (!strcmp(other.getID(), getID())); }
daeIDRef &operator=( const daeIDRef& other) {
setID(other.getID());
element = other.element;
state = other.state;
return *this;
}
//Backwards Compatibility
daeIDRef &get( daeUInt idx ) { (void)idx; return *this; }
@@ -216,15 +230,27 @@ public:
/**
* Constructor; base constructor appends @c this to <tt><i>_KnownResolvers</i></tt> list.
*/
daeIDRefResolver();
DLLSPEC daeIDRefResolver();
/**
* Destructor
*/
virtual ~daeIDRefResolver();
virtual DLLSPEC ~daeIDRefResolver();
//Contributed by Nus - Wed, 08 Nov 2006
/**
* Initialize ID reference solver
*/
static void initializeIDRefSolver(void);
/**
* Terminate ID reference solver
*/
static void terminateIDRefSolver(void);
//-------------------------
protected:
static daeIDRefResolverPtrArray _KnownResolvers;
static daeIDRefResolverPtrArray* _KnownResolvers;
public:
/**
@@ -232,14 +258,14 @@ public:
* calling @c resolveElement().
* @param id @c daeIDRef to resolve.
*/
static void attemptResolveElement(daeIDRef &id, daeString typeNameHint = NULL );
static DLLSPEC void attemptResolveElement(daeIDRef &id, daeString typeNameHint = NULL );
/**
* attemptResolveID iterates through known resolvers
* calling resolveID().
* @param id @c daeIDRef to resolve.
*/
static void attemptResolveID(daeIDRef &id);
static DLLSPEC void attemptResolveID(daeIDRef &id);
public: // Abstract Interface
/**
@@ -248,20 +274,20 @@ public: // Abstract Interface
* @return Returns true if the @c daeIDRefResolver successfully resolved the IDRef,
* returns false otherwise.
*/
virtual daeBool resolveElement(daeIDRef& IDRef, daeString typeNameHint = NULL ) = 0;
virtual DLLSPEC daeBool resolveElement(daeIDRef& IDRef, daeString typeNameHint = NULL ) = 0;
/**
* Provides an abstract interface to convert a @c daeElement into a @c daeIDRef.
* @param IDRef @c daeIDRef to resolve.
* @return Returns true if the @c daeIDRefResolver successfully resolved the element
* into a @c daeIDRef, returns false otherwise.
*/
virtual daeBool resolveID(daeIDRef& IDRef) = 0;
virtual DLLSPEC daeBool resolveID(daeIDRef& IDRef) = 0;
/**
* Gets the name of this resolver.
* @return Returns the string name.
*/
virtual daeString getName() = 0;
virtual DLLSPEC daeString getName() = 0;
};
@@ -278,12 +304,12 @@ public:
* Constructor
* @param database @c daeDatabase for this implementation.
*/
daeDefaultIDRefResolver(daeDatabase* database);
DLLSPEC daeDefaultIDRefResolver(daeDatabase* database);
/**
* Destructor
*/
~daeDefaultIDRefResolver();
DLLSPEC ~daeDefaultIDRefResolver();
protected:
daeDatabase* _database;
@@ -292,17 +318,17 @@ public: // Abstract Interface
/*
* Implements base class abstract routine from @c daeIDRefResolver.
*/
virtual daeBool resolveElement(daeIDRef& id, daeString typeNameHint = NULL );
virtual DLLSPEC daeBool resolveElement(daeIDRef& id, daeString typeNameHint = NULL );
/*
* Implements base class abstract routine from @c daeIDRefResolver.
*/
virtual daeBool resolveID(daeIDRef& id);
virtual DLLSPEC daeBool resolveID(daeIDRef& id);
/*
* Implements base class abstract routine from @c daeIDRefResolver.
*/
virtual daeString getName();
virtual DLLSPEC daeString getName();
};
#endif //__DAE_IDREF_H__

View File

@@ -41,7 +41,7 @@ public:
* @param topMeta Top meta object to use to create objects to fill the database.
* @return Returns DAE_OK if successful, otherwise returns a negative value defined in daeError.h.
*/
virtual daeInt setMeta(daeMetaElement *topMeta) = 0;
virtual DLLSPEC daeInt setMeta(daeMetaElement *topMeta) = 0;
/** @name Database setup */
//@{
@@ -52,7 +52,7 @@ public:
* for storage and queries.
* @param database Database to set.
*/
virtual void setDatabase(daeDatabase* database) = 0;
virtual DLLSPEC void setDatabase(daeDatabase* database) = 0;
//@}
@@ -68,7 +68,7 @@ public:
* @return Returns DAE_OK if successfully loaded, otherwise returns a negative value defined in daeError.h.
* @see @c daeInterface::load().
*/
virtual daeInt read(daeURI& uri, daeString docBuffer) = 0;
virtual DLLSPEC daeInt read(daeURI& uri, daeString docBuffer) = 0;
/** @name Operations */
//@{
@@ -81,7 +81,7 @@ public:
* @return Returns DAE_OK if success, a negative value defined in daeError.h otherwise.
* @see @c daeInterface::saveAS()
*/
virtual daeInt write(daeURI *name, daeDocument *document, daeBool replace) = 0;
virtual DLLSPEC daeInt write(daeURI *name, daeDocument *document, daeBool replace) = 0;
//@}
/** @name Load/Save Progress */
@@ -102,7 +102,7 @@ public:
* the <tt><i> bytesParsed </i></tt> and <tt><i> lineNumber </i></tt> counters. The system resets the counter at the beginning of
* each file.
*/
virtual void getProgress(daeInt* bytesParsed,
virtual DLLSPEC void getProgress(daeInt* bytesParsed,
daeInt* lineNumber,
daeInt* totalBytes,
daeBool reset = false ) = 0;

View File

@@ -28,11 +28,11 @@ public:
/**
* Constructor.
*/
daeIntegrationObject() { _element = NULL; _object = NULL; _from_state = int_uninitialized; _to_state = int_uninitialized; }
DLLSPEC daeIntegrationObject() { _element = NULL; _object = NULL; _from_state = int_uninitialized; _to_state = int_uninitialized; }
/**
* Destructor.
*/
virtual ~daeIntegrationObject() {}
virtual DLLSPEC ~daeIntegrationObject() {}
public:
/** A pointer to the element associated with this integration object. */
@@ -74,31 +74,31 @@ protected:
* for this integration template. This method sets up the integration object for the DOM class.
* @param element A daeSmartRef to the element to convert into the user's structure.
*/
virtual void createFrom(daeElementRef element) = 0;
virtual DLLSPEC void createFrom(daeElementRef element) = 0;
/**
* Defines the code to convert the COLLADA Object Model data structure into your application-specific
* data structure.
*/
virtual void fromCOLLADA() = 0;
virtual DLLSPEC void fromCOLLADA() = 0;
/**
* Defines any postprocessing code that must execute after the basic conversion.
*/
virtual void fromCOLLADAPostProcess() = 0;
virtual DLLSPEC void fromCOLLADAPostProcess() = 0;
/**
* Defines code to create the COLLADA Object Model data structure associated with the DOM class for
* this template.
* @param userData A pointer to the application-specific data structure to convert to the DOM structure.
*/
virtual void createTo(void *userData) = 0;
virtual DLLSPEC void createTo(void *userData) = 0;
/**
* Defines the code to convert your application's data structures back into COLLADA Object Model data
* structures.
*/
virtual void toCOLLADA() = 0;
virtual DLLSPEC void toCOLLADA() = 0;
/**
* Defines any postprocessing code that must execute after the basic conversion.
*/
virtual void toCOLLADAPostProcess() = 0;
virtual DLLSPEC void toCOLLADAPostProcess() = 0;
public:
/**

View File

@@ -38,7 +38,7 @@ public:
/**
* Destructor.
*/
virtual ~daeInterface() {}
virtual DLLSPEC ~daeInterface() {}
/** @name Database setup
* management of the database that stores the COLLADA elements.
@@ -48,14 +48,14 @@ public:
* Gets the COLLADA runtime database currently being used.
* @return Returns the database currently being used.
*/
virtual daeDatabase* getDatabase() = 0;
virtual DLLSPEC daeDatabase* getDatabase() = 0;
/**
* Sets the COLLADA runtime database to use.
* @param database Database that stores the COLLADA data,
* if set to NULL a default database is set.
* @return Returns @c DAE_OK if success, otherwise, returns a negative error value as defined in daeError.h.
*/
virtual daeInt setDatabase(daeDatabase* database) = 0;
virtual DLLSPEC daeInt setDatabase(daeDatabase* database) = 0;
//@}
/** @name IOPlugin setup
@@ -67,7 +67,7 @@ public:
* Gets the @c daeIOPlugin currently set.
* @return Returns the @c daeIOPlugin currently set on the interface.
*/
virtual daeIOPlugin* getIOPlugin() = 0;
virtual DLLSPEC daeIOPlugin* getIOPlugin() = 0;
/**
* Sets the plugin which will be the interface between the COLLADA runtime database
* and the rest of the system.
@@ -76,7 +76,7 @@ public:
* @param plugin Plugin to use, if set to NULL a default plugin is set.
* @return Returns @c DAE_OK if success, otherwise, returns a negative error value as defined in daeError.h.
*/
virtual daeInt setIOPlugin(daeIOPlugin* plugin) = 0;
virtual DLLSPEC daeInt setIOPlugin(daeIOPlugin* plugin) = 0;
//@}
/** @name Integration Library Setup
@@ -91,13 +91,13 @@ public:
* Gets the integration library register function currently being used.
* @return Returns the integration library register function currently being used.
*/
virtual daeIntegrationLibraryFunc getIntegrationLibrary() = 0;
virtual DLLSPEC daeIntegrationLibraryFunc getIntegrationLibrary() = 0;
/**
* Sets the integration library register function.
* @param regFunc Integration library register function to use.
* @return Returns DAE_OK if success, a negative value defined in daeError.h otherwise.
*/
virtual daeInt setIntegrationLibrary(daeIntegrationLibraryFunc regFunc)=0;
virtual DLLSPEC daeInt setIntegrationLibrary(daeIntegrationLibraryFunc regFunc)=0;
//@}
/** @name Batch import/export operations
@@ -114,7 +114,7 @@ public:
* and should only be used if the document has already been loaded into memory.
* @return Returns DAE_OK if success, a negative value defined in daeError.h otherwise.
*/
virtual daeInt load(daeString name, daeString docBuffer = NULL) = 0;
virtual DLLSPEC daeInt load(daeString name, daeString docBuffer = NULL) = 0;
/**
* Saves a single document/document back to the location it was loaded from.
* @param documentName the name of the loaded document to be saved, in most cases this will be an rfc 2396 compliant
@@ -123,7 +123,7 @@ public:
* error.
* @return Returns DAE_OK if success, a negative value defined in daeError.h otherwise.
*/
virtual daeInt save(daeString documentName, daeBool replace=true) = 0;
virtual DLLSPEC daeInt save(daeString documentName, daeBool replace=true) = 0;
/**
* Saves a single document/document back to the location it was loaded from.
* @param documentIndex the index of a loaded document to be saved.
@@ -131,7 +131,7 @@ public:
* error.
* @return Returns DAE_OK if success, a negative value defined in daeError.h otherwise.
*/
virtual daeInt save(daeUInt documentIndex=0, daeBool replace=true) = 0;
virtual DLLSPEC daeInt save(daeUInt documentIndex=0, daeBool replace=true) = 0;
/**
* Saves a single document/document from the runtime database by name.
* @param name the name to save the document to. The format for this is defined by the IO plugin
@@ -144,7 +144,7 @@ public:
* error.
* @return Returns DAE_OK if success, a negative value defined in daeError.h otherwise.
*/
virtual daeInt saveAs(daeString name, daeString documentName, daeBool replace=true) = 0;
virtual DLLSPEC daeInt saveAs(daeString name, daeString documentName, daeBool replace=true) = 0;
/**
* Saves a single document/document from the runtime database by index.
* @param name the name to save the document to. The format for this is defined by the IO plugin
@@ -157,21 +157,21 @@ public:
* error.
* @return Returns DAE_OK if success, a negative value defined in daeError.h otherwise.
*/
virtual daeInt saveAs(daeString name, daeUInt documentIndex=0, daeBool replace=true) = 0;
virtual DLLSPEC daeInt saveAs(daeString name, daeUInt documentIndex=0, daeBool replace=true) = 0;
/**
* Unloads a specific document from the runtime database.
* @param name Name of the document to remove.
* @return Returns DAE_OK if unloaded successfully, otherwise returns a negative value as defined in daeError.h.
* @note This function is not currently implemented.
*/
virtual daeInt unload(daeString name) = 0;
virtual DLLSPEC daeInt unload(daeString name) = 0;
/**
* Unloads all the documents of the runtime database.
* This function frees all the @c dom* objects and integration objects created so far,
* except the object on which the user still has a smart pointer reference.
* @return Returns DAE_OK if all documents unloaded successfully, otherwise returns a negative value as defined in daeError.h.
*/
virtual daeInt clear() = 0;
virtual DLLSPEC daeInt clear() = 0;
//@}
/** @name Import/export progress
@@ -193,7 +193,7 @@ public:
* the <tt><i> bytesParsed </i></tt> and <tt><i> lineNumber </i></tt> counters. The system resets the counter at the beginning of
* each file.
*/
virtual void getProgress(daeInt* bytesParsed,
virtual DLLSPEC void getProgress(daeInt* bytesParsed,
daeInt* lineNumber,
daeInt* totalBytes,
daeBool reset = false )=0;
@@ -207,12 +207,12 @@ public:
* @param name Document name, for the file @c daeIOPlugin, this will be the filename for a file.
* @return Returns the @c domCOLLADA root object of the document, or NULL if the document is not found.
*/
virtual domCOLLADA* getDom(daeString name) = 0;
virtual DLLSPEC domCOLLADA* getDom(daeString name) = 0;
/**
* Gets the COLLADA schema version that was used to build the DOM classes
* @return a text string with the version number in it (ie: 1.3.1)
*/
virtual daeString getDomVersion() = 0;
virtual DLLSPEC daeString getDomVersion() = 0;
/**
* Sets or inserts a COLLADA tree into the database.
* The system creates a default database if none is set and then creates a document
@@ -223,7 +223,7 @@ public:
* @param dom Root tree.
* @return Returns DAE_OK if success, otherwise returns a negative value as defined in daeError.h.
*/
virtual daeInt setDom(daeString name, domCOLLADA* dom) = 0;
virtual DLLSPEC daeInt setDom(daeString name, domCOLLADA* dom) = 0;
//@}
};

View File

@@ -31,14 +31,14 @@ public:
* @param n Number of bytes to allocate.
* @return Returns the memory allocated if successful, or NULL if not.
*/
static daeRawRef malloc(daeString pool, size_t n);
static DLLSPEC daeRawRef malloc(daeString pool, size_t n);
/**
* Provides a wrapper free with pool argument.
* @param pool Pool the memory should be freed from.
* @param mem Memory to be freed.
*/
static void free(daeString pool, daeRawRef mem);
static DLLSPEC void free(daeString pool, daeRawRef mem);
};
// Shorthand for defining new and delete overrides for classes, bad use of macros!

View File

@@ -213,7 +213,7 @@ public:
* @param e Element from which to apply this attributes offset.
* @return Returns the storage associate with this attribute in <tt><i>e.</i></tt>
*/
daeChar* getWritableMemory(daeElement* e) {
inline daeChar* getWritableMemory(daeElement* e) {
return (daeChar*)e+_offset; }
};
@@ -262,6 +262,14 @@ public:
* @return Returns true if this attribute is an array type.
*/
virtual daeBool isArrayAttribute() { return true; }
/**
* Resolves a reference (if there is one) in the attribute type;
* only useful for reference types.
* @param elem Containing element on which this attribute
* should be resolved.
*/
virtual void resolve(daeElementRef elem);
};

View File

@@ -98,7 +98,9 @@ protected:
/**
* Destructor.
*/
public: // sthomas
virtual ~daeMetaCMPolicy();
protected: // sthomas
daeMetaElement * _container;
daeMetaCMPolicy * _parent;

View File

@@ -69,7 +69,8 @@ protected:
daeBool _allowsAny;
daeBool _innerClass;
static daeTArray<daeSmartRef<daeMetaElement> > _metas;
static daeTArray<daeSmartRef<daeMetaElement> > &_metas();
static daeTArray< daeMetaElement** > &_classMetaPointers();
daeMetaCMPolicy * _contentModel;
@@ -77,12 +78,12 @@ public:
/**
* Constructor
*/
daeMetaElement();
DLLSPEC daeMetaElement();
/**
* Destructor
*/
~daeMetaElement();
DLLSPEC ~daeMetaElement();
public: // public accessors
@@ -220,7 +221,7 @@ public: // public accessors
* @param s String containing the desired attribute's name.
* @return Returns the corresponding @c daeMetaAttribute, or NULL if none found.
*/
daeMetaAttribute* getMetaAttribute(daeString s);
DLLSPEC daeMetaAttribute* getMetaAttribute(daeString s);
/**
* Sets the size in bytes of each instance of this element type.
@@ -243,14 +244,14 @@ public:
* should only be called by the system as it sets up the Reflective Object System.
* @param offset Byte offset for the contents field in the C++ element class.
*/
void addContents(daeInt offset);
DLLSPEC void addContents(daeInt offset);
/**
* Registers with the reflective object system the array that stores the _contents ordering. This method is @em
* only for @c daeMetaElement contstuction, and should only be called by the system as it sets up the Reflective
* Object System.
* @param offset Byte offset for the contents order array in the C++ element class.
*/
void addContentsOrder( daeInt offset );
DLLSPEC void addContentsOrder( daeInt offset );
/**
* Gets the attribute associated with the contents meta information.
@@ -265,17 +266,18 @@ public:
* @param attr Attribute to append to this element types list
* of potential attributes.
*/
void appendAttribute(daeMetaAttribute* attr);
DLLSPEC void appendAttribute(daeMetaAttribute* attr);
/**
* Registers the function that can construct a C++ instance
* of this class. Necessary for the factory system such that C++
* Registers the function that can construct a C++ instance of this class and the
* pointer to the classes static meta. Necessary for the factory system such that C++
* can still call @c new and the @c vptr will still be initialized even when
* constructed via the factory system.
* @param func Pointer to a function that does object construction.
* @param metaPtr Pointer to the class static meta pointer.
*/
void registerConstructor(daeElementConstructFunctionPtr func) {
_createFunc = func; }
void registerClass(daeElementConstructFunctionPtr func, daeMetaElement** metaPtr = NULL ) {
_createFunc = func; if ( metaPtr != NULL ) _classMetaPointers().append( metaPtr ); }
/**
* Determines if this element contains attributes
@@ -289,7 +291,7 @@ public:
* Validates this class to be used by the runtime c++ object model
* including factory creation.
*/
void validate();
DLLSPEC void validate();
/**
* Places a child element into the <tt><i>parent</i></tt> element where the
@@ -298,7 +300,7 @@ public:
* @param child Child element to place in the parent.
* @return Returns true if the operation was successful, false otherwise.
*/
daeBool place(daeElement *parent, daeElement *child, daeUInt *ordinal = NULL);
DLLSPEC daeBool place(daeElement *parent, daeElement *child, daeUInt *ordinal = NULL);
/**
* Places a child element into the <tt><i>parent</i></tt> element at a specific location
* where the calling object is the @c daeMetaElement for the parent element.
@@ -309,7 +311,7 @@ public:
* @note This should only be called on elements that have a _contents array. Elements without
* a _contents array will be placed normally.
*/
daeBool placeAt( daeInt index, daeElement *parent, daeElement *child );
DLLSPEC daeBool placeAt( daeInt index, daeElement *parent, daeElement *child );
/**
* Places a child element into the <tt><i>parent</i></tt> element at a specific location which is right
* before the marker element.
@@ -318,7 +320,7 @@ public:
* @param child Child element to place in the parent.
* @return Returns true if the operation was successful, false otherwise.
*/
daeBool placeBefore( daeElement* marker, daeElement *parent, daeElement *child, daeUInt *ordinal = NULL );
DLLSPEC daeBool placeBefore( daeElement* marker, daeElement *parent, daeElement *child, daeUInt *ordinal = NULL );
/**
* Places a child element into the <tt><i>parent</i></tt> element at a specific location which is right
* after the marker element.
@@ -327,7 +329,7 @@ public:
* @param child Child element to place in the parent.
* @return Returns true if the operation was successful, false otherwise.
*/
daeBool placeAfter( daeElement* marker, daeElement *parent, daeElement *child, daeUInt *ordinal = NULL );
DLLSPEC daeBool placeAfter( daeElement* marker, daeElement *parent, daeElement *child, daeUInt *ordinal = NULL );
/**
* Removes a child element from its parent element.
@@ -335,13 +337,13 @@ public:
* @param child Child element to remove.
* @return Returns true if the operation was successful, false otherwise.
*/
daeBool remove( daeElement *parent, daeElement *child );
DLLSPEC daeBool remove( daeElement *parent, daeElement *child );
/**
* Gets all of the children from an element of this type.
* @param parent The element that you want to get the children from.
* @param array The return value. An elementref array to append this element's children to.
*/
void getChildren( daeElement* parent, daeElementRefArray &array );
DLLSPEC void getChildren( daeElement* parent, daeElementRefArray &array );
/**
* Invokes the factory element creation routine set by @c registerConstructor()
@@ -349,7 +351,7 @@ public:
* @return Returns a created @c daeElement of appropriate type via the
* object creation function and the <tt> daeElement::setup() </tt> function.
*/
daeElementRef create();
DLLSPEC daeElementRef create();
/**
* Looks through the list of potential child elements
@@ -359,7 +361,7 @@ public:
* @param childElementTypeName Type name to create.
* @return Returns the created element if the type was found as a potential child element.
*/
daeElementRef create(daeString childElementTypeName);
DLLSPEC daeElementRef create(daeString childElementTypeName);
/**
* Gets the root of the content model policy tree.
@@ -370,16 +372,16 @@ public:
* Sets the root of the content model policy tree.
* @param cm The root element of the tree of content model policy elements.
*/
void setCMRoot( daeMetaCMPolicy *cm ) { _contentModel = cm; }
DLLSPEC void setCMRoot( daeMetaCMPolicy *cm );
public:
/**
* Releases all of the meta information contained in @c daeMetaElements.
*/
static void releaseMetas();
static DLLSPEC void releaseMetas();
static const daeTArray<daeSmartRef<daeMetaElement> > &getAllMetas() { return _metas; }
static const daeTArray<daeSmartRef<daeMetaElement> > &getAllMetas() { return _metas(); }
};
typedef daeSmartRef<daeMetaElement> daeMetaElementRef;

View File

@@ -35,7 +35,7 @@ public:
/**
* An enum describing the status of the SID resolution process.
*/
enum ResolveState{
DLLSPEC enum ResolveState{
/** No target specified */
target_empty,
/** target specified but not resolved */
@@ -56,12 +56,12 @@ public:
* @param target The target string which needs to be resolved.
* @param platform The platform name of the technique to use. A NULL value indicates the common platform.
*/
daeSIDResolver( daeElement *container, daeString target, daeString platform = NULL );
DLLSPEC daeSIDResolver( daeElement *container, daeString target, daeString platform = NULL );
/**
* Destructor.
*/
~daeSIDResolver();
DLLSPEC ~daeSIDResolver();
/**
* Gets the target string.
@@ -72,7 +72,7 @@ public:
* Sets the target string.
* @param t The new target string for this resolver.
*/
void setTarget( daeString t );
DLLSPEC void setTarget( daeString t );
/**
* Gets the name of the profile to use when resolving.
@@ -83,7 +83,7 @@ public:
* Sets the profile to use when resolving.
* @param p The profile name of the technique to use. A NULL value indicates the common profile.
*/
void setProfile( daeString p );
DLLSPEC void setProfile( daeString p );
/**
* Gets a pointer to the @c daeElement that contains the target to resolve.
@@ -94,7 +94,7 @@ public:
* Sets the pointer to the @c daeElement that contains the target to resolve.
* @param element Pointer to the containing @c daeElmement.
*/
void setContainer(daeElement* element);
DLLSPEC void setContainer(daeElement* element);
/**
* Gets the resolution state.
@@ -106,14 +106,14 @@ public:
* Gets the element that this SID resolves to.
* @return Returns the element that the URI resolves to.
*/
daeElementRef getElement();
DLLSPEC daeElementRef getElement();
/**
* Gets the value array of the element that the SID resolves to.
* @return Returns a pointer to the value array that the SID resolves to
* @note The daeSIDResolver can only resolve to this level for daeDoubleArray values.
*/
daeDoubleArray *getDoubleArray();
DLLSPEC daeDoubleArray *getDoubleArray();
/**
* Gets a pointer to the particle this target resolved to.
@@ -122,7 +122,7 @@ public:
* final symbolic name is from the COMMON profile or a cardinal value is specified.
* @note The daeSIDResolver assumes the value is a 4x4 matrix if there are 2 cardinal values specified.
*/
daeDouble *getDouble();
DLLSPEC daeDouble *getDouble();
private:

View File

@@ -29,7 +29,7 @@ public:
DAE_ALLOC;
private:
daeString _string;
static daeStringTable _stringTable;
static daeStringTable &_stringTable();
public:
/**
@@ -53,7 +53,7 @@ public:
* Constructor that creates from a <tt>const char *.</tt>
* @param string External string to create from.
*/
daeStringRef(daeString string);
DLLSPEC daeStringRef(daeString string);
/**
* Assignment operator.
@@ -70,14 +70,14 @@ public:
* @param string The daeString to copy.
* @return A reference to this object.
*/
const daeStringRef& set(daeString string);
DLLSPEC const daeStringRef& set(daeString string);
/**
* Assignment operator from an external <tt>const char *.</tt>
* @param string The daeString to copy.
* @return A reference to this object.
*/
const daeStringRef& operator= (daeString string);
DLLSPEC const daeStringRef& operator= (daeString string);
/**
* Cast operator that returns a <tt>const char *.</tt>
@@ -93,6 +93,13 @@ public:
inline bool operator==(const daeStringRef& other) const{
//return (other._string == _string); }
return (!strcmp(other._string, _string)); }
//Contributed by Nus - Wed, 08 Nov 2006
/**
* Release string table...
*/
static void releaseStringTable(void);
//--------------------
};
typedef daeTArray<daeStringRef> daeStringRefArray;

View File

@@ -31,7 +31,7 @@ public: // allocate/construct/destruct/deallocate
* Constructor which specifies fixed buffer size.
* @param stringBufferSize The size of the buffer to create for string allocation.
*/
daeStringTable(int stringBufferSize = 1024*1024);
DLLSPEC daeStringTable(int stringBufferSize = 1024*1024);
/**
* Destructor.
@@ -44,12 +44,12 @@ public: // INTERFACE
* @param string <tt> const char * </tt> to copy into the table.
* @return Returns an allocated string.
*/
daeString allocString(daeString string);
DLLSPEC daeString allocString(daeString string);
/**
* Clears the storage.
*/
void clear();
DLLSPEC void clear();
private: // MEMBERS
size_t _stringBufferSize;

View File

@@ -16,6 +16,8 @@
#ifdef WIN32
#include <dae/daeWin32Platform.h>
#elif defined( __GCC__ )
#include <dae/daeGCCPlatform.h>
#else
#include <dae/daeGenericPlatform.h>
#endif

View File

@@ -17,6 +17,18 @@
#include <dae/daeTypes.h>
#include <dae/daeElement.h>
//Contributed by Nus - Wed, 08 Nov 2006
/**
* Initializing URI.
*/
extern "C" void initializeURI(void);
/**
* Terminating URI.
*/
extern "C" void terminateURI(void);
//-------------------------
/**
* The @c daeURI is a simple class designed to aid in the parsing and resolution
* of URI references inside COLLADA elements.
@@ -69,7 +81,7 @@ public:
/**
* An enum describing the status of the URI resolution process.
*/
enum ResolveState{
DLLSPEC enum ResolveState{
/** No URI specified */
uri_empty,
/** URI specified but unresolved */
@@ -135,11 +147,11 @@ public:
/**
* Constructs a daeURI object that contains no URI reference.
*/
daeURI();
DLLSPEC daeURI();
/**
* Destructor
*/
~daeURI();
DLLSPEC ~daeURI();
/**
* Constructs a daeURI object that points to the application's current working
@@ -149,14 +161,14 @@ public:
* workaround to insure that the ApplicationURI is initialized only once and before the user can call
* daeURI::setBaseURI() (so when we initialize ApplicationURI there is no chance of wiping out a user value).
*/
daeURI(int dummy);
DLLSPEC daeURI(int dummy);
/**
* Constructs a daeURI object from a URI passed in as a string.
* @param URIString Passed to setURI() automatically.
* @param nofrag If true, the fragment part of the URI is stripped off before construction.
*/
daeURI(daeString URIString, daeBool nofrag = false);
DLLSPEC daeURI(daeString URIString, daeBool nofrag = false);
/**
* Constructs a daeURI object using a <tt><i>baseURI</i></tt> and a <tt><i>uriString.</i></tt>
@@ -164,13 +176,13 @@ public:
* @param baseURI Base URI to resolve against.
* @param URIString String designating this URI.
*/
daeURI(daeURI& baseURI, daeString URIString);
DLLSPEC daeURI(daeURI& baseURI, daeString URIString);
/**
* Constructs a daeURI object based on a simple copy from an existing @c daeURI.
* @param constructFromURI URI to copy into this one.
*/
daeURI(daeURI& constructFromURI);
DLLSPEC daeURI(daeURI& constructFromURI);
/**
* Gets the ID string parsed from the URI.
@@ -258,19 +270,19 @@ public:
* After @c setURI(), the <tt><i>state</i></tt> is set to @c uri_loaded.
* @param uri String to use to configure this URI.
*/
void setURI(daeString uri);
DLLSPEC void setURI(daeString uri);
/**
* Gets the URI stored in the daeURI.
* @return Returns the full URI String, from <tt><i>uriString.</i></tt>
*/
daeString getURI() const;
DLLSPEC daeString getURI() const;
/**
* Gets the original URI String as originally set, not flattened against the base URI.
* @return Returns the original URI String as originally set, not flattened against the base URI.
*/
daeString getOriginalURI() const;
DLLSPEC daeString getOriginalURI() const;
/**
* Gets if this URI resolves to an element that is not contained in the same document as the URI.
@@ -284,14 +296,14 @@ public:
* This function can effectively force a load of a file, perform
* a database query, and so on, based on the @c daeURIResolver plugins implemented.
*/
void resolveElement(daeString typeNameHint = NULL);
DLLSPEC void resolveElement(daeString typeNameHint = NULL);
/**
* Configures the <tt><i>uriString</i></tt> for this @c daeURI based on the element set in <tt><i>element.</i></tt>
* Uses the element's base URI and ID information to configure
* the URI string.
*/
void resolveURI();
DLLSPEC void resolveURI();
/**
* Flattens this URI with base URI to obtain a useable
@@ -301,27 +313,27 @@ public:
* @note After @c validate(), state is @c uri_pending as it is awaiting a call to
* @c resolveElement().
*/
void validate(daeURI* baseURI = NULL);
DLLSPEC void validate(daeURI* baseURI = NULL);
/**
* Copies the URI specified in <tt><i>from</i></tt> into @c this.
* Performs a simple copy without validating the URI.
* @param from URI to copy from.
*/
void copyFrom(daeURI& from);
DLLSPEC void copyFrom(daeURI& from);
/**
* Outputs all components of this URI to stderr.
* Useful for debugging URIs, this outputs each part of the URI separately.
*/
void print();
DLLSPEC void print();
/**
* Makes the "originalURI" in this URI relative to some other uri
* @param uri the URI to make "this" relative to.
* @note this is experimental and not fully tested, please don't use in critical code yet.
*/
int makeRelativeTo(daeURI* uri);
DLLSPEC int makeRelativeTo(daeURI* uri);
/**
* Comparison operator.
@@ -330,6 +342,13 @@ public:
inline bool operator==(const daeURI& other) const{
return (!strcmp(other.getURI(), getURI())); }
daeURI &operator=( const daeURI& other) {
setURI(other.getOriginalURI());
element = other.element;
state = other.state;
return *this;
}
private:
/**
* Resets this URI; frees all string references
@@ -349,7 +368,7 @@ public:
* @param size The size of the buffer.
* @return Returns true for success, false if the path exceeded the size of the user provided buffer.
*/
daeBool getPath(daeChar *dest, daeInt size);
DLLSPEC daeBool getPath(daeChar *dest, daeInt size);
public:
/**
@@ -357,19 +376,19 @@ public:
* authority, and path in the case of top-level relative URIs.
* @param uri Base URI to use as the default application URI.
*/
static void setBaseURI(daeURI& uri);
static DLLSPEC void setBaseURI(daeURI& uri);
/**
* Gets the application's default base URI.
* @return Returns the base URI used in the case of top-level relative URIs.
*/
static daeURI* getBaseURI();
static DLLSPEC daeURI* getBaseURI();
/**
* Performs RFC2396 path normalization.
* @param path Path to be normalized.
*/
static void normalizeURIPath(char *path);
static DLLSPEC void normalizeURIPath(char *path);
};
@@ -393,15 +412,15 @@ public:
/**
* This base constructor appends @c this to KnownResolvers list.
*/
daeURIResolver();
DLLSPEC daeURIResolver();
/**
* Destructor
*/
virtual ~daeURIResolver();
virtual DLLSPEC ~daeURIResolver();
protected:
static daeURIResolverPtrArray _KnownResolvers;
static daeURIResolverPtrArray &_KnownResolvers();
static daeBool _loadExternalDocuments;
@@ -412,7 +431,7 @@ public:
* @c resolveElement().
* @param uri @c daeURI to resolve.
*/
static void attemptResolveElement(daeURI &uri, daeString typeNameHint = NULL);
static DLLSPEC void attemptResolveElement(daeURI &uri, daeString typeNameHint = NULL);
/**
* Iterates through known resolvers
@@ -420,7 +439,7 @@ public:
* @c resolveURI().
* @param uri @c daeURI to resolve.
*/
static void attemptResolveURI(daeURI &uri);
static DLLSPEC void attemptResolveURI(daeURI &uri);
/**
* Sets a flag that tells the URI resolver whether or not to load a separate document if a URI
@@ -428,7 +447,7 @@ public:
* @param load Set to true if you want the URI Resolver to automatically load other documents to
* resolve URIs.
*/
static void setAutoLoadExternalDocuments( daeBool load ) { _loadExternalDocuments = load; }
static DLLSPEC void setAutoLoadExternalDocuments( daeBool load );
/**
* Gets a flag that tells if the URI resolver is set to load an external document if a URI
@@ -436,7 +455,7 @@ public:
* @return Returns true if the resolver will automatically load documents to resolve a URI.
* False otherwise.
*/
static daeBool getAutoLoadExternalDocuments() { return _loadExternalDocuments; }
static DLLSPEC daeBool getAutoLoadExternalDocuments();
public: // Abstract Interface
/**
@@ -445,20 +464,20 @@ public: // Abstract Interface
* @return Returns true if the @c daeURIResolver successfully resolved the URI,
* returns false otherwise.
*/
virtual daeBool resolveElement(daeURI& uri, daeString typeNameHint = NULL) = 0;
virtual DLLSPEC daeBool resolveElement(daeURI& uri, daeString typeNameHint = NULL) = 0;
/**
* Provides an abstract interface for converting a @c daeElement into a @c daeURI
* @param uri @c daeURI to resolve.
* @return Returns true if the @c daeURIResolver successfully resolved the element
* into a URI, returns false otherwise.
*/
virtual daeBool resolveURI(daeURI& uri) = 0;
virtual DLLSPEC daeBool resolveURI(daeURI& uri) = 0;
/**
* Gets the name of this resolver.
* @return Returns the resolver name as a string.
*/
virtual daeString getName() = 0;
virtual DLLSPEC daeString getName() = 0;
/**
* Determines whether this resolver supports a particular protocol
@@ -467,7 +486,7 @@ public: // Abstract Interface
* @return Returns true if this @c daeURIResolver understands how to resolve using this protocol, returns
* false otherwise
*/
virtual daeBool isProtocolSupported(daeString protocol) = 0;
virtual DLLSPEC daeBool isProtocolSupported(daeString protocol) = 0;
/**
* Determines whether this resolver supports the given extension.
@@ -476,7 +495,7 @@ public: // Abstract Interface
* @param extension Extension string found after the '.' in the file name.
* @return Returns true if the given extension is supported, returns false otherwise.
*/
virtual daeBool isExtensionSupported(daeString extension) = 0;
virtual DLLSPEC daeBool isExtensionSupported(daeString extension) = 0;
};

View File

@@ -14,14 +14,14 @@
#ifndef __DAE_WIN32_PLATFORM_H__
#define __DAE_WIN32_PLATFORM_H__
#define PLATFORM_INT8 char
#define PLATFORM_INT16 short
#define PLATFORM_INT32 int
#define PLATFORM_INT64 long
#define PLATFORM_UINT8 unsigned char
#define PLATFORM_UINT16 unsigned short
#define PLATFORM_UINT32 unsigned int
#define PLATFORM_UINT64 unsigned long
#define PLATFORM_INT8 __int8
#define PLATFORM_INT16 __int16
#define PLATFORM_INT32 __int32
#define PLATFORM_INT64 __int64
#define PLATFORM_UINT8 unsigned __int8
#define PLATFORM_UINT16 unsigned __int16
#define PLATFORM_UINT32 unsigned __int32
#define PLATFORM_UINT64 unsigned __int64
#define PLATFORM_FLOAT32 float
#define PLATFORM_FLOAT64 double
@@ -29,4 +29,16 @@
typedef int intptr_t;
#endif
#ifdef DOM_DYNAMIC
#ifdef DOM_EXPORT
#define DLLSPEC __declspec( dllexport )
#else
#define DLLSPEC __declspec( dllimport )
#endif
#else
#define DLLSPEC
#endif
#endif

View File

@@ -113,7 +113,7 @@ public: //METHODS
* @param attrValue String-based value to apply to the attribute.
* @return Returns true if the attribute was created and the value was set, false otherwise.
*/
virtual daeBool setAttribute(daeString attrName, daeString attrValue);
virtual DLLSPEC daeBool setAttribute(daeString attrName, daeString attrValue);
public: // STATIC METHODS
/**
@@ -121,14 +121,14 @@ public: // STATIC METHODS
* @param bytes The size allocated for this instance.
* @return a daeElementRef referencing an instance of this object.
*/
static daeElementRef create(daeInt bytes);
static DLLSPEC daeElementRef create(daeInt bytes);
/**
* Creates a daeMetaElement object that describes this element in the meta object reflection framework.
* @return A daeMetaElement describing this COLLADA element.
* @remarks Unlike other dom* elements, domAny will always create a new daeMetaElement when this
* function is called.
*/
static daeMetaElement* registerElement();
static DLLSPEC daeMetaElement* registerElement();
};