/usr/include/opencollada/COLLADASaxFrameworkLoader/COLLADASaxFWLIFilePartLoader.h is in opencollada-dev 0.1.0~20140703.ddf8f47+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | /*
Copyright (c) 2008-2009 NetAllied Systems GmbH
This file is part of COLLADASaxFrameworkLoader.
Licensed under the MIT Open Source License,
for details please see LICENSE file or the website
http://www.opensource.org/licenses/mit-license.php
*/
#ifndef __COLLADASAXFWL_IFILEPARTLOADER_H__
#define __COLLADASAXFWL_IFILEPARTLOADER_H__
#include "COLLADASaxFWLPrerequisites.h"
#include "COLLADASaxFWLTypes.h"
#include "COLLADASaxFWLSaxFWLError.h"
#include "COLLADASaxFWLXmlTypes.h"
#include "COLLADASaxFWLLoader.h"
#include "COLLADASaxFWLExtraDataLoader.h"
#include "COLLADAFWUniqueId.h"
#include "COLLADAFWInstanceController.h"
#include <list>
#include <map>
namespace COLLADASaxFWL14
{
class ColladaParserAutoGen14;
class ColladaParserAutoGen14Private;
}
namespace COLLADASaxFWL15
{
class ColladaParserAutoGen15;
class ColladaParserAutoGen15Private;
}
namespace COLLADAFW
{
class IWriter;
class Object;
class Animatable;
class AnimationList;
class MorphController;
}
namespace COLLADABU
{
class URI;
}
namespace COLLADASaxFWL
{
// class Loader;
class FileLoader;
class GeometryMaterialIdInfo;
class SidTreeNode;
class SidAddress;
class RootParser14;
class RootParser15;
class IParserImpl;
class IntermediateTargetable;
/** Base class for all loaders that load parts of files or entire files */
class IFilePartLoader : public ExtraDataLoader
{
public:
friend class RootParser14;
friend class RootParser15;
private:
/** The currently working file part loader.*/
IFilePartLoader* mPartLoader;
/** Object derived from a generated parser. */
IParserImpl* mParserImpl;
public:
/** Constructor. */
IFilePartLoader();
/** Destructor. */
virtual ~IFilePartLoader();
/** Returns a pointer to the collada loader. */
virtual Loader* getColladaLoader() =0;
/** Returns a const pointer to the collada document. */
virtual const Loader* getColladaLoader()const =0;
/** Returns the writer the data will be written to.*/
COLLADAFW::IWriter* writer();
/** Reports an error to the error handler. If this method returns true, the
loader stops parsing immediately. If severity is not CRITICAL and this method
returns true, the loader continues loading. */
bool handleFWLError( const SaxFWLError& saxFWLError );
/** Reports an error to the error handler. If this method returns true, the
loader stops parsing immediately. If severity is not CRITICAL and this method
returns true, the loader continues loading.
@param errorType The type of the error.
@param errorMessage The error message describing the error.
@param reportLineAndColumnNumber If true, the current line and number of the xml parser are set.
@param severity The severity of the error. */
bool handleFWLError( SaxFWLError::ErrorType errorType,
String errorMessage,
IError::Severity severity = IError::SEVERITY_ERROR_NONCRITICAL );
/** Returns the COLLADAFW::UniqueId of the element with uri @a uriString. If the uri has been
passed to this method before, the same COLLADAFW::UniqueId will be returned, if not, a
new one is created.
@param uriString The uriString of the element to get the COLLADAFW::UniqueId for
@param classId The COLLADAFW::ClassId of the object that will be created for @a element.
@return The elements COLLADAFW::UniqueId */
const COLLADAFW::UniqueId& createUniqueId(const String& uriString, COLLADAFW::ClassId classId);
/** Returns the COLLADAFW::UniqueId of the element with uri @a uri. If the uri has been
passed to this method before, the same COLLADAFW::UniqueId will be returned, if not, an
invalid unique id will be returned.
@param uriString The uriString of the element to get the COLLADAFW::UniqueId for
@return The elements COLLADAFW::UniqueId or COLLADAFW::UniqueId::INVALID*/
const COLLADAFW::UniqueId& getUniqueIdByUrl(const String& uriString);
/** Returns the COLLADAFW::UniqueId of the element with id @a colladaId in the current file.
If the id within this file has been passed to this method before, the same COLLADAFW::UniqueId
will be returned, if not, a new one is created.
@param id The collada id of the element to get the COLLADAFW::UniqueId for
@param classId The COLLADAFW::ClassId of the object that will be created for @a element.
@return The elements COLLADAFW::UniqueId */
COLLADAFW::UniqueId createUniqueIdFromId( const ParserChar* colladaId, COLLADAFW::ClassId classId );
/** Returns the COLLADAFW::UniqueId of the element with id @a colladaId in the current document. If the
colladaId has been passed to this method before while in the same file, the same COLLADAFW::UniqueId will
be returned, if not, an invalid unique id will be returned.
@param id The id of the element to get the COLLADAFW::UniqueId for
@return The elements COLLADAFW::UniqueId or COLLADAFW::UniqueId::INVALID*/
const COLLADAFW::UniqueId& getUniqueIdById(const ParserChar* colladaId);
/** Returns the COLLADAFW::UniqueId of the element referenced by the url @a url. If the has
been passed to this method before, the same COLLADAFW::UniqueId will be returned, if not,
a new one is created.
@param url The url of the element to get the COLLADAFW::UniqueId for
@param classId The COLLADAFW::ClassId of the object that will be created for @a element.
@return The elements COLLADAFW::UniqueId */
const COLLADAFW::UniqueId& createUniqueIdFromUrl( const ParserChar* url, COLLADAFW::ClassId classId );
/** Returns the COLLADAFW::UniqueId of the element referenced by the url @a url. If the has
been passed to this method before, the same COLLADAFW::UniqueId will be returned, if not,
a new one is created.
@param url The url of the element to get the COLLADAFW::UniqueId for
@param classId The COLLADAFW::ClassId of the object that will be created for @a element.
@param isAbsolute If true, the url is assumed to be absolute, otherwise it will be made absolute
using the current file urie.
@return The elements COLLADAFW::UniqueId */
const COLLADAFW::UniqueId& createUniqueIdFromUrl( const COLLADABU::URI& url, COLLADAFW::ClassId classId, bool isAbsolute = false );
/** Returns the COLLADAFW::UniqueId of the element referenced by the url @a url. If the has
been passed to this method before, the same COLLADAFW::UniqueId will be returned, if not, an
invalid unique id will be returned.
@param uriString The uriString of the element to get the COLLADAFW::UniqueId for
@param isAbsolute If true, the url is assumed to be absolute, otherwise it will be made absolute
using the current file uri.
@return The elements COLLADAFW::UniqueId or COLLADAFW::UniqueId::INVALID*/
const COLLADAFW::UniqueId& getUniqueIdByUrl( const COLLADABU::URI& url, bool isAbsolute = false );
/** Returns the COLLADAFW::UniqueId of an element with no uri. At each call a new
COLLADAFW::UniqueId will be created and returned. Use this member for collada elements that
do not have an id.
@param classId The COLLADAFW::ClassId of the object that will be created for @a element.
@return The elements COLLADAFW::UniqueId */
COLLADAFW::UniqueId createUniqueId(COLLADAFW::ClassId classId);
/** Returns the GeometryMaterialIdInfo to map symbols to ids*/
GeometryMaterialIdInfo& getMeshMaterialIdInfo( );
/** Returns TextureMapId for @a semantic. Successive call with same semantic return the same TextureMapId.*/
COLLADAFW::TextureMapId getTextureMapIdBySematic( const String& semantic );
/** Creates a new in the sid tree. Call this method for every collada element that has an sid or that has an id
and can have children with sids. For every call of this method you have to call addToSidTree() when the element
is closed.
@param id The id of the element. Might be 0;
@param sid The sid of the element. Might be 0;
*/
SidTreeNode* addToSidTree( const char* colladaId, const char* colladaSid );
/** Creates a new node in the sid tree. Call this method for every collada element that has an sid or that has an id
and can have children with sids. For every call of this method you have to call moveUpInSidTree() when the element
is closed.
@param id The id of the element. Might be 0;
@param sid The sid of the element. Might be 0;
@param target The target assigned to the sid tree node
*/
SidTreeNode* addToSidTree( const char* colladaId, const char* colladaSid, COLLADAFW::Object* target );
/** Creates a new node in the sid tree. Call this method for every collada element that has an sid or that has an id
and can have children with sids. For every call of this method you have to call moveUpInSidTree() when the element
is closed.
@param id The id of the element. Might be 0;
@param sid The sid of the element. Might be 0;
@param target The target assigned to the sid tree node
*/
SidTreeNode* addToSidTree( const char* colladaId, const char* colladaSid, COLLADAFW::Animatable* target );
/** Creates a new node in the sid tree. Call this method for every collada element that has an sid or that has an id
and can have children with sids. For every call of this method you have to call moveUpInSidTree() when the element
is closed.
@param id The id of the element. Might be 0;
@param sid The sid of the element. Might be 0;
@param target The target assigned to the sid tree node
*/
SidTreeNode* addToSidTree( const char* colladaId, const char* colladaSid, IntermediateTargetable* target );
/** Moves one node up in the sid tree. Call this method whenever an element, for which addToSidTree() was
called, is closed.*/
void moveUpInSidTree();
/** Tries to resolve the a sidaddress. If resolving failed, null is returned.*/
const SidTreeNode* resolveSid( const SidAddress& sidAddress);
/** Stores the bindig of an animation to an object, referenced by @a targetSidAddress.*/
void addToAnimationSidAddressBindings( const AnimationInfo& animationInfo, const SidAddress& targetSidAddress);
/** Returns the animation list with Unique id @a animationListUniqueId. If it could not be found, a new map
entry is created.*/
COLLADAFW::AnimationList*& getAnimationListByUniqueId( const COLLADAFW::UniqueId& animationListUniqueId);
/** Adds the pair @a skinDataUniqueId, @a jointSids to mSkinDataJointSidsMap.*/
void addSkinDataJointSidsPair( const COLLADAFW::UniqueId& skinDataUniqueId, const StringList& sidsOrIds, bool areIds );
/** Adds the pair @a skinDataUniqueId, @a skinSource to mSkinDataSkinSourceMap.*/
void addSkinDataSkinSourcePair( const COLLADAFW::UniqueId& skinDataUniqueId, const COLLADABU::URI& skinSource );
/** Adds @a morphController to the list of morph controllers. The morph controller will be deleted after
if has been written through the IWriter interface.*/
void addMorphController( COLLADAFW::MorphController* morphController);
/** Returns the sids or ids of the nodes used by a skin controller using skin data with unique id
@a skinDataUniqueId*/
const Loader::JointSidsOrIds& getJointSidsOrIdsBySkinDataUniqueId(const COLLADAFW::UniqueId& skinDataUniqueId) const;
/** Returns the mapping of the Unique generated from the id of the COLLADA controller element to the
InstanceControllerDataList containing all instance controllers that reference the same controller.*/
const Loader::InstanceControllerDataListMap& getInstanceControllerDataListMap() const ;
/** Returns the InstanceControllerDataList of the controller with Unique @a controllerUniqueId.*/
const Loader::InstanceControllerDataList& getInstanceControllerDataListByControllerUniqueId(const COLLADAFW::UniqueId& controllerUniqueId)const;
/** Returns the InstanceControllerDataList of the controller with Unique @a controllerUniqueId.*/
Loader::InstanceControllerDataList& getInstanceControllerDataListByControllerUniqueId(const COLLADAFW::UniqueId& controllerUniqueId);
/** After this functions, the next sax callback should be caught by this the file part loader.*/
void setMeAsParser();
/** Sets the parser to @a parserToBeSet.*/
virtual void setParser( COLLADASaxFWL14::ColladaParserAutoGen14* parserToBeSet )=0;
/** Sets the parser to @a parserToBeSet.*/
virtual void setParser( COLLADASaxFWL15::ColladaParserAutoGen15* parserToBeSet )=0;
/** Sets abstract parser implementation. */
void setParserImpl( IParserImpl* parserImpl ){mParserImpl = parserImpl;}
/** Returns currently set parser implementation. */
IParserImpl* getParserImpl(){return mParserImpl;}
/** Sets the part loader.*/
void setPartLoader(IFilePartLoader* partLoader){mPartLoader=partLoader;}
const IFilePartLoader* getPartLoader() const {return mPartLoader;}
/** Returns the absolute uri of the currently parsed file*/
virtual const COLLADABU::URI& getFileUri()=0;
/** Copies the contents of the STL container @a stlContainer into the framework array
@a clonedArray.*/
template<class StlContainer, class Array >
static void copyStlContainerToArray( const StlContainer& stlContainer, Array& clonedArray)
{
size_t stlContainerSize = stlContainer.size();
if ( stlContainerSize > 0 )
{
clonedArray.allocMemory( stlContainerSize);
typename StlContainer::const_iterator it = stlContainer.begin();
size_t index = 0;
for (; it != stlContainer.end(); ++it, ++index)
{
clonedArray[index] = *it;
}
clonedArray.setCount(stlContainerSize);
}
}
/** Starts loading a extra tag. */
virtual bool begin__technique( const technique__AttributeData& attributeData );
virtual bool end__technique();
protected:
/** Deletes the part loader mPartLoader, if it is not needed anymore. Always call this method,
when creating a new FilePartLoader and switching to it.*/
void deleteFilePartLoader();
private:
/** Disable default copy ctor. */
IFilePartLoader( const IFilePartLoader& pre );
/** Disable default assignment operator. */
const IFilePartLoader& operator= ( const IFilePartLoader& pre );
};
} // namespace COLLADASAXFWL
#endif // __COLLADASAXFWL_IFILEPARTLOADER_H__
|