1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-09-11 13:00:41 +03:00

Make CompiledRegex not a RefCountable

Keep this closer to the point of use, avoid pull ref_ptr.hpp into
regex_impl.hpp
This commit is contained in:
Maxime Coste 2024-03-22 19:54:25 +11:00
parent 794e7ce51c
commit 2dd69b3d96
3 changed files with 7 additions and 5 deletions

View File

@ -6,10 +6,10 @@ namespace Kakoune
{
Regex::Regex(StringView re, RegexCompileFlags flags)
: m_impl{new CompiledRegex{}},
: m_impl{new Impl{}},
m_str{re.str()}
{
*m_impl = compile_regex(re, flags);
static_cast<CompiledRegex&>(*m_impl) = compile_regex(re, flags);
}
int Regex::named_capture_index(StringView name) const

View File

@ -3,6 +3,7 @@
#include "string.hh"
#include "regex_impl.hh"
#include "ref_ptr.hh"
namespace Kakoune
{
@ -27,7 +28,9 @@ public:
const CompiledRegex* impl() const { return m_impl.get(); }
private:
RefPtr<CompiledRegex> m_impl;
struct Impl : RefCountable, CompiledRegex {};
RefPtr<Impl> m_impl;
String m_str;
};

View File

@ -3,7 +3,6 @@
#include "exception.hh"
#include "flags.hh"
#include "ref_ptr.hh"
#include "unicode.hh"
#include "utf8.hh"
#include "vector.hh"
@ -66,7 +65,7 @@ struct CharacterClass
};
struct CompiledRegex : RefCountable, UseMemoryDomain<MemoryDomain::Regex>
struct CompiledRegex : UseMemoryDomain<MemoryDomain::Regex>
{
enum Op : char
{