Sfoglia il codice sorgente

refactor: tool模块提出inline和template

SongZihuan 3 anni fa
parent
commit
20edb4bd5d

+ 1 - 1
include/tool/aFuntool.h

@@ -7,7 +7,7 @@
 #ifndef AFUN_AFUNTOOL_H
 #ifndef AFUN_AFUNTOOL_H
 #define AFUN_AFUNTOOL_H
 #define AFUN_AFUNTOOL_H
 
 
-#include "macro.h"
+#include "tool.h"
 #include "aFunToolExport.h"
 #include "aFunToolExport.h"
 
 
 #include "pthread.h"
 #include "pthread.h"

+ 4 - 64
include/tool/dlc.h

@@ -56,12 +56,7 @@ namespace aFuntool {
          * @return 符号
          * @return 符号
          */
          */
         template<typename SYMBOL>
         template<typename SYMBOL>
-        DlcSymbol<SYMBOL> *get_symbol(const std::string &name) {
-            auto symbol = (SYMBOL *)dlsym(handle, name.c_str());
-            if (symbol == nullptr)
-                return nullptr;
-            return new DlcSymbol<SYMBOL>(symbol, this);
-        }
+        DlcSymbol<SYMBOL> *get_symbol(const std::string &name);
 
 
         /**
         /**
          * 关闭动态库句柄
          * 关闭动态库句柄
@@ -71,64 +66,9 @@ namespace aFuntool {
         int operator--(int);
         int operator--(int);
     };
     };
 
 
-    /**
-     * 符号句柄
-     * 注意: 不适用符号后需要 delete
-     * @tparam SYMBOL 符号类型
-     */
-    template <typename SYMBOL>
-    class DlcSymbol {
-        const SYMBOL *symbol;
-        const DlcHandle *dlc = nullptr;
-
-    public:
-        /**
-         * 从句柄和符号指针创建一个符号
-         * @param symbol 符号指针
-         * @param dlc 句柄
-         */
-        explicit DlcSymbol(SYMBOL *symbol_, class DlcHandle *dlc_) : symbol {symbol_}, dlc {dlc_} {
-            if (this->dlc != nullptr)
-                this->dlc++;
-        }
-
-        DlcSymbol(const DlcSymbol &dlc_symbol) : symbol{dlc_symbol.symbol}, dlc {dlc_symbol.dlc} {
-            if (this->dlc != nullptr)
-                this->dlc++;
-        }
-
-        DlcSymbol &operator=(const DlcSymbol &dlc_symbol) {
-            if (this == &dlc_symbol)
-                return *this;
-            if (this->dlc != nullptr)
-                this->dlc--;
-            symbol = dlc_symbol.symbol;
-            dlc = dlc_symbol.dlc;
-            if (this->dlc != nullptr)
-                this->dlc++;
-            return *this;
-        }
-
-        /**
-         * 复制符号
-         * @param symbol
-         */
-        explicit DlcSymbol(class DlcSymbol<SYMBOL> *symbol) {
-            this->symbol = symbol->symbol;
-            this->dlc = symbol->dlc;
-            if (this->dlc != nullptr)
-                this->dlc++;
-        }
-
-        ~DlcSymbol(){
-            if (dlc != nullptr)
-                dlc--;
-        }
-
-        const SYMBOL *getSymbol() const {
-            return symbol;
-        }
-    };
 }
 }
 
 
+#include "dlc.inline.h"
+#include "dlc.template.h"
+
 #endif //AFUN_DLC_H
 #endif //AFUN_DLC_H

+ 16 - 0
include/tool/dlc.inline.h

@@ -0,0 +1,16 @@
+#ifndef AFUN_DLC_INLINE_H
+#define AFUN_DLC_INLINE_H
+
+#include "dlc.h"
+
+namespace aFuntool {
+    template<typename SYMBOL>
+    DlcSymbol<SYMBOL> *DlcHandle::get_symbol(const std::string &name){
+        auto symbol = (SYMBOL *) dlsym(handle, name.c_str());
+        if (symbol == nullptr)
+            return nullptr;
+        return new DlcSymbol<SYMBOL>(symbol, this);
+    }
+}
+
+#endif //AFUN_DLC_INLINE_H

