IbycusIdtFile


Description

The IbycusIdtFile class provides an interface to PHI\TLG .IDT files which are indexes to their corresponding .TXT files. Like an IbycusTxtFile, each file contains 1 (or possibly more) authors, with 1 or more works divided into 1 or more sections. Each of these may be accessed by index number, which are 0-based. The first section of the first work of the first author is therefore at index 0, 0, 0.

When you create an IbycusTxtFile it creates its own IbycusIdtFile, and most of the methods of IbycusIdtFile can be accessed through equivalent IbycusTxtFile methods.


Constructors

IbycusIdtFile()

IbycusIdtFile(const ibystring_t & id, const ibystring_t & vol)

Public Methods

void Open(const ibystring_t & id, const ibystring_t & vol)

int Count(const int auth = -1, const int work = -1)

const ibystring_t & Name(const int auth = 0, const int work = -1)

const IbycusId & Id(const int auth = 0, const int work = -1, const int sect = -1)

const IbycusId & Start(const int auth = 0, const int work = 0, const int sect = 0)

const IbycusId & End(const int auth = 0, const int work = -1, const int sect = -1)

ibylen_t Block(const int auth = 0, const int work = 0, const int sect = 0, const IbycusId & id = IbycusId()) throw(IbycusNoId)

int Span(const int auth = 0, const int work = 0, const int sect = 0)

int tellg()

int CiteLevels(int auth=0, int work=0)


Constructors

IbycusIdtFile()

Default constructor. Constructs an empty IbycusIdtFile

IbycusIdtFile(const ibystring_t & id, const ibystring_t & vol)

Parameters

id The author ID of the file to be opened
vol The directory where the file exists

Creates an IbycusIdtFile, given an author ID (e.g., LAT0500, TLG1010) and a directory. Note that id is not the filename and must not have the .IDT extension.


Public Methods

void Open(const ibystring_t & id, const ibystring_t & vol)

Parameters

id The author ID of the file to be opened
vol The directory where the file exists

Opens a .IDT file. Can be called after IbycusIdtFile(), but it is better to use IbycusIdtFile(id, vol) in the first place. Throws an IbycusFileException if the file cannot be opened

int Count(const int auth = 0, const int work = -1)

Parameters

auth The index of the desired author (default: 0)
work The index of the desired work (default: -1)

Returns the number of works in the author auth, or the number of sections in the work auth, work. See IbycusTxtFile.Count().

const ibystring_t & Name(const int auth = 0, const int work = -1)

Parameters

auth The index of the desired author (default: 0)
work The index of the desired work (default: -1)

Returns the name of the author with the index auth, or of the work auth, work.See IbycusTxtFile.Name().

const IbycusId & Id(const int auth = 0, const int work = -1, const int sect = -1)

Parameters

auth The index of the desired author (default: 0)
work The index of the desired work (default: -1)
sect The index of the desired section (default: -1)

Returns the ID of the author with the index auth, work with the index auth, work, or section with the index auth, work, sect.

IbycusIdtFile idt("LAT0960", "D:\"); // Your directory may be different
cout << idt.Id() << "\n";
cout << idt.Id(0,0) <<  "\n";

The output of this would be:

0960
0960.001

const IbycusId & Start(const int auth = 0, const int work = 0, const int sect = 0)

Parameters

auth The index of the desired author (default: 0)
work The index of the desired work (default: 0)
sect The index of the desired section (default: 0)

Returns the start ID of the author with the index auth, work with the index auth, work, or section with the index auth, work, sect.

const IbycusId & End(const int auth = 0, const int work = -1, const int sect = -1)

Parameters

auth The index of the desired author (default: 0)
work The index of the desired work (default: -1)
sect The index of the desired section (default: -1)

Returns the end ID of the author with the index auth, work with the index auth, work, or section with the index auth, work, sect.

ibylen_t Block(const int auth = 0, const int work = 0, const int sect = 0, const IbycusId & id = IbycusId()) throw(IbycusNoId)

auth The index of the desired author (default: 0)
work The index of the desired work (default: 0)
sect The index of the desired section (default: 0)
id The ID to be found

Returns the block of the corresponding .TXT file that contains the author with the index auth, work with the index auth, work, section with the index auth, work, sect or section with the index auth, work, sect and the ID ID. Throws an IbycusNoId if the ID is supplied but cannot be found.

int Span(const int auth = 0, const int work = 0, const int sect = 0)

Parameters

auth The index of the desired author (default: 0)
work The index of the desired work (default: 0)
sect The index of the desired section (default: 0)

Returns the number of blocks spanned by the author with the index auth, work with the index auth, work, or section with the index auth, work

.

int tellg()

Returns the current position of the file pointer in the .IDT file

int CiteLevels(int auth=0, int work=0)

auth The index of the desired author (default: 0)
work The index of the desired work (default: 0)

Returns the number of citation levels required to describe the work with the index auth, work.


Introduction | Libycus Homepage