Removed direct STL dependency from the Assimp interface, should hopefully avoid problems with binary incompatible STLs. Some API changes, e.g. in the logger.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@321 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
@@ -54,11 +54,14 @@ namespace Assimp {
|
||||
class IOStream;
|
||||
struct LogStreamInfo;
|
||||
|
||||
//! Default log file
|
||||
#define ASSIMP_DEFAULT_LOG_NAME "AssimpLog.txt"
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
/** @class DefaultLogger
|
||||
* @brief Default logging implementation. The logger writes into a file.
|
||||
* The name can be set by creating the logger. If no filename was specified
|
||||
* the logger will use the standard out and error streams.
|
||||
/** @class DefaultLogger
|
||||
* @brief Default logging implementation.
|
||||
*
|
||||
* todo .... move static stuff to Logger where it belongs to.
|
||||
*/
|
||||
class ASSIMP_API DefaultLogger :
|
||||
public Logger
|
||||
@@ -66,9 +69,9 @@ class ASSIMP_API DefaultLogger :
|
||||
public:
|
||||
|
||||
/** @brief Creates a default logging instance (DefaultLogger)
|
||||
* @param name Name for log file. Only valid in combination
|
||||
* @param name Name for log file. Only valid in combination
|
||||
* with the DLS_FILE flag.
|
||||
* @param severity Log severity, VERBOSE will activate debug messages
|
||||
* @param severity Log severity, VERBOSE will activate debug messages
|
||||
* @param defStreams Default log streams to be attached. Bitwise
|
||||
* combination of the DefaultLogStreams enumerated
|
||||
* values. If DLS_FILE is specified, but an empty
|
||||
@@ -78,7 +81,7 @@ public:
|
||||
*
|
||||
* This replaces the default NullLogger with a DefaultLogger instance.
|
||||
*/
|
||||
static Logger *create(const std::string &name = "AssimpLog.txt",
|
||||
static Logger *create(const char* name = ASSIMP_DEFAULT_LOG_NAME,
|
||||
LogSeverity severity = NORMAL,
|
||||
unsigned int defStreams = DLS_DEBUGGER | DLS_FILE,
|
||||
IOSystem* io = NULL);
|
||||
@@ -110,31 +113,32 @@ public:
|
||||
static void kill();
|
||||
|
||||
|
||||
|
||||
|
||||
/** @brief Logs debug infos, only been written when severity level VERBOSE is set */
|
||||
void debug(const std::string &message);
|
||||
|
||||
/** @brief Logs an info message */
|
||||
void info(const std::string &message);
|
||||
|
||||
/** @brief Logs a warning message */
|
||||
void warn(const std::string &message);
|
||||
|
||||
/** @brief Logs an error message */
|
||||
void error(const std::string &message);
|
||||
|
||||
/** @brief Severity setter */
|
||||
void setLogSeverity(LogSeverity log_severity);
|
||||
/* override */ void setLogSeverity(LogSeverity log_severity);
|
||||
|
||||
/** @brief Attach a stream to the logger. */
|
||||
void attachStream(LogStream *pStream, unsigned int severity);
|
||||
/* override */ void attachStream(LogStream *pStream,
|
||||
unsigned int severity);
|
||||
|
||||
/** @brief Detach a still attached stream from logger */
|
||||
void detatchStream(LogStream *pStream, unsigned int severity);
|
||||
/* override */ void detatchStream(LogStream *pStream,
|
||||
unsigned int severity);
|
||||
|
||||
private:
|
||||
|
||||
/** @brief Logs debug infos, only been written when severity level VERBOSE is set */
|
||||
/* override */ void OnDebug(const char* message);
|
||||
|
||||
/** @brief Logs an info message */
|
||||
/* override */ void OnInfo(const char* message);
|
||||
|
||||
/** @brief Logs a warning message */
|
||||
/* override */ void OnWarn(const char* message);
|
||||
|
||||
/** @brief Logs an error message */
|
||||
/* override */ void OnError(const char* message);
|
||||
|
||||
|
||||
/** @brief Private construction for internal use by create().
|
||||
* @param severity Logging granularity
|
||||
*/
|
||||
@@ -144,12 +148,12 @@ private:
|
||||
~DefaultLogger();
|
||||
|
||||
/** @brief Writes a message to all streams */
|
||||
void writeToStreams(const std::string &message, ErrorSeverity ErrorSev );
|
||||
void WriteToStreams(const char* message, ErrorSeverity ErrorSev );
|
||||
|
||||
/** @brief Returns the thread id.
|
||||
* @remark This is an OS specific feature, if not supported, a zero will be returned.
|
||||
* @remark This is an OS specific feature, if not supported, a zero will be returned.
|
||||
*/
|
||||
std::string getThreadID();
|
||||
unsigned int GetThreadID();
|
||||
|
||||
private:
|
||||
// Aliases for stream container
|
||||
@@ -167,7 +171,8 @@ private:
|
||||
StreamArray m_StreamArray;
|
||||
|
||||
bool noRepeatMsg;
|
||||
std::string lastMsg;
|
||||
char lastMsg[MAX_LOG_MESSAGE_LENGTH*2];
|
||||
size_t lastLen;
|
||||
};
|
||||
// ------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Assimp {
|
||||
* to the Importer. If you implement this interface, be sure to also provide an
|
||||
* implementation for IOSystem that creates instances of your custom IO class.
|
||||
*/
|
||||
class ASSIMP_API IOStream
|
||||
class ASSIMP_API IOStream : public Intern::AllocateFromAssimpHeap
|
||||
{
|
||||
protected:
|
||||
/** Constructor protected, use IOSystem::Open() to create an instance. */
|
||||
|
||||
@@ -52,70 +52,101 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
corresponding C interface.
|
||||
#endif
|
||||
|
||||
|
||||
#include "aiTypes.h"
|
||||
namespace Assimp {
|
||||
|
||||
class IOStream;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @class IOSystem
|
||||
* @brief Interface to the file system.
|
||||
*
|
||||
* Derive an own implementation from this interface to supply custom file handling
|
||||
* to the importer library. If you implement this interface, you also want to
|
||||
* supply a custom implementation for IOStream.
|
||||
*/
|
||||
class ASSIMP_API IOSystem
|
||||
* @brief Interface to the file system.
|
||||
*
|
||||
* Derive an own implementation from this interface to supply custom file handling
|
||||
* to the importer library. If you implement this interface, you also want to
|
||||
* supply a custom implementation for IOStream.
|
||||
*
|
||||
* @see Importer::SetIOHandler()
|
||||
*/
|
||||
class ASSIMP_API IOSystem : public Intern::AllocateFromAssimpHeap
|
||||
{
|
||||
public:
|
||||
/** @brief Constructor. Create an instance of your derived class and
|
||||
* assign it to an #Assimp::Importer instance by calling Importer::SetIOHandler().
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Default constructor.
|
||||
*
|
||||
* Create an instance of your derived class and assign it to an
|
||||
* #Assimp::Importer instance by calling Importer::SetIOHandler().
|
||||
*/
|
||||
IOSystem();
|
||||
|
||||
/** Destructor. */
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Virtual destructor.
|
||||
*
|
||||
* It is safe to be called from within DLL Assimp, we're constructed
|
||||
* on Assimp's heap.
|
||||
*/
|
||||
virtual ~IOSystem();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief For backward compatibility
|
||||
* @see Exists(const char*)
|
||||
*/
|
||||
AI_FORCE_INLINE bool Exists( const std::string& pFile) const;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Tests for the existence of a file at the given path.
|
||||
*
|
||||
* @param pFile Path to the file
|
||||
* @return true if there is a file with this path, else false.
|
||||
*/
|
||||
virtual bool Exists( const std::string& pFile) const = 0;
|
||||
*
|
||||
* @param pFile Path to the file
|
||||
* @return true if there is a file with this path, else false.
|
||||
*/
|
||||
|
||||
virtual bool Exists( const char* pFile) const = 0;
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Returns the system specific directory separator
|
||||
* @return System specific directory separator
|
||||
*/
|
||||
virtual std::string getOsSeparator() const = 0;
|
||||
* @return System specific directory separator
|
||||
*/
|
||||
virtual char getOsSeparator() const = 0;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Open a new file with a given path.
|
||||
*
|
||||
* When the access to the file is finished, call Close() to release
|
||||
* all associated resources.
|
||||
*
|
||||
* @param pFile Path to the file
|
||||
* @param pMode Desired file I/O mode. Required are: "wb", "w", "wt",
|
||||
* "rb", "r", "rt".
|
||||
*
|
||||
* @return New IOStream interface allowing the lib to access
|
||||
* the underlying file.
|
||||
* @note When implementing this class to provide custom IO handling,
|
||||
* you probably have to supply an own implementation of IOStream as well.
|
||||
*/
|
||||
virtual IOStream* Open(const std::string& pFile,
|
||||
const std::string& pMode = std::string("rb")) = 0;
|
||||
*
|
||||
* When the access to the file is finished, call Close() to release
|
||||
* all associated resources (or the virtual dtor of the IOStream).
|
||||
*
|
||||
* @param pFile Path to the file
|
||||
* @param pMode Desired file I/O mode. Required are: "wb", "w", "wt",
|
||||
* "rb", "r", "rt".
|
||||
*
|
||||
* @return New IOStream interface allowing the lib to access
|
||||
* the underlying file.
|
||||
* @note When implementing this class to provide custom IO handling,
|
||||
* you probably have to supply an own implementation of IOStream as well.
|
||||
*/
|
||||
virtual IOStream* Open(const char* pFile,
|
||||
const char* pMode = "rb") = 0;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Closes the given file and releases all resources associated with it.
|
||||
/** @brief For backward compatibility
|
||||
* @see Open(const char*, const char*)
|
||||
*/
|
||||
inline IOStream* Open(const std::string& pFile,
|
||||
const std::string& pMode = std::string("rb"));
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Closes the given file and releases all resources
|
||||
* associated with it.
|
||||
* @param pFile The file instance previously created by Open().
|
||||
*/
|
||||
virtual void Close( IOStream* pFile) = 0;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Compares two paths and check whether the point to
|
||||
* identical files.
|
||||
@@ -129,24 +160,65 @@ public:
|
||||
* @return true if the paths point to the same file. The file needn't
|
||||
* be existing, however.
|
||||
*/
|
||||
virtual bool ComparePaths (const std::string& one,
|
||||
const std::string& second);
|
||||
virtual bool ComparePaths (const char* one,
|
||||
const char* second) const;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief For backward compatibility
|
||||
* @see ComparePaths(const char*, const char*)
|
||||
*/
|
||||
inline bool ComparePaths (const std::string& one,
|
||||
const std::string& second) const;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
inline IOSystem::IOSystem()
|
||||
AI_FORCE_INLINE IOSystem::IOSystem()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
inline IOSystem::~IOSystem()
|
||||
AI_FORCE_INLINE IOSystem::~IOSystem()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// For compatibility, the interface of some functions taking a std::string was
|
||||
// changed to const char* to avoid crashes between binary incompatible STL
|
||||
// versions. This code her is inlined, so it shouldn't cause any problems.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
AI_FORCE_INLINE IOStream* IOSystem::Open(const std::string& pFile,
|
||||
const std::string& pMode)
|
||||
{
|
||||
// NOTE:
|
||||
// For compatibility, interface was changed to const char* to
|
||||
// avoid crashes between binary incompatible STL versions
|
||||
return Open(pFile.c_str(),pMode.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
AI_FORCE_INLINE bool IOSystem::Exists( const std::string& pFile) const
|
||||
{
|
||||
// NOTE:
|
||||
// For compatibility, interface was changed to const char* to
|
||||
// avoid crashes between binary incompatible STL versions
|
||||
return Exists(pFile.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
inline bool IOSystem::ComparePaths (const std::string& one,
|
||||
const std::string& second) const
|
||||
{
|
||||
// NOTE:
|
||||
// For compatibility, interface was changed to const char* to
|
||||
// avoid crashes between binary incompatible STL versions
|
||||
return ComparePaths(one.c_str(),second.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
} //!ns Assimp
|
||||
|
||||
#endif //AI_IOSYSTEM_H_INC
|
||||
|
||||
@@ -69,7 +69,7 @@ enum DefaultLogStreams
|
||||
|
||||
// MSVC only: Stream the log the the debugger
|
||||
DLS_DEBUGGER = 0x8
|
||||
};
|
||||
}; // !enum DefaultLogStreams
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
/** @class LogStream
|
||||
@@ -88,11 +88,19 @@ public:
|
||||
/** @brief Virtual destructor */
|
||||
virtual ~LogStream();
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Overwrite this for your own output methods
|
||||
*
|
||||
* Log messages *may* consist of multiple lines and you shouldn't
|
||||
* expect a consistent formatting. If you want custom formatting
|
||||
* (e.g. generate HTML), supply a custom instance of Logger to
|
||||
* DefaultLogger:set(). Usually you can *expect* that a log message
|
||||
* is exactly one line long, terminated with a single \n sequence.
|
||||
* @param message Message to be written
|
||||
*/
|
||||
virtual void write(const std::string &message) = 0;
|
||||
virtual void write(const char* message) = 0;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Creates a default log stream
|
||||
* @param streams Type of the default stream
|
||||
* @param name For DLS_FILE: name of the output file
|
||||
@@ -101,9 +109,9 @@ public:
|
||||
* @return New LogStream instance - you're responsible for it's destruction!
|
||||
*/
|
||||
static LogStream* createDefaultStream(DefaultLogStreams streams,
|
||||
const std::string& name = "AssimpLog.txt",
|
||||
const char* name = "AssimpLog.txt",
|
||||
IOSystem* io = NULL);
|
||||
};
|
||||
}; // !class LogStream
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
// Default constructor
|
||||
|
||||
@@ -85,6 +85,10 @@ public:
|
||||
ERR = 8 //!< Error log message
|
||||
};
|
||||
|
||||
/** @brief Maximum length for log messages
|
||||
*/
|
||||
static const size_t MAX_LOG_MESSAGE_LENGTH = 1024;
|
||||
|
||||
public:
|
||||
/** @brief Virtual destructor */
|
||||
virtual ~Logger();
|
||||
@@ -92,22 +96,22 @@ public:
|
||||
/** @brief Writes a debug message
|
||||
* @param message Debug message
|
||||
*/
|
||||
virtual void debug(const std::string &message)= 0;
|
||||
void debug(const std::string &message);
|
||||
|
||||
/** @brief Writes a info message
|
||||
* @param message Info message
|
||||
*/
|
||||
virtual void info(const std::string &message) = 0;
|
||||
void info(const std::string &message);
|
||||
|
||||
/** @brief Writes a warning message
|
||||
* @param message Warn message
|
||||
*/
|
||||
virtual void warn(const std::string &message) = 0;
|
||||
void warn(const std::string &message);
|
||||
|
||||
/** @brief Writes an error message
|
||||
* @param message Error message
|
||||
*/
|
||||
virtual void error(const std::string &message) = 0;
|
||||
void error(const std::string &message);
|
||||
|
||||
/** @brief Set a new log severity.
|
||||
* @param log_severity New severity for logging
|
||||
@@ -142,6 +146,38 @@ public:
|
||||
protected:
|
||||
/** @brief Default constructor */
|
||||
Logger();
|
||||
|
||||
/** @brief Called as a request to write a specific debug message
|
||||
* @param message Debug message. Never longer than
|
||||
* MAX_LOG_MESSAGE_LENGTH characters (exluding the '0').
|
||||
* @note The message string is only valid until the scope of
|
||||
* the function is left.
|
||||
*/
|
||||
virtual void OnDebug(const char* message)= 0;
|
||||
|
||||
/** @brief Called as a request to write a specific info message
|
||||
* @param message Info message. Never longer than
|
||||
* MAX_LOG_MESSAGE_LENGTH characters (exluding the '0').
|
||||
* @note The message string is only valid until the scope of
|
||||
* the function is left.
|
||||
*/
|
||||
virtual void OnInfo(const char* message) = 0;
|
||||
|
||||
/** @brief Called as a request to write a specific warn message
|
||||
* @param message Warn message. Never longer than
|
||||
* MAX_LOG_MESSAGE_LENGTH characters (exluding the '0').
|
||||
* @note The message string is only valid until the scope of
|
||||
* the function is left.
|
||||
*/
|
||||
virtual void OnWarn(const char* essage) = 0;
|
||||
|
||||
/** @brief Called as a request to write a specific error message
|
||||
* @param message Error message. Never longer than
|
||||
* MAX_LOG_MESSAGE_LENGTH characters (exluding the '0').
|
||||
* @note The message string is only valid until the scope of
|
||||
* the function is left.
|
||||
*/
|
||||
virtual void OnError(const char* message) = 0;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
@@ -38,16 +38,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file NullLogger.h
|
||||
/** @file NullLogger.h
|
||||
* @brief Dummy logger
|
||||
*/
|
||||
|
||||
#if (!defined AI_NULLLOGGER_H_INCLUDED)
|
||||
#define AI_NULLLOGGER_H_INCLUDED
|
||||
#ifndef INCLUDED_AI_NULLLOGGER_H
|
||||
#define INCLUDED_AI_NULLLOGGER_H
|
||||
|
||||
#include "../include/Logger.h"
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
namespace Assimp {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @class NullLogger
|
||||
@@ -59,25 +59,39 @@ class ASSIMP_API NullLogger : public Logger
|
||||
{
|
||||
public:
|
||||
/** @brief Logs a debug message */
|
||||
void debug(const std::string &message) { (void)message;} //this avoids compiler warnings
|
||||
void OnDebug(const char* message) {
|
||||
(void)message; //this avoids compiler warnings
|
||||
}
|
||||
|
||||
/** @brief Logs an info message */
|
||||
void info(const std::string &message) {(void)message;} //this avoids compiler warnings
|
||||
void OnInfo(const char* message) {
|
||||
(void)message; //this avoids compiler warnings
|
||||
}
|
||||
|
||||
/** @brief Logs a warning message */
|
||||
void warn(const std::string &message) {(void)message;} //this avoids compiler warnings
|
||||
void OnWarn(const char* message) {
|
||||
(void)message; //this avoids compiler warnings
|
||||
}
|
||||
|
||||
/** @brief Logs an error message */
|
||||
void error(const std::string &message) {(void)message;} //this avoids compiler warnings
|
||||
void OnError(const char* message) {
|
||||
(void)message; //this avoids compiler warnings
|
||||
}
|
||||
|
||||
/** @brief Log severity setter */
|
||||
void setLogSeverity(LogSeverity log_severity) {(void)log_severity;} //this avoids compiler warnings
|
||||
void setLogSeverity(LogSeverity log_severity) {
|
||||
(void)log_severity; //this avoids compiler warnings
|
||||
}
|
||||
|
||||
/** @brief Detach a still attached stream from logger */
|
||||
void attachStream(LogStream *pStream, unsigned int severity) {(void)pStream; (void)severity;} //this avoids compiler warnings
|
||||
void attachStream(LogStream *pStream, unsigned int severity) {
|
||||
(void)pStream; (void)severity; //this avoids compiler warnings
|
||||
}
|
||||
|
||||
/** @brief Detach a still attached stream from logger */
|
||||
void detatchStream(LogStream *pStream, unsigned int severity) {(void)pStream; (void)severity;} //this avoids compiler warnings
|
||||
void detatchStream(LogStream *pStream, unsigned int severity) {
|
||||
(void)pStream; (void)severity; //this avoids compiler warnings
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -67,10 +67,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
namespace Assimp {
|
||||
namespace Intern {
|
||||
|
||||
// Internal helper class to utilize our internal new/delete routines
|
||||
// for allocating object of this class. By doing this you can safely
|
||||
// share class objects between Assimp and the application - it works
|
||||
// even over DLL boundaries.
|
||||
/** @brief Internal helper class to utilize our internal new/delete
|
||||
* routines for allocating object of this and derived classes.
|
||||
*
|
||||
* By doing this you can safely share class objects between Assimp
|
||||
* and the application - it works even over DLL boundaries. A good
|
||||
* example is the IOSystem where the application allocates its custom
|
||||
* IOSystem, then calls Importer::SetIOSystem(). When the Importer
|
||||
* destructs, Assimp calls operator delete on the stored IOSystem.
|
||||
* If it lies on a different heap than Assimp is working with,
|
||||
* the application is determined to crash.
|
||||
*/
|
||||
struct ASSIMP_API AllocateFromAssimpHeap {
|
||||
|
||||
// new/delete overload
|
||||
|
||||
@@ -302,21 +302,30 @@ public:
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Reads the given file and returns its contents if successful.
|
||||
*
|
||||
* If the call succeeds, the contents of the file are returned as a
|
||||
* pointer to an aiScene object. The returned data is intended to be
|
||||
* read-only, the importer object keeps ownership of the data and will
|
||||
* destroy it upon destruction. If the import fails, NULL is returned.
|
||||
* A human-readable error description can be retrieved by calling
|
||||
* GetErrorString(). The previous scene will be deleted during this call.
|
||||
* @param pFile Path and filename to the file to be imported.
|
||||
* @param pFlags Optional post processing steps to be executed after
|
||||
* a successful import. Provide a bitwise combination of the
|
||||
* #aiPostProcessSteps flags.
|
||||
* @return A pointer to the imported data, NULL if the import failed.
|
||||
* The pointer to the scene remains in possession of the Importer
|
||||
* instance. Use GetOrphanedScene() to take ownership of it.
|
||||
*/
|
||||
*
|
||||
* If the call succeeds, the contents of the file are returned as a
|
||||
* pointer to an aiScene object. The returned data is intended to be
|
||||
* read-only, the importer object keeps ownership of the data and will
|
||||
* destroy it upon destruction. If the import fails, NULL is returned.
|
||||
* A human-readable error description can be retrieved by calling
|
||||
* GetErrorString(). The previous scene will be deleted during this call.
|
||||
* @param pFile Path and filename to the file to be imported.
|
||||
* @param pFlags Optional post processing steps to be executed after
|
||||
* a successful import. Provide a bitwise combination of the
|
||||
* #aiPostProcessSteps flags.
|
||||
* @return A pointer to the imported data, NULL if the import failed.
|
||||
* The pointer to the scene remains in possession of the Importer
|
||||
* instance. Use GetOrphanedScene() to take ownership of it.
|
||||
*/
|
||||
const aiScene* ReadFile( const char* pFile, unsigned int pFlags);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Reads the given file and returns its contents if successful.
|
||||
*
|
||||
* This function is provided for backward compatibility.
|
||||
* See the const char* version for detailled docs.
|
||||
* @see ReadFile(const char*, pFlags)
|
||||
*/
|
||||
const aiScene* ReadFile( const std::string& pFile, unsigned int pFlags);
|
||||
|
||||
|
||||
@@ -348,6 +357,15 @@ public:
|
||||
* Cases-insensitive.
|
||||
* @return true if the extension is supported, false otherwise
|
||||
*/
|
||||
bool IsExtensionSupported(const char* szExtension);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Returns whether a given file extension is supported by ASSIMP.
|
||||
*
|
||||
* This function is provided for backward compatibility.
|
||||
* See the const char* version for detailled docs.
|
||||
* @see IsExtensionSupported(const char*)
|
||||
*/
|
||||
bool IsExtensionSupported(const std::string& szExtension);
|
||||
|
||||
|
||||
@@ -360,7 +378,16 @@ public:
|
||||
* is a loader which handles such files.
|
||||
* Format of the list: "*.3ds;*.obj;*.dae".
|
||||
*/
|
||||
void GetExtensionList(std::string& szOut);
|
||||
void GetExtensionList(aiString& szOut);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Get a full list of all file extensions supported by ASSIMP.
|
||||
*
|
||||
* This function is provided for backward compatibility.
|
||||
* See the aiString version for detailled docs.
|
||||
* @see GetExtensionList(aiString&)
|
||||
*/
|
||||
inline void GetExtensionList(std::string& szOut);
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
@@ -372,7 +399,7 @@ public:
|
||||
* must include a trailing dot.
|
||||
* @return NULL if there is no loader for the extension.
|
||||
*/
|
||||
BaseImporter* FindLoader (const std::string& szExtension);
|
||||
BaseImporter* FindLoader (const char* szExtension);
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
@@ -449,27 +476,31 @@ protected:
|
||||
SharedPostProcessInfo* mPPShared;
|
||||
}; //! class Importer
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline const std::string& Importer::GetErrorString() const
|
||||
{
|
||||
return mErrorString;
|
||||
}
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline void Importer::SetExtraVerbose(bool bDo)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// For compatibility, the interface of some functions taking a std::string was
|
||||
// changed to const char* to avoid crashes between binary incompatible STL
|
||||
// versions. This code her is inlined, so it shouldn't cause any problems.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
AI_FORCE_INLINE const aiScene* Importer::ReadFile( const std::string& pFile,
|
||||
unsigned int pFlags)
|
||||
{
|
||||
bExtraVerbose = bDo;
|
||||
return ReadFile(pFile.c_str(),pFlags);
|
||||
}
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline const aiScene* Importer::GetScene() const
|
||||
// ----------------------------------------------------------------------------
|
||||
AI_FORCE_INLINE void Importer::GetExtensionList(std::string& szOut)
|
||||
{
|
||||
return mScene;
|
||||
aiString s;
|
||||
GetExtensionList(s);
|
||||
szOut = s.data;
|
||||
}
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline aiScene* Importer::GetOrphanedScene()
|
||||
// ----------------------------------------------------------------------------
|
||||
AI_FORCE_INLINE bool Importer::IsExtensionSupported(
|
||||
const std::string& szExtension)
|
||||
{
|
||||
aiScene* s = mScene;
|
||||
mScene = NULL;
|
||||
return s;
|
||||
return IsExtensionSupported(szExtension.c_str());
|
||||
}
|
||||
|
||||
} // !namespace Assimp
|
||||
|
||||
Reference in New Issue
Block a user