ソースを参照

- IFC: directly keep a pointer to the class name in STEP::Object. This avoid hacking around with typeid().name(), which yields platform-dependent results.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@992 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
aramis_acg 14 年 前
コミット
95e0148f95
5 ファイル変更166 行追加167 行削除
  1. 1 1
      code/IFCLoader.cpp
  2. 159 159
      code/IFCReaderGen.h
  3. 4 5
      code/STEPFile.h
  4. 1 1
      scripts/IFCImporter/CppGenerator.py
  5. 1 1
      workspaces/vc9/assimp.vcproj

+ 1 - 1
code/IFCLoader.cpp

@@ -287,7 +287,7 @@ void IFCImporter::InternReadFile( const std::string& pFile,
 		conv.materials.clear();
 	}
 
-	// apply world coordinate system (which includes the scaling to convert to metres and a -90 degrees rotation around x)
+	// apply world coordinate system (which includes the scaling to convert to meters and a -90 degrees rotation around x)
 	aiMatrix4x4 scale, rot;
 	aiMatrix4x4::Scaling(aiVector3D(conv.len_scale,conv.len_scale,conv.len_scale),scale);
 	aiMatrix4x4::RotationX(-AI_MATH_HALF_PI_F,rot);

ファイルの差分が大きいため隠しています
+ 159 - 159
code/IFCReaderGen.h


+ 4 - 5
code/STEPFile.h

@@ -431,6 +431,8 @@ namespace STEP {
 	public:
 
 		virtual ~Object() {}
+		Object(const char* classname = "unknown")
+			: classname(classname) {}
 
 	public:
 
@@ -463,11 +465,7 @@ namespace STEP {
 		}
 
 		std::string GetClassName() const {
-			// XXX this relies on unspecified behaviour - we hijack the name() field of std::type_info
-			// known to work as intended for only msvc 8, with gcc 4.5 it produces reasonable, but
-			// not totally unmangled output - we definitely need a traits-based solution here.
-			const char* s = typeid(*this).name(), *s2 = strstr(s,"Ifc");
-			return std::string(s2?s2:s);
+			return classname;
 		}
 
 		void SetID(uint64_t newval) {
@@ -476,6 +474,7 @@ namespace STEP {
 
 	private:
 		uint64_t id;
+		const char* const classname;
 	};
 
 

+ 1 - 1
scripts/IFCImporter/CppGenerator.py

@@ -55,7 +55,7 @@ template_entity_predef_ni = '\ttypedef NotImplemented {entity}; // (not currentl
 template_entity = r"""
 
     // C++ wrapper for {entity}
-    struct {entity} : {parent} ObjectHelper<{entity},{argcnt}> {{
+    struct {entity} : {parent} ObjectHelper<{entity},{argcnt}> {{ {entity}() : Object("{entity}") {{}}
 {fields}
     }};"""
 

+ 1 - 1
workspaces/vc9/assimp.vcproj

@@ -1943,7 +1943,7 @@
 					</File>
 				</Filter>
 				<Filter
-					Name="icf"
+					Name="ifc"
 					>
 					<File
 						RelativePath="..\..\code\IFCLoader.cpp"

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません