WordReference(3)

NAME
WordReference - inverted index occurrence.

SYNOPSIS
#include <WordReference.h>
WordContext* context;
WordReference* word = context->Word("word");
WordReference* word = context->Word();
WordReference* word = context->Word(WordKey("key 1 2"), WordRecord());
WordKey key = word->Key()
WordKey record = word->Record()
word->Clear();
delete word;

DESCRIPTION
A WordReference object is an agregate of a WordKey object and a WordRecord object. Although constructors may be used, the prefered way to create a WordReference object is by using the WordContext::Word method.

ASCII FORMAT
The ASCII description is a string with fields separated by tabs or white space. It is made of the ASCII description of a WordKey object immediately followed by the ASCII description of a WordRecord object. See the corresponding manual pages for more information.

METHODS

WordReference(WordContext* ncontext) :
    Constructor. Build an object with empty key and empty record. The ncontext argument must be a pointer to a valid WordContext object.

WordReference(WordContext* ncontext, const String& key0, const String& record0) :
    Constructor. Build an object from disk representation of key and record The ncontext argument must be a pointer to a valid WordContext object.

WordReference(WordContext* ncontext, const String& word) :
    Constructor. Build an object with key word set to word and otherwise empty and empty record. The ncontext argument must be a pointer to a valid WordContext object.

void Clear()
    Reset to empty key and record

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.

inline String& GetWord()
    Return the word data member.

inline const String& GetWord() const
    Return the word data member as a const.

inline void SetWord(const String& nword)
    Set the word data member from the nword argument.

WordKey& Key()
    Return the key object.

const WordKey& Key() const
    Return the key object as const.

WordRecord& Record()
    Return the record object.

const WordRecord& Record() const
    Return the record object as const.

void Key(const WordKey& arg)
    Copy arg in the key part of the object.

int KeyUnpack(const String& packed)
    Set key structure from disk storage format as found in packed string. Return OK if successfull, NOTOK otherwise.

String KeyPack() const
    Convert key object into disk storage format as found in return the resulting string.

int KeyPack(String& packed) const
    Convert key object into disk storage format as found in and place the result in packed string. Return OK if successfull, NOTOK otherwise.

void Record(const WordRecord& arg)
    Copy arg in the record part of the object.

int RecordUnpack(const String& packed)
    Set record structure from disk storage format as found in packed string. Return OK if successfull, NOTOK otherwise.

String RecordPack() const
    Convert record object into disk storage format as found in return the resulting string.

int RecordPack(String& packed) const
    Convert record object into disk storage format as found in and place the result in packed string. Return OK if successfull, NOTOK otherwise.

inline int Pack(String& ckey, String& crecord) const
    Short hand for KeyPack( ckey ) RecordPack( crecord ).

int Unpack(const String& ckey, const String& crecord)
    Short hand for KeyUnpack( ckey ) RecordUnpack( crecord ).

int Merge(const WordReference& other)
    Merge key with other.Key() using the WordKey::Merge method: key.Merge(other.Key()). See the corresponding manual page for details. Copy other.record into the record part of the object.

static WordReference Merge(const WordReference& master, const WordReference& slave)
    Copy master before merging with master. Merge( slave ) and return the copy. Prevents alteration of master

int Set(const String& bufferin)
    Set the whole structure from ASCII string in bufferin See ASCII FORMAT section. Return OK if successfull, NOTOK otherwise.

int Get(String& bufferout) const
    Convert the whole structure to an ASCII string description in bufferout. See ASCII FORMAT section. Return OK if successfull, NOTOK otherwise.

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

int Write(FILE* f) const
    Print object in ASCII form on f (uses Get method). See ASCII FORMAT section.

void Print() const
    Print object in ASCII form on stdout (uses Get method). See ASCII FORMAT section.

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), WordRecord(3), WordCursor(3), WordCursorOne(3), WordMonitor(3), Configuration(3), mifluz(3)