re.h 597 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include <memory>
  3. #include <util/generic/fwd.h>
  4. #include <util/generic/yexception.h>
  5. namespace NReWrapper {
  6. class TCompileException : public yexception {
  7. };
  8. enum EFlags {
  9. FLAGS_CASELESS = 1,
  10. };
  11. class IRe {
  12. public:
  13. virtual ~IRe() = default;
  14. virtual bool Matches(const TStringBuf& text) const = 0;
  15. virtual TString Serialize() const = 0;
  16. };
  17. using IRePtr = std::unique_ptr<IRe>;
  18. namespace NDispatcher {
  19. bool Has(ui32 id);
  20. IRePtr Compile(const TStringBuf& regex, unsigned int flags, ui32 id);
  21. IRePtr Deserialize(const TStringBuf& serializedRegex);
  22. }
  23. }