| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| ReadMe.txt | 2011-02-02 | 1.4 kB | |
| FastMRCLib-bin-win32-2010.12.23.0.zip | 2011-02-02 | 21.7 kB | |
| Totals: 2 Items | 23.1 kB | 0 | |
FastMRCLib is a small and simple library for reading and parsing MARC records (ISO-2709).
This library uses STL and MD5Lib (which has been included)
Algoritm based on MARC 21 Specifications for Record Structure: http://www.loc.gov/marc/specifications/specrecstruc.html
Features:
- read records from stream
- read record ID from field 001
- build MD5 digest
- iterate over all fields and subfields
- get fields by specified tag
- get control field data
- get subfield data
The main classes are:
fastmrc::Record
fastmrc::Field
fastmrc::ControlField
fastmrc::DataField
fastmrc::Subfield
fastmrc::FieldTag
fastmrc::MrcException
Example of using this library
#include "FastMRC.h"
ifstream ifs("filename.mrc", ios::in|ios::binary);
fastmrc::Record rec;
int id;
unsigned char digest[16];
while(ifs >> rec)
{
// get ID
id = rec.getId();
// get MD5
rec.getMD5(digest);
// parse record and get field CAT
fastmrc::Record::FieldMapCIt it = rec.getFirstField("CAT");
if (it == rec.getFMapEnd())
printf("Warning! Field 'CAT' not found. rec id: %09d\n", id);
else
{
f = it->second;
if (!f->isControl())
{
df = (fastmrc::DataField *) f;
// parse datafield and get subfields
fastmrc::DataField::SubfieldListCIt sfit = df->getSFListBegin();
if (sfit != df->getSFListEnd())
{
// doing comething with subfields ...
}
}
}
}