tool_regex.inline.h 540 B

1234567891011121314151617181920212223242526272829
  1. #ifndef AFUN_TOOL_REGEX_INLINE_H
  2. #define AFUN_TOOL_REGEX_INLINE_H
  3. #ifdef __cplusplus
  4. #include "tool_regex.h"
  5. #ifndef AFUN_TOOL_C
  6. namespace aFuntool {
  7. #endif
  8. Regex::Regex(const Regex &regex) noexcept: Regex(regex.pattern) {
  9. }
  10. Regex::Regex(Regex &&regex) noexcept : pattern {std::move(regex.pattern)}, re {regex.re} {
  11. regex.re = nullptr;
  12. }
  13. Regex::~Regex() noexcept {
  14. if (re != nullptr)
  15. pcre2_code_free(re);
  16. }
  17. #ifndef AFUN_TOOL_C
  18. }
  19. #endif
  20. #endif
  21. #endif //AFUN_TOOL_REGEX_INLINE_H