Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 09:30:08

0001 /*
0002 ---------------------------------------------------------------------------
0003 Open Asset Import Library (assimp)
0004 ---------------------------------------------------------------------------
0005 
0006 Copyright (c) 2006-2024, assimp team
0007 
0008 All rights reserved.
0009 
0010 Redistribution and use of this software in source and binary forms,
0011 with or without modification, are permitted provided that the following
0012 conditions are met:
0013 
0014 * Redistributions of source code must retain the above
0015   copyright notice, this list of conditions and the
0016   following disclaimer.
0017 
0018 * Redistributions in binary form must reproduce the above
0019   copyright notice, this list of conditions and the
0020   following disclaimer in the documentation and/or other
0021   materials provided with the distribution.
0022 
0023 * Neither the name of the assimp team, nor the names of its
0024   contributors may be used to endorse or promote products
0025   derived from this software without specific prior
0026   written permission of the assimp team.
0027 
0028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0029 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0030 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0031 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0032 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0033 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0034 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0035 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0036 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0037 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0038 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0039 ---------------------------------------------------------------------------
0040 */
0041 
0042 /** @file  Importer.hpp
0043  *  @brief Defines the C++-API to the Open Asset Import Library.
0044  */
0045 #pragma once
0046 #ifndef AI_ASSIMP_HPP_INC
0047 #define AI_ASSIMP_HPP_INC
0048 
0049 #ifdef __GNUC__
0050 #pragma GCC system_header
0051 #endif
0052 
0053 #ifndef __cplusplus
0054 #error This header requires C++ to be used. Use assimp.h for plain C.
0055 #endif // __cplusplus
0056 
0057 // Public ASSIMP data structures
0058 #include <assimp/types.h>
0059 
0060 #include <exception>
0061 
0062 namespace Assimp {
0063 // =======================================================================
0064 // Public interface to Assimp
0065 class Importer;
0066 class IOStream;
0067 class IOSystem;
0068 class ProgressHandler;
0069 
0070 // =======================================================================
0071 // Plugin development
0072 //
0073 // Include the following headers for the declarations:
0074 // BaseImporter.h
0075 // BaseProcess.h
0076 class BaseImporter;
0077 class BaseProcess;
0078 class SharedPostProcessInfo;
0079 class BatchLoader;
0080 
0081 // =======================================================================
0082 // Holy stuff, only for members of the high council of the Jedi.
0083 class ImporterPimpl;
0084 } // namespace Assimp
0085 
0086 #define AI_PROPERTY_WAS_NOT_EXISTING 0xffffffff
0087 
0088 struct aiScene;
0089 
0090 // importerdesc.h
0091 struct aiImporterDesc;
0092 
0093 /** @namespace Assimp Assimp's CPP-API and all internal APIs */
0094 namespace Assimp {
0095 
0096 // ----------------------------------------------------------------------------------
0097 /** CPP-API: The Importer class forms an C++ interface to the functionality of the
0098 *   Open Asset Import Library.
0099 *
0100 * Create an object of this class and call ReadFile() to import a file.
0101 * If the import succeeds, the function returns a pointer to the imported data.
0102 * The data remains property of the object, it is intended to be accessed
0103 * read-only. The imported data will be destroyed along with the Importer
0104 * object. If the import fails, ReadFile() returns a nullptr pointer. In this
0105 * case you can retrieve a human-readable error description be calling
0106 * GetErrorString(). You can call ReadFile() multiple times with a single Importer
0107 * instance. Actually, constructing Importer objects involves quite many
0108 * allocations and may take some time, so it's better to reuse them as often as
0109 * possible.
0110 *
0111 * If you need the Importer to do custom file handling to access the files,
0112 * implement IOSystem and IOStream and supply an instance of your custom
0113 * IOSystem implementation by calling SetIOHandler() before calling ReadFile().
0114 * If you do not assign a custom IO handler, a default handler using the
0115 * standard C++ IO logic will be used.
0116 *
0117 * @note One Importer instance is not thread-safe. If you use multiple
0118 * threads for loading, each thread should maintain its own Importer instance.
0119 */
0120 class ASSIMP_API Importer {
0121 public:
0122     /**
0123      *  @brief The upper limit for hints.
0124      */
0125     static const unsigned int MaxLenHint = 200;
0126 
0127 public:
0128     // -------------------------------------------------------------------
0129     /** Constructor. Creates an empty importer object.
0130      *
0131      * Call ReadFile() to start the import process. The configuration
0132      * property table is initially empty.
0133      */
0134     Importer();
0135 
0136     // -------------------------------------------------------------------
0137     /** Copy constructor.
0138      *
0139      * This copies the configuration properties of another Importer.
0140      * If this Importer owns a scene it won't be copied.
0141      * Call ReadFile() to start the import process.
0142      */
0143     Importer(const Importer &other) = delete;
0144 
0145     // -------------------------------------------------------------------
0146     /** Assignment operator has been deleted
0147      */
0148     Importer &operator=(const Importer &) = delete;
0149 
0150     // -------------------------------------------------------------------
0151     /** Destructor. The object kept ownership of the imported data,
0152      * which now will be destroyed along with the object.
0153      */
0154     ~Importer();
0155 
0156     // -------------------------------------------------------------------
0157     /** Registers a new loader.
0158      *
0159      * @param pImp Importer to be added. The Importer instance takes
0160      *   ownership of the pointer, so it will be automatically deleted
0161      *   with the Importer instance.
0162      * @return AI_SUCCESS if the loader has been added. The registration
0163      *   fails if there is already a loader for a specific file extension.
0164      */
0165     aiReturn RegisterLoader(BaseImporter *pImp);
0166 
0167     // -------------------------------------------------------------------
0168     /** Unregisters a loader.
0169      *
0170      * @param pImp Importer to be unregistered.
0171      * @return AI_SUCCESS if the loader has been removed. The function
0172      *   fails if the loader is currently in use (this could happen
0173      *   if the #Importer instance is used by more than one thread) or
0174      *   if it has not yet been registered.
0175      */
0176     aiReturn UnregisterLoader(BaseImporter *pImp);
0177 
0178     // -------------------------------------------------------------------
0179     /** Registers a new post-process step.
0180      *
0181      * At the moment, there's a small limitation: new post processing
0182      * steps are added to end of the list, or in other words, executed
0183      * last, after all built-in steps.
0184      * @param pImp Post-process step to be added. The Importer instance
0185      *   takes ownership of the pointer, so it will be automatically
0186      *   deleted with the Importer instance.
0187      * @return AI_SUCCESS if the step has been added correctly.
0188      */
0189     aiReturn RegisterPPStep(BaseProcess *pImp);
0190 
0191     // -------------------------------------------------------------------
0192     /** Unregisters a post-process step.
0193      *
0194      * @param pImp Step to be unregistered.
0195      * @return AI_SUCCESS if the step has been removed. The function
0196      *   fails if the step is currently in use (this could happen
0197      *   if the #Importer instance is used by more than one thread) or
0198      *   if it has not yet been registered.
0199      */
0200     aiReturn UnregisterPPStep(BaseProcess *pImp);
0201 
0202     // -------------------------------------------------------------------
0203     /** Set an integer configuration property.
0204      * @param szName Name of the property. All supported properties
0205      *   are defined in the aiConfig.g header (all constants share the
0206      *   prefix AI_CONFIG_XXX and are simple strings).
0207      * @param iValue New value of the property
0208      * @return true if the property was set before. The new value replaces
0209      *   the previous value in this case.
0210      * @note Property of different types (float, int, string ..) are kept
0211      *   on different stacks, so calling SetPropertyInteger() for a
0212      *   floating-point property has no effect - the loader will call
0213      *   GetPropertyFloat() to read the property, but it won't be there.
0214      */
0215     bool SetPropertyInteger(const char *szName, int iValue);
0216 
0217     // -------------------------------------------------------------------
0218     /** Set a boolean configuration property. Boolean properties
0219      *  are stored on the integer stack internally so it's possible
0220      *  to set them via #SetPropertyBool and query them with
0221      *  #GetPropertyBool and vice versa.
0222      * @see SetPropertyInteger()
0223      */
0224     bool SetPropertyBool(const char *szName, bool value) {
0225         return SetPropertyInteger(szName, value);
0226     }
0227 
0228     // -------------------------------------------------------------------
0229     /** Set a floating-point configuration property.
0230      * @see SetPropertyInteger()
0231      */
0232     bool SetPropertyFloat(const char *szName, ai_real fValue);
0233 
0234     // -------------------------------------------------------------------
0235     /** Set a string configuration property.
0236      * @see SetPropertyInteger()
0237      */
0238     bool SetPropertyString(const char *szName, const std::string &sValue);
0239 
0240     // -------------------------------------------------------------------
0241     /** Set a matrix configuration property.
0242      * @see SetPropertyInteger()
0243      */
0244     bool SetPropertyMatrix(const char *szName, const aiMatrix4x4 &sValue);
0245 
0246     // -------------------------------------------------------------------
0247     /** Set a pointer configuration property.
0248      * @see SetPropertyInteger()
0249      */
0250     bool SetPropertyPointer(const char *szName, void *sValue);
0251 
0252     // -------------------------------------------------------------------
0253     /** Get a configuration property.
0254      * @param szName Name of the property. All supported properties
0255      *   are defined in the aiConfig.g header (all constants share the
0256      *   prefix AI_CONFIG_XXX).
0257      * @param iErrorReturn Value that is returned if the property
0258      *   is not found.
0259      * @return Current value of the property
0260      * @note Property of different types (float, int, string ..) are kept
0261      *   on different lists, so calling SetPropertyInteger() for a
0262      *   floating-point property has no effect - the loader will call
0263      *   GetPropertyFloat() to read the property, but it won't be there.
0264      */
0265     int GetPropertyInteger(const char *szName,
0266             int iErrorReturn = 0xffffffff) const;
0267 
0268     // -------------------------------------------------------------------
0269     /** Get a boolean configuration property. Boolean properties
0270      *  are stored on the integer stack internally so it's possible
0271      *  to set them via #SetPropertyBool and query them with
0272      *  #GetPropertyBool and vice versa.
0273      * @see GetPropertyInteger()
0274      */
0275     bool GetPropertyBool(const char *szName, bool bErrorReturn = false) const {
0276         return GetPropertyInteger(szName, bErrorReturn) != 0;
0277     }
0278 
0279     // -------------------------------------------------------------------
0280     /** Get a floating-point configuration property
0281      * @see GetPropertyInteger()
0282      */
0283     ai_real GetPropertyFloat(const char *szName,
0284             ai_real fErrorReturn = 10e10) const;
0285 
0286     // -------------------------------------------------------------------
0287     /** Get a string configuration property
0288      *
0289      *  The return value remains valid until the property is modified.
0290      * @see GetPropertyInteger()
0291      */
0292     std::string GetPropertyString(const char *szName,
0293             const std::string &sErrorReturn = std::string()) const;
0294 
0295     // -------------------------------------------------------------------
0296     /** Get a matrix configuration property
0297      *
0298      *  The return value remains valid until the property is modified.
0299      * @see GetPropertyInteger()
0300      */
0301     aiMatrix4x4 GetPropertyMatrix(const char *szName,
0302             const aiMatrix4x4 &sErrorReturn = aiMatrix4x4()) const;
0303 
0304     // -------------------------------------------------------------------
0305     /** Get a pointer configuration property
0306      *
0307      *  The return value remains valid until the property is modified.
0308      * @see GetPropertyInteger()
0309      */
0310     void* GetPropertyPointer(const char *szName,
0311         void *sErrorReturn = nullptr) const;
0312 
0313     // -------------------------------------------------------------------
0314     /** Supplies a custom IO handler to the importer to use to open and
0315      * access files. If you need the importer to use custom IO logic to
0316      * access the files, you need to provide a custom implementation of
0317      * IOSystem and IOFile to the importer. Then create an instance of
0318      * your custom IOSystem implementation and supply it by this function.
0319      *
0320      * The Importer takes ownership of the object and will destroy it
0321      * afterwards. The previously assigned handler will be deleted.
0322      * Pass nullptr to take again ownership of your IOSystem and reset Assimp
0323      * to use its default implementation.
0324      *
0325      * @param pIOHandler The IO handler to be used in all file accesses
0326      *   of the Importer.
0327      */
0328     void SetIOHandler(IOSystem *pIOHandler);
0329 
0330     // -------------------------------------------------------------------
0331     /** Retrieves the IO handler that is currently set.
0332      * You can use #IsDefaultIOHandler() to check whether the returned
0333      * interface is the default IO handler provided by ASSIMP. The default
0334      * handler is active as long the application doesn't supply its own
0335      * custom IO handler via #SetIOHandler().
0336      * @return A valid IOSystem interface, never nullptr.
0337      */
0338     IOSystem *GetIOHandler() const;
0339 
0340     // -------------------------------------------------------------------
0341     /** Checks whether a default IO handler is active
0342      * A default handler is active as long the application doesn't
0343      * supply its own custom IO handler via #SetIOHandler().
0344      * @return true by default
0345      */
0346     bool IsDefaultIOHandler() const;
0347 
0348     // -------------------------------------------------------------------
0349     /** Supplies a custom progress handler to the importer. This
0350      *  interface exposes an #Update() callback, which is called
0351      *  more or less periodically (please don't sue us if it
0352      *  isn't as periodically as you'd like it to have ...).
0353      *  This can be used to implement progress bars and loading
0354      *  timeouts.
0355      *  @param pHandler Progress callback interface. Pass nullptr to
0356      *    disable progress reporting.
0357      *  @note Progress handlers can be used to abort the loading
0358      *    at almost any time.*/
0359     void SetProgressHandler(ProgressHandler *pHandler);
0360 
0361     // -------------------------------------------------------------------
0362     /** Retrieves the progress handler that is currently set.
0363      * You can use #IsDefaultProgressHandler() to check whether the returned
0364      * interface is the default handler provided by ASSIMP. The default
0365      * handler is active as long the application doesn't supply its own
0366      * custom handler via #SetProgressHandler().
0367      * @return A valid ProgressHandler interface, never nullptr.
0368      */
0369     ProgressHandler *GetProgressHandler() const;
0370 
0371     // -------------------------------------------------------------------
0372     /** Checks whether a default progress handler is active
0373      * A default handler is active as long the application doesn't
0374      * supply its own custom progress handler via #SetProgressHandler().
0375      * @return true by default
0376      */
0377     bool IsDefaultProgressHandler() const;
0378 
0379     // -------------------------------------------------------------------
0380     /** @brief Check whether a given set of post-processing flags
0381      *  is supported.
0382      *
0383      *  Some flags are mutually exclusive, others are probably
0384      *  not available because your excluded them from your
0385      *  Assimp builds. Calling this function is recommended if
0386      *  you're unsure.
0387      *
0388      *  @param pFlags Bitwise combination of the aiPostProcess flags.
0389      *  @return true if this flag combination is fine.
0390      */
0391     bool ValidateFlags(unsigned int pFlags) const;
0392 
0393     // -------------------------------------------------------------------
0394     /** Reads the given file and returns its contents if successful.
0395      *
0396      * If the call succeeds, the contents of the file are returned as a
0397      * pointer to an aiScene object. The returned data is intended to be
0398      * read-only, the importer object keeps ownership of the data and will
0399      * destroy it upon destruction. If the import fails, nullptr is returned.
0400      * A human-readable error description can be retrieved by calling
0401      * GetErrorString(). The previous scene will be deleted during this call.
0402      * @param pFile Path and filename to the file to be imported.
0403      * @param pFlags Optional post processing steps to be executed after
0404      *   a successful import. Provide a bitwise combination of the
0405      *   #aiPostProcessSteps flags. If you wish to inspect the imported
0406      *   scene first in order to fine-tune your post-processing setup,
0407      *   consider to use #ApplyPostProcessing().
0408      * @return A pointer to the imported data, nullptr if the import failed.
0409      *   The pointer to the scene remains in possession of the Importer
0410      *   instance. Use GetOrphanedScene() to take ownership of it.
0411      *
0412      * @note Assimp is able to determine the file format of a file
0413      * automatically.
0414      */
0415     const aiScene *ReadFile(
0416             const char *pFile,
0417             unsigned int pFlags);
0418 
0419     // -------------------------------------------------------------------
0420     /** Reads the given file from a memory buffer and returns its
0421      *  contents if successful.
0422      *
0423      * If the call succeeds, the contents of the file are returned as a
0424      * pointer to an aiScene object. The returned data is intended to be
0425      * read-only, the importer object keeps ownership of the data and will
0426      * destroy it upon destruction. If the import fails, nullptr is returned.
0427      * A human-readable error description can be retrieved by calling
0428      * GetErrorString(). The previous scene will be deleted during this call.
0429      * Calling this method doesn't affect the active IOSystem.
0430      * @param pBuffer Pointer to the file data
0431      * @param pLength Length of pBuffer, in bytes
0432      * @param pFlags Optional post processing steps to be executed after
0433      *   a successful import. Provide a bitwise combination of the
0434      *   #aiPostProcessSteps flags. If you wish to inspect the imported
0435      *   scene first in order to fine-tune your post-processing setup,
0436      *   consider to use #ApplyPostProcessing().
0437      * @param pHint An additional hint to the library. If this is a non
0438      *   empty string, the library looks for a loader to support
0439      *   the file extension specified by pHint and passes the file to
0440      *   the first matching loader. If this loader is unable to completely
0441      *   the request, the library continues and tries to determine the
0442      *   file format on its own, a task that may or may not be successful.
0443      *   Check the return value, and you'll know ...
0444      * @return A pointer to the imported data, nullptr if the import failed.
0445      *   The pointer to the scene remains in possession of the Importer
0446      *   instance. Use GetOrphanedScene() to take ownership of it.
0447      *
0448      * @note This is a straightforward way to decode models from memory
0449      * buffers, but it doesn't handle model formats that spread their
0450      * data across multiple files or even directories. Examples include
0451      * OBJ or MD3, which outsource parts of their material info into
0452      * external scripts. If you need full functionality, provide
0453      * a custom IOSystem to make Assimp find these files and use
0454      * the regular ReadFile() API.
0455      */
0456     const aiScene *ReadFileFromMemory(
0457             const void *pBuffer,
0458             size_t pLength,
0459             unsigned int pFlags,
0460             const char *pHint = "");
0461 
0462     // -------------------------------------------------------------------
0463     /** Apply post-processing to an already-imported scene.
0464      *
0465      *  This is strictly equivalent to calling #ReadFile() with the same
0466      *  flags. However, you can use this separate function to inspect
0467      *  the imported scene first to fine-tune your post-processing setup.
0468      *  @param pFlags Provide a bitwise combination of the
0469      *   #aiPostProcessSteps flags.
0470      *  @return A pointer to the post-processed data. This is still the
0471      *   same as the pointer returned by #ReadFile(). However, if
0472      *   post-processing fails, the scene could now be nullptr.
0473      *   That's quite a rare case, post processing steps are not really
0474      *   designed to 'fail'. To be exact, the #aiProcess_ValidateDS
0475      *   flag is currently the only post processing step which can actually
0476      *   cause the scene to be reset to nullptr.
0477      *
0478      *  @note The method does nothing if no scene is currently bound
0479      *    to the #Importer instance.  */
0480     const aiScene *ApplyPostProcessing(unsigned int pFlags);
0481 
0482     const aiScene *ApplyCustomizedPostProcessing(BaseProcess *rootProcess, bool requestValidation);
0483 
0484     // -------------------------------------------------------------------
0485     /** @brief Reads the given file and returns its contents if successful.
0486      *
0487      * This function is provided for backward compatibility.
0488      * See the const char* version for detailed docs.
0489      * @see ReadFile(const char*, pFlags)  */
0490     const aiScene *ReadFile(
0491             const std::string &pFile,
0492             unsigned int pFlags);
0493 
0494     // -------------------------------------------------------------------
0495     /** Frees the current scene.
0496      *
0497      *  The function does nothing if no scene has previously been
0498      *  read via ReadFile(). FreeScene() is called automatically by the
0499      *  destructor and ReadFile() itself.  */
0500     void FreeScene();
0501 
0502     // -------------------------------------------------------------------
0503     /** Returns an error description of an error that occurred in ReadFile().
0504      *
0505      * Returns an empty string if no error occurred.
0506      * @return A description of the last error, an empty string if no
0507      *   error occurred. The string is never nullptr.
0508      *
0509      * @note The returned function remains valid until one of the
0510      * following methods is called: #ReadFile(), #FreeScene(). */
0511     const char *GetErrorString() const;
0512 
0513     // -------------------------------------------------------------------
0514     /** Returns an exception if one occurred during import.
0515      *
0516      * @return The last exception which occurred.
0517      *
0518      * @note The returned value remains valid until one of the
0519      * following methods is called: #ReadFile(), #FreeScene(). */
0520     const std::exception_ptr& GetException() const;
0521 
0522     // -------------------------------------------------------------------
0523     /** Returns the scene loaded by the last successful call to ReadFile()
0524      *
0525      * @return Current scene or nullptr if there is currently no scene loaded */
0526     const aiScene *GetScene() const;
0527 
0528     // -------------------------------------------------------------------
0529     /** Returns the scene loaded by the last successful call to ReadFile()
0530      *  and releases the scene from the ownership of the Importer
0531      *  instance. The application is now responsible for deleting the
0532      *  scene. Any further calls to GetScene() or GetOrphanedScene()
0533      *  will return nullptr - until a new scene has been loaded via ReadFile().
0534      *
0535      * @return Current scene or nullptr if there is currently no scene loaded
0536      * @note Use this method with maximal caution, and only if you have to.
0537      *   By design, aiScene's are exclusively maintained, allocated and
0538      *   deallocated by Assimp and no one else. The reasoning behind this
0539      *   is the golden rule that deallocations should always be done
0540      *   by the module that did the original allocation because heaps
0541      *   are not necessarily shared. GetOrphanedScene() enforces you
0542      *   to delete the returned scene by yourself, but this will only
0543      *   be fine if and only if you're using the same heap as assimp.
0544      *   On Windows, it's typically fine provided everything is linked
0545      *   against the multithreaded-dll version of the runtime library.
0546      *   It will work as well for static linkage with Assimp.*/
0547     aiScene *GetOrphanedScene();
0548 
0549     // -------------------------------------------------------------------
0550     /** Returns whether a given file extension is supported by ASSIMP.
0551      *
0552      * @param szExtension Extension to be checked.
0553      *   Must include a trailing dot '.'. Example: ".3ds", ".md3".
0554      *   Cases-insensitive.
0555      * @return true if the extension is supported, false otherwise */
0556     bool IsExtensionSupported(const char *szExtension) const;
0557 
0558     // -------------------------------------------------------------------
0559     /** @brief Returns whether a given file extension is supported by ASSIMP.
0560      *
0561      * This function is provided for backward compatibility.
0562      * See the const char* version for detailed and up-to-date docs.
0563      * @see IsExtensionSupported(const char*) */
0564     inline bool IsExtensionSupported(const std::string &szExtension) const;
0565 
0566     // -------------------------------------------------------------------
0567     /** Get a full list of all file extensions supported by ASSIMP.
0568      *
0569      * If a file extension is contained in the list this does of course not
0570      * mean that ASSIMP is able to load all files with this extension ---
0571      * it simply means there is an importer loaded which claims to handle
0572      * files with this file extension.
0573      * @param szOut String to receive the extension list.
0574      *   Format of the list: "*.3ds;*.obj;*.dae". This is useful for
0575      *   use with the WinAPI call GetOpenFileName(Ex). */
0576     void GetExtensionList(aiString &szOut) const;
0577 
0578     // -------------------------------------------------------------------
0579     /** @brief Get a full list of all file extensions supported by ASSIMP.
0580      *
0581      * This function is provided for backward compatibility.
0582      * See the aiString version for detailed and up-to-date docs.
0583      * @see GetExtensionList(aiString&)*/
0584     inline void GetExtensionList(std::string &szOut) const;
0585 
0586     // -------------------------------------------------------------------
0587     /** Get the number of importers currently registered with Assimp. */
0588     size_t GetImporterCount() const;
0589 
0590     // -------------------------------------------------------------------
0591     /** Get meta data for the importer corresponding to a specific index..
0592     *
0593     *  For the declaration of #aiImporterDesc, include <assimp/importerdesc.h>.
0594     *  @param index Index to query, must be within [0,GetImporterCount())
0595     *  @return Importer meta data structure, nullptr if the index does not
0596     *     exist or if the importer doesn't offer meta information (
0597     *     importers may do this at the cost of being hated by their peers).*/
0598     const aiImporterDesc *GetImporterInfo(size_t index) const;
0599 
0600     // -------------------------------------------------------------------
0601     /** Find the importer corresponding to a specific index.
0602     *
0603     *  @param index Index to query, must be within [0,GetImporterCount())
0604     *  @return Importer instance. nullptr if the index does not
0605     *     exist. */
0606     BaseImporter *GetImporter(size_t index) const;
0607 
0608     // -------------------------------------------------------------------
0609     /** Find the importer corresponding to a specific file extension.
0610     *
0611     *  This is quite similar to #IsExtensionSupported except a
0612     *  BaseImporter instance is returned.
0613     *  @param szExtension Extension to check for. The following formats
0614     *    are recognized (BAH being the file extension): "BAH" (comparison
0615     *    is case-insensitive), ".bah", "*.bah" (wild card and dot
0616     *    characters at the beginning of the extension are skipped).
0617     *  @return nullptr if no importer is found*/
0618     BaseImporter *GetImporter(const char *szExtension) const;
0619 
0620     // -------------------------------------------------------------------
0621     /** Find the importer index corresponding to a specific file extension.
0622     *
0623     *  @param szExtension Extension to check for. The following formats
0624     *    are recognized (BAH being the file extension): "BAH" (comparison
0625     *    is case-insensitive), ".bah", "*.bah" (wild card and dot
0626     *    characters at the beginning of the extension are skipped).
0627     *  @return (size_t)-1 if no importer is found */
0628     size_t GetImporterIndex(const char *szExtension) const;
0629 
0630     // -------------------------------------------------------------------
0631     /** Returns the storage allocated by ASSIMP to hold the scene data
0632      * in memory.
0633      *
0634      * This refers to the currently loaded file, see #ReadFile().
0635      * @param in Data structure to be filled.
0636      * @note The returned memory statistics refer to the actual
0637      *   size of the use data of the aiScene. Heap-related overhead
0638      *   is (naturally) not included.*/
0639     void GetMemoryRequirements(aiMemoryInfo &in) const;
0640 
0641     // -------------------------------------------------------------------
0642     /** Enables "extra verbose" mode.
0643      *
0644      * 'Extra verbose' means the data structure is validated after *every*
0645      * single post processing step to make sure everyone modifies the data
0646      * structure in a well-defined manner. This is a debug feature and not
0647      * intended for use in production environments. */
0648     void SetExtraVerbose(bool bDo);
0649 
0650     // -------------------------------------------------------------------
0651     /** Private, do not use. */
0652     ImporterPimpl *Pimpl() { return pimpl; }
0653     const ImporterPimpl *Pimpl() const { return pimpl; }
0654 
0655 protected:
0656     // Just because we don't want you to know how we're hacking around.
0657     ImporterPimpl *pimpl;
0658 }; //! class Importer
0659 
0660 // ----------------------------------------------------------------------------
0661 // For compatibility, the interface of some functions taking a std::string was
0662 // changed to const char* to avoid crashes between binary incompatible STL
0663 // versions. This code her is inlined,  so it shouldn't cause any problems.
0664 // ----------------------------------------------------------------------------
0665 
0666 // ----------------------------------------------------------------------------
0667 AI_FORCE_INLINE const aiScene *Importer::ReadFile(const std::string &pFile, unsigned int pFlags) {
0668     return ReadFile(pFile.c_str(), pFlags);
0669 }
0670 // ----------------------------------------------------------------------------
0671 AI_FORCE_INLINE void Importer::GetExtensionList(std::string &szOut) const {
0672     aiString s;
0673     GetExtensionList(s);
0674     szOut = s.data;
0675 }
0676 // ----------------------------------------------------------------------------
0677 AI_FORCE_INLINE bool Importer::IsExtensionSupported(const std::string &szExtension) const {
0678     return IsExtensionSupported(szExtension.c_str());
0679 }
0680 
0681 } // namespace Assimp
0682 
0683 #endif // AI_ASSIMP_HPP_INC