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


Payload.h
Go to the documentation of this file.
1 // 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 PAYLOAD_H
8 #define PAYLOAD_H
9 
10 #include "LuceneObject.h"
11 
12 namespace Lucene {
13 
21 class LPPAPI Payload : public LuceneObject {
22 public:
25 
29  Payload(ByteArray data);
30 
36  Payload(ByteArray data, int32_t offset, int32_t length);
37 
38  virtual ~Payload();
39 
41 
42 protected:
44  ByteArray data;
45 
47  int32_t offset;
48 
50  int32_t _length;
51 
52 public:
54  void setData(ByteArray data);
55 
57  void setData(ByteArray data, int32_t offset, int32_t length);
58 
60  ByteArray getData();
61 
63  int32_t getOffset();
64 
66  int32_t length();
67 
69  uint8_t byteAt(int32_t index);
70 
72  ByteArray toByteArray();
73 
77  void copyTo(ByteArray target, int32_t targetOffset);
78 
81 
82  virtual bool equals(const LuceneObjectPtr& other);
83  virtual int32_t hashCode();
84 };
85 
86 }
87 
88 #endif
Lucene::Payload::Payload
Payload(ByteArray data)
Creates a new payload with the the given array as data. A reference to the passed-in array is held,...
Lucene::Payload::setData
void setData(ByteArray data, int32_t offset, int32_t length)
Sets this payloads data. A reference to the passed-in array is held, ie. no copy is made.
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::Payload::hashCode
virtual int32_t hashCode()
Return hash code for this object.
Lucene::Payload::clone
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Clones this payload by creating a copy of the underlying byte array.
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
Lucene::Payload::~Payload
virtual ~Payload()
Lucene::Payload::data
ByteArray data
the byte array containing the payload data
Definition: Payload.h:40
Lucene::Payload::toByteArray
ByteArray toByteArray()
Allocates a new byte array, copies the payload data into it and returns it.
Lucene::Payload::byteAt
uint8_t byteAt(int32_t index)
Returns the byte at the given index.
Lucene::Payload::offset
int32_t offset
the offset within the byte array
Definition: Payload.h:47
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::Payload::setData
void setData(ByteArray data)
Sets this payloads data. A reference to the passed-in array is held, ie. no copy is made.
Lucene::LuceneObject
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Lucene::Payload::copyTo
void copyTo(ByteArray target, int32_t targetOffset)
Copies the payload data to a byte array.
Lucene::Payload::equals
virtual bool equals(const LuceneObjectPtr &other)
Return whether two objects are equal.
Lucene::Payload::_length
int32_t _length
the length of the payload data
Definition: Payload.h:50
Lucene::Payload::Payload
Payload(ByteArray data, int32_t offset, int32_t length)
Creates a new payload with the the given array as data. A reference to the passed-in array is held,...
Lucene::Payload
A Payload is metadata that can be stored together with each occurrence of a term. This metadata is st...
Definition: Payload.h:21
Lucene::Payload::getData
ByteArray getData()
Returns a reference to the underlying byte array that holds this payloads data.
Lucene::Payload::Payload
Payload()
Creates an empty payload and does not allocate a byte array.
Lucene::Payload::length
int32_t length()
Returns the length of the payload data.
LuceneObject.h
Lucene::Payload::getOffset
int32_t getOffset()
Returns the offset in the underlying byte array.

clucene.sourceforge.net