CLucene - a full-featured, c++ search engine
API Documentation
00001 /*------------------------------------------------------------------------------ 00002 * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team 00003 * 00004 * Distributable under the terms of either the Apache License (Version 2.0) or 00005 * the GNU Lesser General Public License, as specified in the COPYING file. 00006 ------------------------------------------------------------------------------*/ 00007 #ifndef _lucene_index_Payload_ 00008 #define _lucene_index_Payload_ 00009 00010 CL_NS_DEF(index) 00011 00012 00024 class Payload:LUCENE_REFBASE { 00025 protected: 00027 uint8_t* data; 00028 int32_t dataLen; // CLucene specific, to keep track of the data array length 00029 00031 int32_t offset; 00032 00034 int32_t length; 00035 00036 public: 00037 00039 Payload(); 00040 00051 Payload(uint8_t* _data, const int32_t _dataLen, const int32_t _offset=0, int32_t _length=0); 00052 00053 /* Desctructor - auto-delete the data container */ 00054 ~Payload(); 00055 00061 void setData(uint8_t* _data, const int32_t _dataLen); 00062 00068 void setData(uint8_t* _data, const int32_t _dataLen, const int32_t _offset, const int32_t _length); 00069 00074 uint8_t* getData(int32_t &_dataLen) { _dataLen = dataLen; return data; } 00075 00079 int getOffset() const { return offset; }; 00080 00084 int getLength() const { return length; } 00085 00089 uint8_t byteAt(int index) const; 00090 00095 uint8_t* toByteArray(int32_t &_dataLen); 00096 00103 void copyTo(uint8_t* target, const int32_t targetLen, const int32_t targetOffset); 00104 00109 Payload* clone(); 00110 00111 }; 00112 00113 CL_NS_END 00114 #endif