From 13eb4874036b307edf870477b99f3f2e2d2dd77f Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 12 Dec 2017 14:59:26 +1300 Subject: [PATCH] Stop forward declaring global QueryOptimiser in API header Move this class into the Xapian::Internal namespace to avoid issues if user code has its own QueryOptimiser class. --- xapian-core/api/queryinternal.h | 4 ++-- xapian-core/include/xapian/query.h | 13 +++++++------ xapian-core/matcher/localsubmatch.h | 2 +- xapian-core/matcher/queryoptimiser.h | 8 ++++++++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/xapian-core/api/queryinternal.h b/xapian-core/api/queryinternal.h index 97d3f72ce..74d1628e6 100644 --- a/xapian-core/api/queryinternal.h +++ b/xapian-core/api/queryinternal.h @@ -29,11 +29,11 @@ /// Default set_size for OP_ELITE_SET: const Xapian::termcount DEFAULT_ELITE_SET_SIZE = 10; -class QueryOptimiser; - namespace Xapian { namespace Internal { +class QueryOptimiser; + class QueryTerm : public Query::Internal { std::string term; diff --git a/xapian-core/include/xapian/query.h b/xapian-core/include/xapian/query.h index 9da525ab8..20036ffd9 100644 --- a/xapian-core/include/xapian/query.h +++ b/xapian-core/include/xapian/query.h @@ -36,8 +36,6 @@ #include #include -class QueryOptimiser; // FIXME - namespace Xapian { class PostingSource; @@ -558,6 +556,8 @@ namespace Internal { class AndContext; class OrContext; class XorContext; + +class QueryOptimiser; } /** @private @internal */ @@ -567,18 +567,19 @@ class Query::Internal : public Xapian::Internal::intrusive_base { virtual ~Internal(); - virtual PostingIterator::Internal * postlist(QueryOptimiser * qopt, double factor) const = 0; + virtual PostingIterator::Internal* postlist(Xapian::Internal::QueryOptimiser* qopt, + double factor) const = 0; virtual void postlist_sub_and_like(Xapian::Internal::AndContext& ctx, - QueryOptimiser * qopt, + Xapian::Internal::QueryOptimiser* qopt, double factor) const; virtual void postlist_sub_or_like(Xapian::Internal::OrContext& ctx, - QueryOptimiser * qopt, + Xapian::Internal::QueryOptimiser* qopt, double factor) const; virtual void postlist_sub_xor(Xapian::Internal::XorContext& ctx, - QueryOptimiser * qopt, + Xapian::Internal::QueryOptimiser* qopt, double factor) const; virtual termcount XAPIAN_NOTHROW(get_length() const) XAPIAN_PURE_FUNCTION; diff --git a/xapian-core/matcher/localsubmatch.h b/xapian-core/matcher/localsubmatch.h index 42a812a8f..54baf0ff3 100644 --- a/xapian-core/matcher/localsubmatch.h +++ b/xapian-core/matcher/localsubmatch.h @@ -106,7 +106,7 @@ class LocalSubMatch { double factor, bool need_positions, bool in_synonym, - QueryOptimiser* qopt, + Xapian::Internal::QueryOptimiser* qopt, bool lazy_weight); }; diff --git a/xapian-core/matcher/queryoptimiser.h b/xapian-core/matcher/queryoptimiser.h index 00bf66ef5..3d7c874ff 100644 --- a/xapian-core/matcher/queryoptimiser.h +++ b/xapian-core/matcher/queryoptimiser.h @@ -29,6 +29,9 @@ class LeafPostList; class PostListTree; +namespace Xapian { +namespace Internal { + class QueryOptimiser { /// Prevent assignment. void operator=(const QueryOptimiser &); @@ -114,4 +117,9 @@ class QueryOptimiser { void take_hint_ownership() { hint_owned = true; } }; +} +} + +using Xapian::Internal::QueryOptimiser; + #endif // XAPIAN_INCLUDED_QUERYOPTIMISER_H -- 2.11.4.GIT