Public includes: add pragma statement and formalize include guard schema.

pull/943/head
Kim Kulling 2016-07-11 20:56:38 +02:00
parent 02602ce9af
commit 9678da72c9
39 changed files with 162 additions and 53 deletions

View File

@ -58,8 +58,8 @@ class DeadlyImportError
{
public:
/** Constructor with arguments */
explicit DeadlyImportError( const std::string& pErrorText)
: runtime_error(pErrorText)
explicit DeadlyImportError( const std::string& errorText)
: runtime_error(errorText)
{
}

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file Exporter.hpp
* @brief Defines the CPP-API for the Assimp export interface
*/
#pragma once
#ifndef AI_EXPORT_HPP_INC
#define AI_EXPORT_HPP_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief File I/O wrappers for C++.
*/
#pragma once
#ifndef AI_IOSTREAM_H_INC
#define AI_IOSTREAM_H_INC

View File

@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* custom file handling logic to the Import library.
*/
#pragma once
#ifndef AI_IOSYSTEM_H_INC
#define AI_IOSYSTEM_H_INC

View File

@ -42,12 +42,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file Importer.hpp
* @brief Defines the C++-API to the Open Asset Import Library.
*/
#ifndef INCLUDED_AI_ASSIMP_HPP
#define INCLUDED_AI_ASSIMP_HPP
#pragma once
#ifndef AI_ASSIMP_HPP_INC
#define AI_ASSIMP_HPP_INC
#ifndef __cplusplus
# error This header requires C++ to be used. Use assimp.h for plain C.
#endif
#endif // __cplusplus
// Public ASSIMP data structures
#include "types.h"
@ -658,4 +659,5 @@ AI_FORCE_INLINE bool Importer::IsExtensionSupported(const std::string& szExtensi
}
} // !namespace Assimp
#endif // INCLUDED_AI_ASSIMP_HPP
#endif // AI_ASSIMP_HPP_INC

View File

@ -41,9 +41,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file ProgressHandler.hpp
* @brief Abstract base class 'ProgressHandler'.
*/
#ifndef INCLUDED_AI_PROGRESSHANDLER_H
#define INCLUDED_AI_PROGRESSHANDLER_H
#pragma once
#ifndef AI_PROGRESSHANDLER_H_INC
#define AI_PROGRESSHANDLER_H_INC
#include "types.h"
namespace Assimp {
// ------------------------------------------------------------------------------------
@ -119,4 +122,4 @@ public:
// ------------------------------------------------------------------------------------
} // Namespace Assimp
#endif
#endif // AI_PROGRESSHANDLER_H_INC

View File

@ -38,15 +38,15 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
#ifndef AI_DEBUG_H_INC
#define AI_DEBUG_H_INC
#pragma once
#ifndef AI_ASSERT_H_INC
#define AI_ASSERT_H_INC
#ifdef ASSIMP_BUILD_DEBUG
# include <assert.h>
# define ai_assert(expression) assert(expression)
#else
# define ai_assert(expression)
#endif
#endif //
#endif
#endif // AI_ASSERT_H_INC

View File

@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Defines the data structures in which the imported animations
* are returned.
*/
#pragma once
#ifndef AI_ANIM_H_INC
#define AI_ANIM_H_INC

View File

@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Defines the aiCamera data structure
*/
#pragma once
#ifndef AI_CAMERA_H_INC
#define AI_CAMERA_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file cexport.h
* @brief Defines the C-API for the Assimp export interface
*/
#pragma once
#ifndef AI_EXPORT_H_INC
#define AI_EXPORT_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file cfileio.h
* @brief Defines generic C routines to access memory-mapped files
*/
#pragma once
#ifndef AI_FILEIO_H_INC
#define AI_FILEIO_H_INC

View File

@ -42,8 +42,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file cimport.h
* @brief Defines the C-API to the Open Asset Import Library.
*/
#pragma once
#ifndef AI_ASSIMP_H_INC
#define AI_ASSIMP_H_INC
#include "types.h"
#include "importerdesc.h"

View File

@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file color4.h
* @brief RGBA color structure, including operators when compiling in C++
*/
#pragma once
#ifndef AI_COLOR4D_H_INC
#define AI_COLOR4D_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file color4.inl
* @brief Inline implementation of aiColor4t<TReal> operators
*/
#pragma once
#ifndef AI_COLOR4D_INL_INC
#define AI_COLOR4D_INL_INC

View File

@ -55,8 +55,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* #aiSetImportPropertyFloat,
* #aiSetImportPropertyString
*/
#ifndef INCLUDED_AI_CONFIG_H
#define INCLUDED_AI_CONFIG_H
#pragma once
#ifndef AI_CONFIG_H_INC
#define AI_CONFIG_H_INC
// ###########################################################################

View File