+ 70 - 0
include/tool/dlc.template.h

@@ -0,0 +1,70 @@
+//
+// Created by jimso on 2022/1/8.
+//
+
+#ifndef AFUN_DLC_TEMPLATE_H
+#define AFUN_DLC_TEMPLATE_H
+
+#include "dlc.h"
+
+namespace aFuntool {
+    /**
+     * 符号句柄
+     * 注意: 不适用符号后需要 delete
+     * @tparam SYMBOL 符号类型
+     */
+    template <typename SYMBOL>
+    class DlcSymbol {
+        const SYMBOL *symbol;
+        const DlcHandle *dlc = nullptr;
+    public:
+        /**
+         * 从句柄和符号指针创建一个符号
+         * @param symbol 符号指针
+         * @param dlc 句柄
+         */
+        explicit DlcSymbol(SYMBOL *symbol_, class DlcHandle *dlc_) : symbol {symbol_}, dlc {dlc_} {
+            if (this->dlc != nullptr)
+                this->dlc++;
+        }
+
+        DlcSymbol(const DlcSymbol &dlc_symbol) : symbol{dlc_symbol.symbol}, dlc {dlc_symbol.dlc} {
+            if (this->dlc != nullptr)
+                this->dlc++;
+        }
+
+        DlcSymbol &operator=(const DlcSymbol &dlc_symbol) {
+            if (this == &dlc_symbol)
+                return *this;
+            if (this->dlc != nullptr)
+                this->dlc--;
+            symbol = dlc_symbol.symbol;
+            dlc = dlc_symbol.dlc;
+            if (this->dlc != nullptr)
+                this->dlc++;
+            return *this;
+        }
+
+        /**
+         * 复制符号
+         * @param symbol
+         */
+        explicit DlcSymbol(class DlcSymbol<SYMBOL> *symbol) {
+            this->symbol = symbol->symbol;
+            this->dlc = symbol->dlc;
+            if (this->dlc != nullptr)
+                this->dlc++;
+        }
+
+        ~DlcSymbol(){
+            if (dlc != nullptr)
+                dlc--;
+        }
+
+        const SYMBOL *getSymbol() const {
+            return symbol;
+        }
+    };
+}
+
+#endif //AFUN_DLC_TEMPLATE_H

+ 10 - 8
include/tool/exception.h

@@ -1,29 +1,31 @@
 #ifndef AFUN_EXCEPTION_H
 #ifndef AFUN_EXCEPTION_H
 #define AFUN_EXCEPTION_H
 #define AFUN_EXCEPTION_H
-#include "macro.h"
+#include "tool.h"
 
 
 namespace aFuntool {
 namespace aFuntool {
     class FileOpenException : public std::exception {
     class FileOpenException : public std::exception {
-        std::string msg;
+        std::string message;
     public:
     public:
-        explicit FileOpenException(ConstFilePath file) {msg = std::string("File cannot open") + file;}
-        virtual const char *what() {return "File cannot open";}
+        explicit FileOpenException(ConstFilePath file);
+        virtual const char *what();
     };
     };
 
 
     class RegexException : public std::exception
     class RegexException : public std::exception
     {
     {
         std::string message;
         std::string message;
     public:
     public:
-        explicit RegexException(const std::string &msg) { this->message = "Regex Error: " + msg;}
-        virtual const char *what() {return message.c_str();}
+        explicit RegexException(const std::string &msg);
+        virtual const char *what();
     };
     };
 
 
     class LogFatalError : public std::exception {
     class LogFatalError : public std::exception {
         std::string message;
         std::string message;
     public:
     public:
-        explicit LogFatalError(const char *msg) {message = msg;}
-        virtual const char *what() {return message.c_str();}
+        explicit LogFatalError(const char *msg);
+        virtual const char *what();
     };
     };
 }
 }
 
 
+#include "exception.inline.h"
+
 #endif //AFUN_EXCEPTION_H
 #endif //AFUN_EXCEPTION_H

+ 32 - 0
include/tool/exception.inline.h

