RegExpStringIterator.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2021, Tim Flynn <trflynn89@pm.me>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Utf16View.h>
  8. #include <LibJS/Runtime/Object.h>
  9. #include <LibJS/Runtime/Utf16String.h>
  10. namespace JS {
  11. class RegExpStringIterator final : public Object {
  12. JS_OBJECT(RegExpStringIterator, Object);
  13. public:
  14. static RegExpStringIterator* create(GlobalObject&, Object& regexp_object, Utf16String string, bool global, bool unicode);
  15. explicit RegExpStringIterator(Object& prototype, Object& regexp_object, Utf16String string, bool global, bool unicode);
  16. virtual ~RegExpStringIterator() override = default;
  17. Object& regexp_object() { return m_regexp_object; }
  18. Utf16String string() const { return m_string; }
  19. bool global() const { return m_global; }
  20. bool unicode() const { return m_unicode; }
  21. bool done() const { return m_done; }
  22. void set_done() { m_done = true; }
  23. private:
  24. virtual void visit_edges(Cell::Visitor&) override;
  25. Object& m_regexp_object;
  26. Utf16String m_string;
  27. bool m_global { false };
  28. bool m_unicode { false };
  29. bool m_done { false };
  30. };
  31. }