tool-regex.h 757 B

1234567891011121314151617181920212223
  1. #ifndef AFUN_TOOL_REGEX
  2. #define AFUN_TOOL_REGEX
  3. #include <regex>
  4. namespace aFuntool {
  5. class Regex { // 整个对象都是inline的, 不需要Export符号
  6. std::regex re; // 正则表达式
  7. std::string pattern; // 正则表达式的字符串
  8. public:
  9. inline explicit Regex(std::string pattern_) noexcept(false);
  10. inline Regex(const Regex &regex) noexcept;
  11. inline Regex(Regex &&regex) noexcept;
  12. Regex &operator=(const Regex &regex)=delete;
  13. Regex &operator=(Regex &&regex)=delete;
  14. [[nodiscard]] inline bool match(const char *subject) const;
  15. [[nodiscard]] inline bool match(const std::string &subject) const;
  16. };
  17. }
  18. #include "tool-regex.inline.h"
  19. #endif //AFUN_TOOL_REGEX