Lucene++ - a full-featured, c++ search engine
API Documentation

Loading...
Searching...
No Matches
TermAttribute.h
Go to the documentation of this file.
1
2// Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3// Distributable under the terms of either the Apache License (Version 2.0)
4// or the GNU Lesser General Public License.
6
7#ifndef TERMATTRIBUTE_H
8#define TERMATTRIBUTE_H
9
10#include "Attribute.h"
11
12 namespace Lucene {
13
15 class LPPAPI TermAttribute : public Attribute {
16 public:
17 TermAttribute();
18 virtual ~TermAttribute();
19
20 LUCENE_CLASS(TermAttribute);
21
22 protected:
23 static const int32_t MIN_BUFFER_SIZE;
24
25 CharArray _termBuffer;
26 int32_t _termLength;
27
28 public:
29 virtual String toString();
30
37 virtual String term();
38
43 virtual void setTermBuffer(const wchar_t* buffer, int32_t offset, int32_t length);
44
47 virtual void setTermBuffer(const String& buffer);
48
53 virtual CharArray termBuffer();
54
56 virtual wchar_t* termBufferArray();
57
64 virtual CharArray resizeTermBuffer(int32_t newSize);
65
67 virtual int32_t termLength();
68
73 virtual void setTermLength(int32_t length);
74
75 virtual int32_t hashCode();
76 virtual void clear();
77 virtual LuceneObjectPtr clone(const LuceneObjectPtr& other = LuceneObjectPtr());
78 virtual bool equals(const LuceneObjectPtr& other);
79 virtual void copyTo(const AttributePtr& target);
80
81 protected:
85 void growTermBuffer(int32_t newSize);
86
87 void initTermBuffer();
88};
89
90}
91
92#endif
Attribute.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
Lucene::Attribute
Base class for Attributes that can be added to a AttributeSource.
Definition Attribute.h:18
Lucene::TermAttribute
The term text of a Token.
Definition TermAttribute.h:15
Lucene::TermAttribute::clone
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Shallow clone. Subclasses must override this if they need to clone any members deeply.
Lucene::TermAttribute::TermAttribute
TermAttribute()
Lucene::TermAttribute::toString
virtual String toString()
Returns a string representation of the object.
Lucene::TermAttribute::equals
virtual bool equals(const LuceneObjectPtr &other)
All values used for computation of hashCode() should be checked here for equality.
Lucene::TermAttribute::_termLength
int32_t _termLength
Definition TermAttribute.h:26
Lucene::TermAttribute::~TermAttribute
virtual ~TermAttribute()
Lucene::TermAttribute::hashCode
virtual int32_t hashCode()
Subclasses must implement this method and should compute a hashCode similar to this:
Lucene::TermAttribute::MIN_BUFFER_SIZE
static const int32_t MIN_BUFFER_SIZE
Definition TermAttribute.h:23
Lucene::TermAttribute::setTermLength
virtual void setTermLength(int32_t length)
Set number of valid characters (length of the term) in the termBuffer array. Use this to truncate the...
Lucene::TermAttribute::term
virtual String term()
Returns the Token's term text.
Lucene::TermAttribute::termBufferArray
virtual wchar_t * termBufferArray()
Optimized implementation of termBuffer.
Lucene::TermAttribute::clear
virtual void clear()
Clears the values in this Attribute and resets it to its default value. If this implementation implem...
Lucene::TermAttribute::termLength
virtual int32_t termLength()
Return number of valid characters (length of the term) in the termBuffer array.
Lucene::TermAttribute::copyTo
virtual void copyTo(const AttributePtr &target)
Copies the values from this Attribute into the passed-in target attribute. The target implementation ...
Lucene::TermAttribute::_termBuffer
CharArray _termBuffer
Definition TermAttribute.h:25
Lucene::TermAttribute::termBuffer
virtual CharArray termBuffer()
Returns the internal termBuffer character array which you can then directly alter....
Lucene::TermAttribute::setTermBuffer
virtual void setTermBuffer(const wchar_t *buffer, int32_t offset, int32_t length)
Copies the contents of buffer, starting at offset for length characters, into the termBuffer array.
Lucene::TermAttribute::resizeTermBuffer
virtual CharArray resizeTermBuffer(int32_t newSize)
Grows the termBuffer to at least size newSize, preserving the existing content. Note: If the next ope...
Lucene::TermAttribute::growTermBuffer
void growTermBuffer(int32_t newSize)
Allocates a buffer char[] of at least newSize, without preserving the existing content....
Lucene::TermAttribute::initTermBuffer
void initTermBuffer()
Lucene::TermAttribute::setTermBuffer
virtual void setTermBuffer(const String &buffer)
Copies the contents of buffer into the termBuffer array.
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition LuceneTypes.h:539
Lucene::AttributePtr
boost::shared_ptr< Attribute > AttributePtr
Definition LuceneTypes.h:518

clucene.sourceforge.net