RegExpStringIterator.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. namespace JS {
  10. class RegExpStringIterator final : public Object {
  11. JS_OBJECT(RegExpStringIterator, Object);
  12. public:
  13. static RegExpStringIterator* create(GlobalObject&, Object& regexp_object, Vector<u16> string, bool global, bool unicode);
  14. explicit RegExpStringIterator(Object& prototype, Object& regexp_object, Vector<u16> string, bool global, bool unicode);
  15. virtual ~RegExpStringIterator() override = default;
  16. Object& regexp_object() { return m_regexp_object; }
  17. Utf16View string() const { return Utf16View { m_string }; }
  18. bool global() const { return m_global; }
  19. bool unicode() const { return m_unicode; }
  20. bool done() const { return m_done; }
  21. void set_done() { m_done = true; }
  22. private:
  23. virtual void visit_edges(Cell::Visitor&) override;
  24. Object& m_regexp_object;
  25. Vector<u16> m_string;
  26. bool m_global { false };
  27. bool m_unicode { false };
  28. bool m_done { false };
  29. };
  30. }