@@ -0,0 +1,32 @@
+#ifndef AFUN_EXCEPTION_INLINE_H
+#define AFUN_EXCEPTION_INLINE_H
+
+#include "exception.h"
+
+namespace aFuntool {
+    inline FileOpenException::FileOpenException(ConstFilePath file) {
+        this->message = std::string("File cannot open: ") + file;
+    }
+
+    inline const char *FileOpenException::what() {
+        return message.c_str();
+    }
+
+    inline RegexException::RegexException(const std::string &msg) {
+        this->message = "Regex error: " + msg;
+    }
+
+    inline const char *RegexException::what() {
+        return message.c_str();
+    }
+
+    inline LogFatalError::LogFatalError(const char *msg) {
+        this->message = msg;
+    }
+
+    inline const char *LogFatalError::what() {
+        return message.c_str();
+    }
+}
+
+#endif //AFUN_EXCEPTION_INLINE_H

+ 6 - 6
include/tool/log.h

@@ -3,7 +3,7 @@
 
 
 #include <iostream>
 #include <iostream>
 #include "aFunToolExport.h"
 #include "aFunToolExport.h"
-#include "macro.h"
+#include "tool.h"
 #include "pthread.h"
 #include "pthread.h"
 
 
 namespace aFuntool {
 namespace aFuntool {
@@ -79,19 +79,19 @@ namespace aFuntool {
                    LogLevel level,
                    LogLevel level,
                    const char *file, int line, const char *func,
                    const char *file, int line, const char *func,
                    const char *format, va_list ap);
                    const char *format, va_list ap);
-        bool news(){ return !init || log_buf != nullptr; }
-        int wait(){ return pthread_cond_wait(&cond, &mutex); }
-        bool stop(){ return !init && log_buf == nullptr; }
+        bool news();
+        int wait();
+        bool stop();
         struct LogNode *pop();
         struct LogNode *pop();
     };
     };
 
 
     AFUN_TOOL_EXPORT extern LogFactory log_factory;
     AFUN_TOOL_EXPORT extern LogFactory log_factory;
 }
 }
 
 
-#ifndef NO_DEFINE_LOG_MACRO
+#include "log.inline.h"
 
 
+#ifndef NO_DEFINE_LOG_MACRO
 #include "log-m.h"
 #include "log-m.h"
-
 #define getLogger(logger) ((logger) == nullptr ? &aFuntool::log_factory.sys_log : (logger))
 #define getLogger(logger) ((logger) == nullptr ? &aFuntool::log_factory.sys_log : (logger))
 
 
 #if aFunWriteTrack
 #if aFunWriteTrack

+ 18 - 0
include/tool/log.inline.h

@@ -0,0 +1,18 @@
+#ifndef AFUN_LOG_INLINE_H
+#define AFUN_LOG_INLINE_H
+
+namespace aFuntool {
+    inline bool LogFactory::news(){
+        return !init || log_buf != nullptr;
+    }
+
+    inline int LogFactory::wait(){
+        return pthread_cond_wait(&cond, &mutex);
+    }
+
+    inline bool LogFactory::stop(){
+        return !init && log_buf == nullptr;
+    }
+}
+
+#endif //AFUN_LOG_INLINE_H

+ 1 - 24
include/tool/mem.h

@@ -6,30 +6,7 @@
 #ifndef AFUN_MEM_H
 #ifndef AFUN_MEM_H
 #define AFUN_MEM_H
 #define AFUN_MEM_H
 
 
-#include <cstdlib>
-#include "log.h"
-
-
-/* 取代calloc函数 */
-namespace aFuntool {
-    template <typename T>
-    static void *safeFree(T *ptr) {if (ptr != nullptr) free((void *)ptr); return nullptr;}
-
-    static void *safeCalloc(size_t n, size_t size){
-        void *re = calloc(n, size);
-        if (re == nullptr)
-            fatalErrorLog(nullptr, EXIT_FAILURE, "The memory error");
-        return re;
-    }
-
-    template <typename T>
-    static void *safeCalloc(size_t n, T &t){
-        void *re = calloc(n, sizeof(decltype(*t)));  // 自动推断类型
-        if (re == nullptr)
-            fatalErrorLog(nullptr, EXIT_FAILURE, "The memory error");
-        return re;
-    }
-}
+#include "mem.inline.h"
 
 
 #ifndef MEM_NOT_DEFINE
 #ifndef MEM_NOT_DEFINE
 #define free(p) (safeFree((p)))
 #define free(p) (safeFree((p)))

