Merge pull request #677 from turol/explicit-constructors

Mark single-parameter constructors explicit
pull/682/head
Alexander Gessler 2015-10-29 13:55:17 +01:00
commit 4fb7e3a779
32 changed files with 43 additions and 43 deletions

View File

@ -138,7 +138,7 @@ struct Bone
}
//! Construction from an existing name
Bone( const std::string& name)
explicit Bone( const std::string& name)
: mName (name)
{}
@ -216,7 +216,7 @@ struct BaseNode
enum Type {Light, Camera, Mesh, Dummy} mType;
//! Constructor. Creates a default name for the node
BaseNode(Type _mType)
explicit BaseNode(Type _mType)
: mType (_mType)
, mProcessed (false)
{

View File

@ -110,7 +110,7 @@ static boost::mutex gLogStreamMutex;
class LogToCallbackRedirector : public LogStream
{
public:
LogToCallbackRedirector(const aiLogStream& s)
explicit LogToCallbackRedirector(const aiLogStream& s)
: stream (s) {
ai_assert(NULL != s.callback);
}

View File

@ -83,7 +83,7 @@ class BVHLoader : public BaseImporter
std::vector<float> mChannelValues; // motion data values for that node. Of size NumChannels * NumFrames
Node() { }
Node( const aiNode* pNode) : mNode( pNode) { }
explicit Node( const aiNode* pNode) : mNode( pNode) { }
};
public:

View File

@ -70,7 +70,7 @@ class IOStream;
template <typename T>
struct ScopeGuard
{
ScopeGuard(T* obj) : obj(obj), mdismiss() {}
explicit ScopeGuard(T* obj) : obj(obj), mdismiss() {}
~ScopeGuard () throw() {
if (!mdismiss) {
delete obj;

View File

@ -74,7 +74,7 @@ public:
template <typename T>
struct THeapData : public Base
{
THeapData(T* in)
explicit THeapData(T* in)
: data (in)
{}
@ -89,7 +89,7 @@ public:
template <typename T>
struct TStaticData : public Base
{
TStaticData(T in)
explicit TStaticData(T in)
: data (in)
{}

View File

@ -57,7 +57,7 @@ class CIOStreamWrapper : public IOStream
friend class CIOSystemWrapper;
public:
CIOStreamWrapper(aiFile* pFile)
explicit CIOStreamWrapper(aiFile* pFile)
: mFile(pFile)
{}
@ -110,7 +110,7 @@ private:
class CIOSystemWrapper : public IOSystem
{
public:
CIOSystemWrapper(aiFileIO* pFile)
explicit CIOSystemWrapper(aiFileIO* pFile)
: mFileSystem(pFile)
{}

View File

@ -125,7 +125,7 @@ private:
// temporary structure to describe a mapping
struct MappingInfo
{
MappingInfo(aiTextureMapping _type)
explicit MappingInfo(aiTextureMapping _type)
: type (_type)
, axis (0.f,1.f,0.f)
, uv (0u)

View File

@ -87,7 +87,7 @@ class TypedProperty : public Property
{
public:
TypedProperty(const T& value)
explicit TypedProperty(const T& value)
: value(value)
{
}

View File

@ -113,7 +113,7 @@ private:
} type;
Animator(AT t = UNKNOWN)
explicit Animator(AT t = UNKNOWN)
: type (t)
, speed (0.001f)
, direction (0.f,1.f,0.f)
@ -163,7 +163,7 @@ private:
ANIMMESH
} type;
Node(ET t)
explicit Node(ET t)
: type (t)
, scaling (1.f,1.f,1.f) // assume uniform scaling by default
, parent()

View File

@ -167,7 +167,7 @@ public:
// -------------------------------------------------------------------
/** Construct a batch loader from a given IO system to be used
* to acess external files */
BatchLoader(IOSystem* pIO);
explicit BatchLoader(IOSystem* pIO);
~BatchLoader();

View File

@ -269,7 +269,7 @@ struct Face : public aiFace
{}
//! Construction from given type
Face(uint32_t _type)
explicit Face(uint32_t _type)
: surfaceIndex (0)
, smoothGroup (0)
, type (_type)
@ -305,7 +305,7 @@ struct Face : public aiFace
*/
struct VMapEntry
{
VMapEntry(unsigned int _dims)
explicit VMapEntry(unsigned int _dims)
: dims(_dims)
{}

View File

@ -280,7 +280,7 @@ public:
*
* @param mSections List of file sections (output of MD5Parser)
*/
MD5MeshParser(SectionList& mSections);
explicit MD5MeshParser(SectionList& mSections);
//! List of all meshes
MeshList mMeshes;
@ -305,7 +305,7 @@ public:
*
* @param mSections List of file sections (output of MD5Parser)
*/
MD5AnimParser(SectionList& mSections);
explicit MD5AnimParser(SectionList& mSections);
//! Output frame rate
@ -337,7 +337,7 @@ public:
*
* @param mSections List of file sections (output of MD5Parser)
*/
MD5CameraParser(SectionList& mSections);
explicit MD5CameraParser(SectionList& mSections);
//! Output frame rate

View File

@ -242,7 +242,7 @@ struct Mesh {
bool m_hasNormals;
/// Constructor
Mesh( const std::string &name )
explicit Mesh( const std::string &name )
: m_name( name )
, m_pMaterial(NULL)
, m_uiNumIndices(0)

View File

@ -381,8 +381,8 @@ typedef std::vector<VertexAnimationTrack> VertexAnimationTrackList;
class Animation
{
public:
Animation(Skeleton *parent);
Animation(Mesh *parent);
explicit Animation(Skeleton *parent);
explicit Animation(Mesh *parent);
/// Returns the associated vertex data for a track in this animation.
/** @note Only valid to call when parent Mesh is set. */

View File

@ -69,7 +69,7 @@ public:
static bool ImportSkeleton(Assimp::IOSystem *pIOHandler, Mesh *mesh);
private:
OgreXmlSerializer(XmlReader *reader) :
explicit OgreXmlSerializer(XmlReader *reader) :
m_reader(reader)
{
}

View File

@ -90,7 +90,7 @@ class ZipFile : public IOStream {
public:
ZipFile(size_t size);
explicit ZipFile(size_t size);
~ZipFile();

View File

@ -103,7 +103,7 @@ private:
struct Face
{
Face(unsigned int s)
explicit Face(unsigned int s)
: indices (s)
, uvindices (s)
, mat (0)

View File

@ -88,7 +88,7 @@ private:
struct MeshInformation
{
MeshInformation(const std::string& _name)
explicit MeshInformation(const std::string& _name)
: name(_name)
{
vertices.reserve(100);
@ -103,7 +103,7 @@ private:
struct GroupInformation
{
GroupInformation(const std::string& _name)
explicit GroupInformation(const std::string& _name)
: name(_name)
{
meshes.reserve(10);

View File

@ -66,7 +66,7 @@ public:
/** Construction from a given face array, handling smoothing groups
* properly
*/
SGSpatialSort(const std::vector<aiVector3D>& vPositions);
explicit SGSpatialSort(const std::vector<aiVector3D>& vPositions);
// -------------------------------------------------------------------
/** Add a vertex to the spatial sort

View File

@ -166,7 +166,7 @@ struct SceneHelper
id[0] = 0;
}
SceneHelper (aiScene* _scene)
explicit SceneHelper (aiScene* _scene)
: scene (_scene)
, idlen (0)
{

View File

@ -16,7 +16,7 @@ public:
/** @brief Construction from an existing std::ostream
* @param _ostream Output stream to be used
*/
StdOStreamLogStream(std::ostream& _ostream);
explicit StdOStreamLogStream(std::ostream& _ostream);
/** @brief Destructor */
~StdOStreamLogStream();

View File

@ -97,7 +97,7 @@ public:
// being bound to const ref& function parameters. Copying streams is not permitted, though.
// This workaround avoids this by manually specifying a copy ctor.
#if !defined(__GNUC__) || !defined(__APPLE__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
basic_formatter(const basic_formatter& other) {
explicit basic_formatter(const basic_formatter& other) {
underlying << (string)other;
}
#endif

View File

@ -87,7 +87,7 @@ struct TempMat {
, numFaces (0)
{}
TempMat(const Triangle& in)
explicit TempMat(const Triangle& in)
: type ((Unreal::MeshFlags)in.mType)
, tex (in.mTextureNum)
, numFaces (0)

View File

@ -129,7 +129,7 @@ struct Mesh
std::vector<Bone> mBones;
Mesh(const std::string &pName = "") { mName = pName; mNumTextures = 0; mNumColorSets = 0; }
explicit Mesh(const std::string &pName = "") { mName = pName; mNumTextures = 0; mNumColorSets = 0; }
};
/** Helper structure to represent a XFile frame */
@ -142,7 +142,7 @@ struct Node
std::vector<Mesh*> mMeshes;
Node() { mParent = NULL; }
Node( Node* pParent) { mParent = pParent; }
explicit Node( Node* pParent) { mParent = pParent; }
~Node()
{
for( unsigned int a = 0; a < mChildren.size(); a++)

View File

@ -68,7 +68,7 @@ public:
/** Constructor. Creates a data structure out of the XFile given in the memory block.
* @param pBuffer Null-terminated memory buffer containing the XFile
*/
XFileParser( const std::vector<char>& pBuffer);
explicit XFileParser( const std::vector<char>& pBuffer);
/** Destructor. Destroys all imported data along with it */
~XFileParser();

View File

@ -76,7 +76,7 @@ public:
// ----------------------------------------------------------------------------------
//! Construction from an existing IOStream
CIrrXML_IOStreamReader(IOStream* _stream)
explicit CIrrXML_IOStreamReader(IOStream* _stream)
: stream (_stream)
, t (0)
{

View File

@ -135,7 +135,7 @@ private:
// ----------------------------------------------------------------------
/** @briefPrivate construction for internal use by create().
* @param severity Logging granularity */
DefaultLogger(LogSeverity severity);
explicit DefaultLogger(LogSeverity severity);
// ----------------------------------------------------------------------
/** @briefDestructor */

View File

@ -160,7 +160,7 @@ protected:
Logger();
/** Construction with a given log severity */
Logger(LogSeverity severity);
explicit Logger(LogSeverity severity);
// ----------------------------------------------------------------------
/** @brief Called as a request to write a specific debug message

View File

@ -59,7 +59,7 @@ public:
aiColor4t () : r(), g(), b(), a() {}
aiColor4t (TReal _r, TReal _g, TReal _b, TReal _a)
: r(_r), g(_g), b(_b), a(_a) {}
aiColor4t (TReal _r) : r(_r), g(_r), b(_r), a(_r) {}
explicit aiColor4t (TReal _r) : r(_r), g(_r), b(_r), a(_r) {}
aiColor4t (const aiColor4t& o)
: r(o.r), g(o.g), b(o.b), a(o.a) {}

View File

@ -60,7 +60,7 @@ public:
: w(pw), x(px), y(py), z(pz) {}
/** Construct from rotation matrix. Result is undefined if the matrix is not orthonormal. */
aiQuaterniont( const aiMatrix3x3t<TReal>& pRotMatrix);
explicit aiQuaterniont( const aiMatrix3x3t<TReal>& pRotMatrix);
/** Construct from euler angles */
aiQuaterniont( TReal rotx, TReal roty, TReal rotz);
@ -69,7 +69,7 @@ public:
aiQuaterniont( aiVector3t<TReal> axis, TReal angle);
/** Construct from a normalized quaternion stored in a vec3 */
aiQuaterniont( aiVector3t<TReal> normalized);
explicit aiQuaterniont( aiVector3t<TReal> normalized);
/** Returns a matrix representation of the quaternion */
aiMatrix3x3t<TReal> GetMatrix() const;

View File

@ -135,7 +135,7 @@ struct aiNode
/** Construction from a specific name */
aiNode(const std::string& name)
explicit aiNode(const std::string& name)
// set all members to zero by default
: mName(name)
, mParent(NULL)

View File

@ -160,7 +160,7 @@ struct aiColor3D
#ifdef __cplusplus
aiColor3D () : r(0.0f), g(0.0f), b(0.0f) {}
aiColor3D (float _r, float _g, float _b) : r(_r), g(_g), b(_b) {}
aiColor3D (float _r) : r(_r), g(_r), b(_r) {}
explicit aiColor3D (float _r) : r(_r), g(_r), b(_r) {}
aiColor3D (const aiColor3D& o) : r(o.r), g(o.g), b(o.b) {}
/** Component-wise comparison */