---------------------------------------------------------------------
CLASS: CmrReader --trp
PUBLIC METHODS:
setInFile
Define the input CMR file.
setCallBackFunctions()
Define the application callback functions.
USAGE NOTES:
cmrparse
Initiate the CMR file read. The name "cmrparse" comes from the
use of flex/bison. Please note that the cmrparse member function
is bison(yacc) generated, and will not be found in the
cmrReader.C file. See the Makefile "sed" line for file names.
I've compiled and run this example. Assuming the flex, bison, rogue wave,
cmr.a, and archive library files are available for linking, and you have a
syntax valid file specified in the constructor (e.g. "tree.txt"), you
should have no trouble running this. Here is how I built my file,
called "foo.C":
g++ -D_INCLUDE__STDC__ -I../devs -I.. -I../devsTest
-D_INCLUDE__STDC__ -DNSR_VERIFY -DMSTEST -D_HP_ALIASES_ -c foo.C
g++ -o foo foo.o cmr.a msLib.o acptlib.o -ly -lfl -lrwtool
#include "cmr.h"
int trace =0; // Required by the archive library.
void *myStartDir (void *parent, char *dirName, Attributes& attr){
printf ("dir %s\n", dirName);
// Simple example, doesn't care about directory parents.
return NULL;
}
void myEndDir (void *parent) {printf ("end of some dir\n");}
void myFile (char *fileName, Attributes& attr, ExtentList& elist){
printf ("file %s\n", fileName);
}
void mySymlink (char *symLinkName, Attributes& attr,
PathElementList& plist){
printf ("file %s\n", symLinkName);
}
main ()
{
CmrReader myReader ("tree.txt", myStartDir, myEndDir, myFile,
mySymlink);
myReader.cmrparse();
}
----------------------------------------------------------------------
---------------------------------------------------------------------
METHOD: CmrReader::setCallBackFunctions --trp
Means (other than one of the constructors) to define app
callback functions.
ARGS:
StartDirFunc userStartDir IN app code func to be called with
dir start info
EndDirFunc userEndDir IN app code func to be called with
dir end info
FileFunc userFile IN app code func to be called with
file info
SymlinkFun userSymlink IN app code func to be called with
symlink info
RETURNS:
void
PRE-CONDITIONS:
POST-CONDITIONS:
The app function pointers are saved.
ERRORS:
NOTES:
----------------------------------------------------------------------
void
CmrReader::setCallBackFunctions(
StartDirFunc userStartDir, EndDirFunc userEndDir,
FileFunc userFile, SymlinkFunc userSymlink)