Ver código fonte

refactor & fix: 修复MSVC编译错误

SongZihuan 3 anos atrás
pai
commit
24dbc9cb2c
2 arquivos alterados com 6 adições e 9 exclusões
  1. 5 8
      include/tool/tool-regex.h
  2. 1 1
      include/tool/tool-regex.inline.h

+ 5 - 8
include/tool/tool-regex.h

@@ -1,17 +1,14 @@
-#ifndef AFUN_REGEX
-#define AFUN_REGEX
-#include "aFunToolExport.h"
+#ifndef AFUN_TOOL_REGEX
+#define AFUN_TOOL_REGEX
 #include <regex>
 
 namespace aFuntool {
-    const int REGEX_ERROR_SIZE = 512;
-
-    class AFUN_TOOL_EXPORT Regex {
+    class Regex {  // 整个对象都是inline的, 不需要Export符号
         std::regex re;  // 正则表达式
         std::string pattern;  // 正则表达式的字符串
     public:
         inline explicit Regex(std::string pattern_);
-        inline Regex(const Regex &regex);
+        inline Regex(const Regex &regex) noexcept;
         inline Regex(Regex &&regex) noexcept;
         Regex &operator=(const Regex &regex)=delete;
         Regex &operator=(Regex &&regex)=delete;
@@ -23,4 +20,4 @@ namespace aFuntool {
 
 #include "tool-regex.inline.h"
 
-#endif //AFUN_REGEX
+#endif //AFUN_TOOL_REGEX

+ 1 - 1
include/tool/tool-regex.inline.h

@@ -9,7 +9,7 @@ namespace aFuntool {
             throw RegexException("Pattern not utf-8");
     }
 
-    inline Regex::Regex(const Regex &regex) : re{regex.pattern}, pattern{regex.pattern}{
+    inline Regex::Regex(const Regex &regex) noexcept: re{regex.pattern}, pattern{regex.pattern}{
 
     }