Initiual commit: AssetImporter source moved from ZFXCE repository to its own repository. PLease do not use the ZFXCE repo any more.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
kimmi
2008-05-05 12:36:31 +00:00
commit b76f999cb7
131 changed files with 24989 additions and 0 deletions

56
code/ObjTools.h Normal file
View File

@@ -0,0 +1,56 @@
/** @file ObjTools.h
* @brief Some helpful templates for text parsing
*/
#ifndef OBJ_TOOLS_H_INC
#define OBJ_TOOLS_H_INC
namespace Assimp
{
/** @brief Returns true, if token is a space on any supported platform
* @param token Token to search in
* @return true, if token is a space
*/
inline bool isSpace(char token)
{
return (token == ' ' || token == '\n' || token == '\f' || token == '\r' ||
token == '\t');
}
/** @brief Returns next word separated by a space
* @param pBuffer Pointer to data buffer
* @param pEnd Pointer to end of buffer
* @return Pointer to next space
*/
template<class Char_T>
inline Char_T getNextWord(Char_T pBuffer, Char_T pEnd)
{
while (pBuffer != pEnd)
{
if (!isSpace(*pBuffer))
break;
pBuffer++;
}
return pBuffer;
}
/** @brief Returns ponter a next token
* @param pBuffer Pointer to data buffer
* @param pEnd Pointer to end of buffer
* @return Pointer to next token
*/
template<class Char_T>
inline Char_T getNextToken(Char_T pBuffer, Char_T pEnd)
{
while (pBuffer != pEnd)
{
if (isSpace(*pBuffer))
break;
pBuffer++;
}
return getNextWord(pBuffer, pEnd);
}
} // Namespace Assimp
#endif