| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| FastMRCLib-bin-win-2013.08.27.0.zip | 2013-08-27 | 48.7 kB | |
| ReadMe.txt | 2013-08-27 | 2.1 kB | |
| Totals: 2 Items | 50.9 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
Changes
-------
Version 2010.12.23 - initial version
Version 2011.02.02
Added checking for out of record's buffer, which prevents fail if stream format is not well-formed.
Version 2011.03.17
Added new methods
to fastmrc::Record:
const char* getData() const;
unsigned getDatalen() const;
to fastmrc::DataField:
SubfieldListCIt getSubfield(char code, SubfieldListCIt _start);
Was made some small changes in interface.
Version 2013.08.27
Reusing record buffer in Record::readRec
New constructor Record(const char* _buf, unsigned _bufsize); // Create record from buffer
Refactoring
x64 build
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 ...
}
}
}
}