+ 28 - 0
include/tool/mem.inline.h

@@ -0,0 +1,28 @@
+#ifndef AFUN_MEM_INLINE_H
+#define AFUN_MEM_INLINE_H
+
+#include <cstdlib>
+#include "log.h"
+
+/* 取代calloc函数 */
+namespace aFuntool {
+    template <typename T>
+    static void *safeFree(T *ptr) {if (ptr != nullptr) free((void *)ptr); return nullptr;}
+
+    static void *safeCalloc(size_t n, size_t size){
+        void *re = calloc(n, size);
+        if (re == nullptr)
+            fatalErrorLog(nullptr, EXIT_FAILURE, "The memory error");
+        return re;
+    }
+
+    template <typename T>
+    static void *safeCalloc(size_t n, T &t){
+        void *re = calloc(n, sizeof(decltype(*t)));  // 自动推断类型
+        if (re == nullptr)
+            fatalErrorLog(nullptr, EXIT_FAILURE, "The memory error");
+        return re;
+    }
+}
+
+#endif //AFUN_MEM_INLINE_H

+ 1 - 1
include/tool/path.h

@@ -1,6 +1,6 @@
 #ifndef AFUN_PATH_H
 #ifndef AFUN_PATH_H
 #define AFUN_PATH_H
 #define AFUN_PATH_H
-#include "macro.h"
+#include "tool.h"
 
 
 /* 路径工具 */
 /* 路径工具 */
 #ifdef aFunWIN32_NO_CYGWIN
 #ifdef aFunWIN32_NO_CYGWIN

+ 3 - 1
include/tool/regex.h

@@ -18,8 +18,10 @@ namespace aFuntool {
         Regex &operator=(const Regex &regex);
         Regex &operator=(const Regex &regex);
         ~Regex ();
         ~Regex ();
         int match(const char *subject);
         int match(const char *subject);
-        int match(const std::string &subject) {return match(subject.c_str());}
+        int match(const std::string &subject);
     };
     };
 }
 }
 
 
+#include "regex.inline.h"
+
 #endif //AFUN_REGEX
 #endif //AFUN_REGEX

+ 12 - 0
include/tool/regex.inline.h

@@ -0,0 +1,12 @@
+#ifndef AFUN_REGEX_INLINE_H
+#define AFUN_REGEX_INLINE_H
+
+#include "regex.h"
+
+namespace aFuntool {
+    inline int Regex::match(const std::string &subject){
+        return match(subject.c_str());
+    }
+}
+
+#endif //AFUN_REGEX_INLINE_H

+ 25 - 55
include/tool/stdio_.h

@@ -1,18 +1,15 @@
 #ifndef AFUN_STDIO_H
 #ifndef AFUN_STDIO_H
 #define AFUN_STDIO_H
 #define AFUN_STDIO_H
 #include <cstdio>
 #include <cstdio>
-#include "macro.h"
+#include "tool.h"
 #include "aFunToolExport.h"
 #include "aFunToolExport.h"
 
 
 namespace aFuntool {
 namespace aFuntool {
     AFUN_TOOL_EXPORT int fgets_stdin(char **dest, int len);
     AFUN_TOOL_EXPORT int fgets_stdin(char **dest, int len);
     AFUN_TOOL_EXPORT bool checkStdin();
     AFUN_TOOL_EXPORT bool checkStdin();
     AFUN_TOOL_EXPORT bool fclear_stdin();
     AFUN_TOOL_EXPORT bool fclear_stdin();
-    static bool clear_ferror(FILE *file) {return ferror(file) && (clearerr(file), ferror(file));}
-    static bool clear_stdin() {
-        return (ferror(stdin) || feof(stdin)) &&
-                (clearerr(stdin), (ferror(stdin) || feof(stdin)));
-    }
+    static bool clear_ferror(FILE *file);
+    static bool clear_stdin();
 }
 }
 
 
 #ifdef aFunWIN32_NO_CYGWIN
 #ifdef aFunWIN32_NO_CYGWIN