@ -44,8 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* blocks to find out how to customize _your_ Assimp build.
*/
#ifndef INCLUDED_AI_DEFINES_H
#define INCLUDED_AI_DEFINES_H
#pragma once
#ifndef AI_DEFINES_H_INC
#define AI_DEFINES_H_INC
//////////////////////////////////////////////////////////////////////////
/* Define ASSIMP_BUILD_NO_XX_IMPORTER to disable a specific
@ -269,4 +270,4 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type))
#endif // !! INCLUDED_AI_DEFINES_H
#endif // !! AI_DEFINES_H_INC

View File

@ -42,8 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file importerdesc.h
* @brief #aiImporterFlags, aiImporterDesc implementation.
*/
#ifndef INCLUDED_AI_IMPORTER_DESC_H
#define INCLUDED_AI_IMPORTER_DESC_H
#pragma once
#ifndef AI_IMPORTER_DESC_H_INC
#define AI_IMPORTER_DESC_H_INC
/** Mixed set of flags for #aiImporterDesc, indicating some features
@ -140,4 +141,4 @@ Will return a NULL-pointer if no assigned importer desc. was found for the given
*/
ASSIMP_API const C_STRUCT aiImporterDesc* aiGetImporterDesc( const char *extension );
#endif
#endif // AI_IMPORTER_DESC_H_INC

View File

@ -43,8 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Defines the aiLight data structure
*/
#ifndef __AI_LIGHT_H_INC__
#define __AI_LIGHT_H_INC__
#pragma once
#ifndef AI_LIGHT_H_INC
#define AI_LIGHT_H_INC
#include "types.h"
@ -250,7 +251,7 @@ struct aiLight
#ifdef __cplusplus
}
#endif
#endif
#endif // !! __AI_LIGHT_H_INC__
#endif // !! AI_LIGHT_H_INC

View File

@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file material.h
* @brief Defines the material system of the library
*/
#pragma once
#ifndef AI_MATERIAL_H_INC
#define AI_MATERIAL_H_INC

View File

@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Defines the C++ getters for the material system
*/
#pragma once
#ifndef AI_MATERIAL_INL_INC
#define AI_MATERIAL_INL_INC

View File

@ -42,8 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file matrix3x3.h
* @brief Definition of a 3x3 matrix, including operators when compiling in C++
*/
#ifndef AI_MATRIX3x3_H_INC
#define AI_MATRIX3x3_H_INC
#pragma once
#ifndef AI_MATRIX3X3_H_INC
#define AI_MATRIX3X3_H_INC
#include "./Compiler/pushpack1.h"
@ -179,4 +180,4 @@ struct aiMatrix3x3 {
#include "./Compiler/poppack1.h"
#endif // AI_MATRIX3x3_H_INC
#endif // AI_MATRIX3X3_H_INC

View File

@ -42,8 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file matrix3x3.inl
* @brief Inline implementation of the 3x3 matrix operators
*/
#ifndef AI_MATRIX3x3_INL_INC
#define AI_MATRIX3x3_INL_INC
#pragma once
#ifndef AI_MATRIX3X3_INL_INC
#define AI_MATRIX3X3_INL_INC
#ifdef __cplusplus
#include "matrix3x3.h"
@ -333,4 +334,4 @@ inline aiMatrix3x3t<TReal>& aiMatrix3x3t<TReal>::FromToMatrix(const aiVector3t<T
#endif // __cplusplus
#endif // AI_MATRIX3x3_INL_INC
#endif // AI_MATRIX3X3_INL_INC

View File

@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file matrix4x4.h
* @brief 4x4 matrix structure, including operators when compiling in C++
*/
#pragma once
#ifndef AI_MATRIX4X4_H_INC
#define AI_MATRIX4X4_H_INC

View File

@ -42,8 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file matrix4x4.inl
* @brief Inline implementation of the 4x4 matrix operators
*/
#ifndef AI_MATRIX4x4_INL_INC
#define AI_MATRIX4x4_INL_INC
#pragma once
#ifndef AI_MATRIX4X4_INL_INC
#define AI_MATRIX4X4_INL_INC
#ifdef __cplusplus
@ -538,4 +539,4 @@ inline aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::FromToMatrix(const aiVector3t<T
}
#endif // __cplusplus
#endif // AI_MATRIX4x4_INL_INC
#endif // AI_MATRIX4X4_INL_INC

View File

@ -43,8 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Declares the data structures in which the imported geometry is
returned by ASSIMP: aiMesh, aiFace and aiBone data structures.
*/
#ifndef INCLUDED_AI_MESH_H
#define INCLUDED_AI_MESH_H
#pragma once
#ifndef AI_MESH_H_INC
#define AI_MESH_H_INC
#include "types.h"
@ -736,5 +737,5 @@ struct aiMesh
#ifdef __cplusplus
}
#endif //! extern "C"
#endif // __AI_MESH_H_INC
#endif // AI_MESH_H_INC

View File

@ -42,8 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file metadata.h
* @brief Defines the data structures for holding node meta information.
*/
#ifndef __AI_METADATA_H_INC__
#define __AI_METADATA_H_INC__
#pragma once
#ifndef AI_METADATA_H_INC
#define AI_METADATA_H_INC
#include <assert.h>
@ -246,6 +247,6 @@ struct aiMetadata
};
#endif // __AI_METADATA_H_INC__
#endif // AI_METADATA_H_INC

View File

