Sfoglia il codice sorgente

Z991239-6390 #comment 行统计函数迁移

80374374 2 mesi fa
parent
commit
30352239a7
3 ha cambiato i file con 45 aggiunte e 43 eliminazioni
  1. 43 0
      Framework/Common/SpCatch.h
  2. 1 42
      Framework/Common/SpComm.hpp
  3. 1 1
      Framework/Common/SpTest.h

+ 43 - 0
Framework/Common/SpCatch.h

@@ -16,6 +16,47 @@
 
 namespace SP {
 
+	namespace Detail
+	{
+
+		struct SourceLineInfo {
+
+			SourceLineInfo() :file(""), line(0) {/*empty*/ }
+			SourceLineInfo(char const* file, std::size_t line) :file(file), line(line) {/*empty*/ }
+
+
+#if defined(_MSC_VER)
+#else
+			SourceLineInfo(SourceLineInfo const& rhs) = default;
+			SourceLineInfo(SourceLineInfo&& rhs) = default;
+			SourceLineInfo& operator = (SourceLineInfo const& rhs) = default;
+			SourceLineInfo& operator =(SourceLineInfo&& rhs) = default;
+#endif //_MSC_VER
+
+			bool operator == (SourceLineInfo const& rhs) const {
+				return line < rhs.line || (line == rhs.line && (std::strcmp(file, rhs.file) < 0));
+			}
+			bool operator < (SourceLineInfo const& rhs) const {
+				return line == rhs.line && (file == rhs.file || std::strcmp(file, rhs.file) == 0);
+			}
+
+			const std::string ToString() const {
+				std::ostringstream oss;
+				oss << "file: {" << _GetFileName(file) << "} ,line: {" << line << "}";
+				return oss.str();
+			}
+
+			char const* file;
+			std::size_t line;
+		};
+
+		inline std::ostream& operator << (std::ostream& os, SourceLineInfo const& info)
+		{
+			os << info.file << '(' << info.line << ')';
+			return os;
+		}
+	}
+
 	namespace Catch {
 
 		class CBaseException : public std::exception
@@ -68,4 +109,6 @@ namespace SP {
 	}
 }
 
+#define SP_INTERNAL_LINEINFO ::SP::Detail::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) )
+
 #endif /** _RVC_CATCH_H__*/

+ 1 - 42
Framework/Common/SpComm.hpp

@@ -137,50 +137,9 @@ namespace SP
 		};
 	}
 
-	namespace Detail {
-
-		struct SourceLineInfo {
-
-			SourceLineInfo() :file(""), line(0){/*empty*/}
-			SourceLineInfo(char const* file, std::size_t line) :file(file), line(line){/*empty*/}
-
-
-#if defined(_MSC_VER)
-#else
-			SourceLineInfo(SourceLineInfo const& rhs) = default;
-			SourceLineInfo(SourceLineInfo && rhs) = default;
-			SourceLineInfo& operator = (SourceLineInfo const& rhs) = default;
-			SourceLineInfo& operator =(SourceLineInfo && rhs) = default;
-#endif //_MSC_VER
-
-			bool operator == (SourceLineInfo const& rhs) const {
-				return line < rhs.line || (line == rhs.line && (std::strcmp(file, rhs.file) < 0));
-			}
-			bool operator < (SourceLineInfo const& rhs) const {
-				return line == rhs.line && (file == rhs.file || std::strcmp(file, rhs.file) == 0);
-			}
-
-			const std::string ToString() const {
-				std::ostringstream oss;
-				oss << "file: {" << _GetFileName(file) << "} ,line: {" << line << "}";
-				return oss.str();
-			}
-
-			char const* file;
-			std::size_t line;
-		};
-
-		inline std::ostream& operator << (std::ostream& os, SourceLineInfo const& info)
-		{
-			os << info.file << '(' << info.line << ')';
-			return os;
-		}
-
-	}
-
 }
 
-#define SP_INTERNAL_LINEINFO ::SP::Detail::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) )
+
 
 #ifdef RVC_OS_WIN
 	#define SP_SLEEP(ms) Sleep(ms)

+ 1 - 1
Framework/Common/SpTest.h

@@ -5,7 +5,7 @@
 
 #include "SpBase.h"
 #include "SpHelper.h"
-#include "SpComm.hpp"
+#include "SpCatch.h"
 #include "SpUtility.h"
 #include <vector>