WordRecord(3)

NAME
WordRecord - inverted index record.

SYNOPSIS
#include <WordRecord.h>
WordContext* context;
WordRecord* record = context->Record();
if(record->DefaultType() == WORD_RECORD_DATA) {
  record->info.data = 120;
} else if(record->DefaultType() == WORD_RECORD_STR) {
  record->info.str = "foobar";
}
delete record;

DESCRIPTION
The record can contain an integer, if the default record type (see CONFIGURATION in WordKeyInfo ) is set to DATA or a string if set to STR. If the type is set to NONE the record does not contain any usable information. Although constructors may be used, the prefered way to create a WordRecord object is by using the WordContext::Record method.

ASCII FORMAT
If default type is DATA it is the decimal representation of an integer. If default type is NONE it is the empty string.

METHODS

inline WordRecord(WordContext* ncontext)
    Constructor. Build an empty record. The ncontext argument must be a pointer to a valid WordContext object.

inline void Clear()
    Reset to empty and set the type to the default specified in the configuration.

inline int DefaultType()
    Return the default type WORD_RECORD_{DATA,STR,NONE}

inline int Pack(String& packed) const
    Convert the object to a representation for disk storage written in the packed string. Return OK on success, NOTOK otherwise.

inline int Unpack(const char* string, int length)
    Alias for Unpack(String(string, length))

inline int Unpack(const String& packed)
    Read the object from a representation for disk storage contained in the packed argument. Return OK on success, NOTOK otherwise.

int Set(const String& bufferin)
    Set the whole structure from ASCII string description stored in the bufferin argument. Return OK on success, NOTOK otherwise.

int Get(String& bufferout) const
    Convert the whole structure to an ASCII string description and return it in the bufferout argument. Return OK on success, NOTOK otherwise.

String Get() const
    Convert the whole structure to an ASCII string description and return it.

inline WordContext* GetContext()
    Return a pointer to the WordContext object used to create this instance.

inline const WordContext* GetContext() const
    Return a pointer to the WordContext object used to create this instance as a const.

int Write(FILE* f) const
    Print object in ASCII form on descriptor f using the Get method.

AUTHORS
Loic Dachary loic@gnu.org The Ht://Dig group http://dev.htdig.org/

SEE ALSO
htdb_dump(1), htdb_stat(1), htdb_load(1), mifluzdump(1), mifluzload(1), mifluzsearch(1), mifluzdict(1), WordContext(3), WordList(3), WordDict(3), WordListOne(3), WordKey(3), WordKeyInfo(3), WordType(3), WordDBInfo(3), WordRecordInfo(3), WordReference(3), WordCursor(3), WordCursorOne(3), WordMonitor(3), Configuration(3), mifluz(3)