xapian-core  1.4.26
stem.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2005,2007,2010,2011,2013,2014,2015,2018,2019 Olly Betts
5  * Copyright (C) 2010 Evgeny Sizikov
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef XAPIAN_INCLUDED_STEM_H
23 #define XAPIAN_INCLUDED_STEM_H
24 
25 #if !defined XAPIAN_IN_XAPIAN_H && !defined XAPIAN_LIB_BUILD
26 # error Never use <xapian/stem.h> directly; include <xapian.h> instead.
27 #endif
28 
29 #include <xapian/constinfo.h>
30 #include <xapian/intrusive_ptr.h>
31 #include <xapian/visibility.h>
32 
33 #include <string>
34 
35 namespace Xapian {
36 
40 {
42  void operator=(const StemImplementation &);
43 
46 
47  public:
50 
52  virtual ~StemImplementation();
53 
55  virtual std::string operator()(const std::string & word) = 0;
56 
58  virtual std::string get_description() const = 0;
59 };
60 
63  public:
66 
68  Stem(const Stem & o);
69 
71  Stem & operator=(const Stem & o);
72 
73 #ifdef XAPIAN_MOVE_SEMANTICS
74  Stem(Stem && o);
76 
78  Stem & operator=(Stem && o);
79 #endif
80 
85  Stem();
86 
138  explicit Stem(const std::string& language);
139  Stem(const std::string& language, bool fallback);
153  explicit Stem(StemImplementation * p);
154 
156  ~Stem();
157 
163  std::string operator()(const std::string &word) const;
164 
166  bool is_none() const { return !internal.get(); }
167 
169  std::string get_description() const;
170 
181  static std::string get_available_languages() {
182  const struct Xapian::Internal::constinfo * info =
184  return std::string(info->stemmer_data, info->stemmer_name_len);
185  }
186 };
187 
188 }
189 
190 #endif // XAPIAN_INCLUDED_STEM_H
bool is_none() const
Return true if this is a no-op stemmer.
Definition: stem.h:166
The Xapian namespace contains public interfaces for the Xapian library.
Definition: compactor.cc:80
Class representing a stemming algorithm.
Definition: stem.h:62
StemImplementation()
Default constructor.
Definition: stem.h:49
#define XAPIAN_VISIBILITY_DEFAULT
Definition: visibility.h:28
Mechanism for accessing a struct of constant information.
const struct constinfo * get_constinfo_()
Definition: constinfo.cc:43
Define XAPIAN_VISIBILITY_* macros.
static std::string get_available_languages()
Return a list of available languages.
Definition: stem.h:181
Base class for objects managed by intrusive_ptr.
Definition: intrusive_ptr.h:49
Class representing a stemming algorithm implementation.
Definition: stem.h:38
static string language
Definition: stemtest.cc:39
A smart pointer that uses intrusive reference counting.
Definition: intrusive_ptr.h:81