@@ -37,64 +34,37 @@ namespace aFuntool {
     AFUN_TOOL_EXPORT int fungetc_stdin(int ch);
     AFUN_TOOL_EXPORT int fungetc_stdin(int ch);
 
 
     AFUN_TOOL_EXPORT int fputs_std_(const char *str, FILE *std);
     AFUN_TOOL_EXPORT int fputs_std_(const char *str, FILE *std);
-    static int fputs_stdout(const char *str) {return fputs_std_(str, stdout);}
-    static int fputs_stderr(const char *str) {return fputs_std_(str, stderr);}
+    static int fputs_stdout(const char *str);
+    static int fputs_stderr(const char *str);
 
 
     AFUN_TOOL_EXPORT size_t vprintf_std_(FILE *std, size_t buf_len, const char *format, va_list ap);
     AFUN_TOOL_EXPORT size_t vprintf_std_(FILE *std, size_t buf_len, const char *format, va_list ap);
-    static size_t vprintf_stderr(size_t buf_len, const char *format, va_list ap) {
-        return vprintf_std_(stderr, buf_len, format, ap);
-    }
-    static size_t vprintf_stdout(size_t buf_len, const char *format, va_list ap) {
-        return vprintf_std_(stdout, buf_len, format, ap);
-    }
-
-    static size_t printf_stdout(size_t buf_len, const char *format, ...) {
-        va_list ap;
-        va_start(ap, format);
-        size_t re = vprintf_std_(stdout, buf_len, format, ap);
-        va_end(ap);
-        return re;
-    }
-
-    static size_t printf_stderr(size_t buf_len, const char *format, ...) {
-        va_list ap;
-        va_start(ap, format);
-        size_t re = vprintf_std_(stderr, buf_len, format, ap);
-        va_end(ap);
-        return re;
-    }
+
+    static size_t vprintf_stderr(size_t buf_len, const char *format, va_list ap);
+    static size_t vprintf_stdout(size_t buf_len, const char *format, va_list ap);
+
+    static size_t printf_stdout(size_t buf_len, const char *format, ...);
+    static size_t printf_stderr(size_t buf_len, const char *format, ...);
 }
 }
 
 
 #else
 #else
 
 
 namespace aFuntool {
 namespace aFuntool {
-    static int fgetc_stdin(){ return fgetc(stdout); }
-    static int fgets_stdin_(char *buf, int len, FILE *file){ return fgets(buf, len, file) != nullptr; }
-    static int fungetc_stdin(char ch){ return ungetc(ch, stdin); }
-
-    static int fputs_stdout(const char *str){ return fputs(str, stdout); }
-    static int fputs_stderr(const char *str){ return fputs(str, stderr); }
-
-    static int vprintf_stdout(size_t, const char *format, va_list ap){ return vfprintf(stdout, format, ap); }
-    static int vprintf_stderr(size_t, const char *format, va_list ap){ return vfprintf(stderr, format, ap); }
-
-    static size_t printf_stdout(size_t, const char *format, ...) {
-        va_list ap;
-        va_start(ap, format);
-        size_t re = vfprintf(stdout, format, ap);
-        va_end(ap);
-        return re;
-    }
-
-    static size_t printf_stderr(size_t, const char *format, ...) {
-        va_list ap;
-        va_start(ap, format);
-        size_t re = vfprintf(stderr, format, ap);
-        va_end(ap);
-        return re;
-    }
+    static int fgetc_stdin();
+    static int fgets_stdin_(char *buf, int len, FILE *file);
+    static int fungetc_stdin(char ch);
+
+    static int fputs_stdout(const char *str);
+    static int fputs_stderr(const char *str);
 
 
+    static int vprintf_stdout(size_t, const char *format, va_list ap);
+    static int vprintf_stderr(size_t, const char *format, va_list ap);
+
+    static size_t printf_stdout(size_t, const char *format, ...);
+    static size_t printf_stderr(size_t, const char *format, ...);
 }
 }
 
 
 #endif
 #endif
