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:
parent
794e7ce51c
commit
2dd69b3d96
|
@ -6,10 +6,10 @@ namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
Regex::Regex(StringView re, RegexCompileFlags flags)
|
Regex::Regex(StringView re, RegexCompileFlags flags)
|
||||||
: m_impl{new CompiledRegex{}},
|
: m_impl{new Impl{}},
|
||||||
m_str{re.str()}
|
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
|
int Regex::named_capture_index(StringView name) const
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "string.hh"
|
#include "string.hh"
|
||||||
#include "regex_impl.hh"
|
#include "regex_impl.hh"
|
||||||
|
#include "ref_ptr.hh"
|
||||||
|
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
@ -27,7 +28,9 @@ public:
|
||||||
const CompiledRegex* impl() const { return m_impl.get(); }
|
const CompiledRegex* impl() const { return m_impl.get(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RefPtr<CompiledRegex> m_impl;
|
struct Impl : RefCountable, CompiledRegex {};
|
||||||
|
|
||||||
|
RefPtr<Impl> m_impl;
|
||||||
String m_str;
|
String m_str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include "exception.hh"
|
#include "exception.hh"
|
||||||
#include "flags.hh"
|
#include "flags.hh"
|
||||||
#include "ref_ptr.hh"
|
|
||||||
#include "unicode.hh"
|
#include "unicode.hh"
|
||||||
#include "utf8.hh"
|
#include "utf8.hh"
|
||||||
#include "vector.hh"
|
#include "vector.hh"
|
||||||
|
@ -66,7 +65,7 @@ struct CharacterClass
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CompiledRegex : RefCountable, UseMemoryDomain<MemoryDomain::Regex>
|
struct CompiledRegex : UseMemoryDomain<MemoryDomain::Regex>
|
||||||
{
|
{
|
||||||
enum Op : char
|
enum Op : char
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user