@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file postprocess.h
* @brief Definitions for import post processing steps
*/
#pragma once
#ifndef AI_POSTPROCESS_H_INC
#define AI_POSTPROCESS_H_INC

View File

@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file quaternion.h
* @brief Quaternion structure, including operators when compiling in C++
*/
#pragma once
#ifndef AI_QUATERNION_H_INC
#define AI_QUATERNION_H_INC
@ -122,5 +123,4 @@ struct aiQuaternion {
#endif
#endif // AI_QUATERNION_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file quaternion.inl
* @brief Inline implementation of aiQuaterniont<TReal> operators
*/
#pragma once
#ifndef AI_QUATERNION_INL_INC
#define AI_QUATERNION_INL_INC
@ -280,4 +281,4 @@ inline aiVector3t<TReal> aiQuaterniont<TReal>::Rotate (const aiVector3t<TReal>&
}
#endif
#endif
#endif // AI_QUATERNION_INL_INC

View File

@ -38,12 +38,14 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
#pragma once
/** @file scene.h
* @brief Defines the data structures in which the imported scene is returned.
*/
#ifndef __AI_SCENE_H_INC__
#define __AI_SCENE_H_INC__
#pragma once
#ifndef AI_SCENE_H_INC
#define AI_SCENE_H_INC
#include "types.h"
#include "texture.h"
@ -425,4 +427,4 @@ struct aiScene
} //! namespace Assimp
#endif
#endif // __AI_SCENE_H_INC__
#endif // AI_SCENE_H_INC

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* pixels, and "compressed" textures, which are stored in a file format
* such as PNG or TGA.
*/
#pragma once
#ifndef AI_TEXTURE_H_INC
#define AI_TEXTURE_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file types.h
* Basic data types and primitives, such as vectors or colors.
*/
#pragma once
#ifndef AI_TYPES_H_INC
#define AI_TYPES_H_INC
@ -512,4 +513,5 @@ struct aiMemoryInfo
#include "quaternion.inl"
#include "matrix3x3.inl"
#include "matrix4x4.inl"
#endif
#endif // AI_TYPES_H_INC

View File

@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file vector2.h
* @brief 2D vector structure, including operators when compiling in C++
*/
#pragma once
#ifndef AI_VECTOR2D_H_INC
#define AI_VECTOR2D_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file vector2.inl
* @brief Inline implementation of aiVector2t<TReal> operators
*/
#pragma once
#ifndef AI_VECTOR2D_INL_INC
#define AI_VECTOR2D_INL_INC
@ -221,4 +222,5 @@ inline aiVector2t<TReal> operator - ( const aiVector2t<TReal>& v)
}
#endif
#endif
#endif // AI_VECTOR2D_INL_INC

View File

@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file vector3.h
* @brief 3D vector structure, including operators when compiling in C++
*/
#pragma once
#ifndef AI_VECTOR3D_H_INC
#define AI_VECTOR3D_H_INC

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file vector3.inl
* @brief Inline implementation of aiVector3t<TReal> operators
*/
#pragma once
#ifndef AI_VECTOR3D_INL_INC
#define AI_VECTOR3D_INL_INC

View File

@ -43,8 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Functions to query the version of the Assimp runtime, check
* compile flags, ...
*/
#ifndef INCLUDED_AI_VERSION_H
#define INCLUDED_AI_VERSION_H
#pragma once
#ifndef AI_VERSION_H_INC
#define AI_VERSION_H_INC
#include "defs.h"
@ -102,4 +103,4 @@ ASSIMP_API unsigned int aiGetCompileFlags (void);
} // end extern "C"
#endif
#endif // !! #ifndef INCLUDED_AI_VERSION_H
#endif // !! #ifndef AI_VERSION_H_INC

View File

@ -85,6 +85,7 @@ SET( TEST_SRCS
unit/utTextureTransform.cpp
unit/utTriangulate.cpp
unit/utVertexTriangleAdjacency.cpp
unit/utVersion.cpp
)
SOURCE_GROUP( tests FILES ${TEST_SRCS} )

View File

@ -0,0 +1,69 @@
/*-------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2016, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------*/
#include "UnitTestPCH.h"
#include <assimp/version.h>
class utVersion : public ::testing::Test {
// empty
};
TEST_F( utVersion, aiGetLegalStringTest ) {
const char *lv( aiGetLegalString() );
EXPECT_NE( lv, nullptr );
std::string text( lv );
size_t pos( text.find( std::string( "2016" ) ) );
EXPECT_NE( pos, std::string::npos );
}
TEST_F( utVersion, aiGetVersionMinorTest ) {
EXPECT_EQ( aiGetVersionMinor(), 3 );
}
TEST_F( utVersion, aiGetVersionMajorTest ) {
EXPECT_EQ( aiGetVersionMajor(), 3 );
}
TEST_F( utVersion, aiGetCompileFlagsTest ) {
EXPECT_NE( aiGetCompileFlags(), 0 );
}
TEST_F( utVersion, aiGetVersionRevisionTest ) {
EXPECT_NE( aiGetVersionRevision(), 0 );
}