WordRecord3
Inverted index record.
Usage
#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;
Overview
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
ncontextargument 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
packedstring. 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
packedargument. Return OK on success, NOTOK otherwise.
- int Set(const String& bufferin)
-
Set the whole structure from ASCII string description stored in the
bufferinargument. 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
bufferoutargument. 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
fusing the Get method.
Releases
2 releases since Debian 3.0 (Woody); the text changed 1 time.