+
+#include "stdio_.inline.h"
+
 #endif //AFUN_STDIO_H
 #endif //AFUN_STDIO_H

+ 98 - 0
include/tool/stdio_.inline.h

@@ -0,0 +1,98 @@
+#ifndef AFUN_STDIO_INLINE_H
+#define AFUN_STDIO_INLINE_H
+
+#include "stdio_.h"
+
+namespace aFuntool {
+    static bool clear_ferror(FILE *file) {
+        return ferror(file) && (clearerr(file), ferror(file));
+    }
+
+    static bool clear_stdin() {
+        return (ferror(stdin) || feof(stdin)) &&
+               (clearerr(stdin), (ferror(stdin) || feof(stdin)));
+    }
+}
+
+#ifdef aFunWIN32_NO_CYGWIN
+namespace aFuntool {
+    static int fputs_stdout(const char *str) {
+        return fputs_std_(str, stdout);
+    }
+
+    static int fputs_stderr(const char *str) {
+        return fputs_std_(str, stderr);
+    }
+
+    static size_t vprintf_stderr(size_t buf_len, const char *format, va_list ap) {
+        return vprintf_std_(stderr, buf_len, format, ap);
+    }
+    static size_t vprintf_stdout(size_t buf_len, const char *format, va_list ap) {
+        return vprintf_std_(stdout, buf_len, format, ap);
+    }
+
+    static size_t printf_stdout(size_t buf_len, const char *format, ...) {
+        va_list ap;
+        va_start(ap, format);
+        size_t re = vprintf_std_(stdout, buf_len, format, ap);
+        va_end(ap);
+        return re;
+    }
+
+    static size_t printf_stderr(size_t buf_len, const char *format, ...) {
+        va_list ap;
+        va_start(ap, format);
+        size_t re = vprintf_std_(stderr, buf_len, format, ap);
+        va_end(ap);
+        return re;
+    }
+}
+#else
+namespace aFuntool {
+    static int fgetc_stdin(){
+        return fgetc(stdout);
+    }
+
+    static int fgets_stdin_(char *buf, int len, FILE *file){
+        return fgets(buf, len, file) != nullptr;
+    }
+
+    static int fungetc_stdin(char ch){
+        return ungetc(ch, stdin);
+    }
+
+    static int fputs_stdout(const char *str){
+        return fputs(str, stdout);
+    }
+
+    static int fputs_stderr(const char *str){
+        return fputs(str, stderr);
+    }
+
+    static int vprintf_stdout(size_t, const char *format, va_list ap){
+        return vfprintf(stdout, format, ap);
+    }
+
+    static int vprintf_stderr(size_t, const char *format, va_list ap){
+        return vfprintf(stderr, format, ap);
+    }
+
+    static size_t printf_stdout(size_t, const char *format, ...) {
+        va_list ap;
+        va_start(ap, format);
+        size_t re = vfprintf(stdout, format, ap);
+        va_end(ap);
+        return re;
+    }
+
+    static size_t printf_stderr(size_t, const char *format, ...) {
+        va_list ap;
+        va_start(ap, format);
+        size_t re = vfprintf(stderr, format, ap);
+        va_end(ap);
+        return re;
+    }
+}
+
+#endif
+#endif //AFUN_STDIO_INLINE_H

+ 3 - 3
include/tool/macro.h → include/tool/tool.h

@@ -3,8 +3,8 @@
  * 目标: 定义公共宏 和 公共头文件
  * 目标: 定义公共宏 和 公共头文件
  */
  */
 
 
-#ifndef AFUN_MACRO_H
-#define AFUN_MACRO_H
+#ifndef AFUN_TOOL_H
+#define AFUN_TOOL_H
 #include <iostream>
 #include <iostream>
 #include <cinttypes>
 #include <cinttypes>
 #include <cstdarg>
 #include <cstdarg>
