/********************************************************************** * * IsisGdl.cpp * Copyright (C) 2003 UNESCO * * A component of the Greenstone digital library software * from the New Zealand Digital Library Project at the * University of Waikato, New Zealand. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *********************************************************************/ // IsisGdl.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "IsisDb.h" #include void PausePrg() { std::cout << "\n"; std::cout << "Press enter to continue..." << "\n"; std::cin.get(); } void ClearInputStream(std::istream &s) // Used to clear istream { char c; s.clear(); while(s.get(c) && c != '\n') { ; } } // Should be called with the master file name as parameter // IsisGdl "full_path\master_file_name" // IsisGdl C:\IsisGdl\cds.mst for ex int main(int argc, _TCHAR* argv[]) { if (argc < 2) { std::cout << "usage: IsisGdl master_file_full_name" << std::endl; return 1; } // Instantiation of the IsisDb Object IsisDb db; try { // The file name should be prefixed with the full path // and should be the master file name with extension ".mst" // "C:\IsisGdl\cds.mst" for ex db.OpenDb(argv[1]); } catch(CIsisDbException e) { std::string msg = "Cannot open isis db: "; msg += argv[1]; msg += isisExceptionMessage((IsisError) e.m_iError); std::cerr<< msg << std::endl; return false; } // Create a Master File object without the Field Definition // Information MfRecord mfr(0); // Extract the number of the next master file number to // assign const long nextMfn = db.GetNextMfn(); // Browse the master file in increasing order of Master // file numbers (MFN is the record ID) for (long i=1; i" are terms/Phrases to // index std::vector vf = mfr.GetFieldTags(); std::cout << "----------" << std::endl; // << "mfn=" << i // << " nvf=" << vf.size() << std::endl; for (int j=0; jSHRT_MAX) continue; // Extract the field with tag contained into vf[j] bool rc = mfr.GetField(vf[j], stemp); if (rc) { std::cout << "tag=" << vf[j] << " data=" << stemp << std::endl; } } } else continue; // PausePrg(); } return 0; }