@@ -21,4 +21,4 @@ namespace aFuntool {
 
 
 #include "mem.h"
 #include "mem.h"
 
 
-#endif //AFUN_MACRO_H
+#endif //AFUN_TOOL_H

+ 1 - 1
src/tool/byte.cpp

@@ -2,7 +2,7 @@
 #include <cstdio>
 #include <cstdio>
 #include <cstdlib>
 #include <cstdlib>
 #include <cstring>
 #include <cstring>
-#include "macro.h"
+#include "tool.h"
 #include "byte.h"
 #include "byte.h"
 
 
 using namespace aFuntool;
 using namespace aFuntool;

+ 1 - 1
src/tool/dlc.cpp

@@ -1,4 +1,4 @@
-#include "macro.h"
+#include "tool.h"
 #include "dlc.h"
 #include "dlc.h"
 using namespace aFuntool;
 using namespace aFuntool;
 
 

+ 1 - 1
src/tool/exit_.cpp

@@ -1,4 +1,4 @@
-#include "macro.h"
+#include "tool.h"
 #include "exit_.h"
 #include "exit_.h"
 #include "pthread.h"
 #include "pthread.h"
 using namespace aFuntool;
 using namespace aFuntool;

+ 1 - 1
src/tool/file.cpp

@@ -8,7 +8,7 @@
 #include <cstdio>
 #include <cstdio>
 #include <cstdlib>
 #include <cstdlib>
 
 
-#include "macro.h"
+#include "tool.h"
 #include "file.h"
 #include "file.h"
 #include "path.h"
 #include "path.h"
 #include "str.h"
 #include "str.h"

+ 1 - 1
src/tool/hash.cpp

@@ -3,7 +3,7 @@
  * 目标: 关于哈希表的实用函数
  * 目标: 关于哈希表的实用函数
  */
  */
 
 
-#include "macro.h"
+#include "tool.h"
 #include "hash.h"
 #include "hash.h"
 
 
 using namespace aFuntool;
 using namespace aFuntool;

+ 1 - 1
src/tool/log.cpp

@@ -16,7 +16,7 @@
 #include <cstdlib>
 #include <cstdlib>
 #include <cstdarg>
 #include <cstdarg>
 #include <cstring>
 #include <cstring>
-#include "macro.h"
+#include "tool.h"
 #include "log.h"
 #include "log.h"
 #include "exception.h"
 #include "exception.h"
 #include "log-m.h"
 #include "log-m.h"

+ 1 - 1
src/tool/md5.cpp

@@ -6,7 +6,7 @@
 #include <cstdio>
 #include <cstdio>
 #include <cstring>
 #include <cstring>
 
 
-#include "macro.h"
+#include "tool.h"
 #include "md5.h"
 #include "md5.h"
 #include "file.h"
 #include "file.h"
 #include "exception.h"
 #include "exception.h"

+ 1 - 1
src/tool/regex.cpp

@@ -1,6 +1,6 @@
 #include <cstdio>
 #include <cstdio>
 #include <cstring>
 #include <cstring>
-#include "macro.h"
+#include "tool.h"
 #include "exception.h"
 #include "exception.h"
 #include "file.h"
 #include "file.h"
 
 

+ 1 - 1
src/tool/stdio_.cpp

@@ -8,7 +8,7 @@
 #include <cstring>
 #include <cstring>
 #include <cstdarg>
 #include <cstdarg>
 #include <csignal>
 #include <csignal>
-#include "macro.h"
+#include "tool.h"
 #include "stdio_.h"
 #include "stdio_.h"
 using namespace aFuntool;
 using namespace aFuntool;
 
 

+ 1 - 1
src/tool/string.cpp

@@ -5,7 +5,7 @@
 
 
 #include <cstdlib>
 #include <cstdlib>
 #include <cstring>
 #include <cstring>
-#include "macro.h"
+#include "tool.h"
 #include "str.h"
 #include "str.h"
 
 
 using namespace aFuntool;
 using namespace aFuntool;

+ 1 - 1
src/tool/time.cpp

@@ -4,7 +4,7 @@
  */
  */
 
 
 #include <ctime>
 #include <ctime>
-#include "macro.h"
+#include "tool.h"
 #include "time_.h"
 #include "time_.h"
 #include "stdio_.h"
 #include "stdio_.h"
 #include "str.h"
 #include "str.h"