Listing 7: A sample application
#include "isamfile.h"
#include "plfile.h"
#include "playevnt.h"
#include <iostream.h>
int
main()
{
PlayListFile playList( "playlist.dat" );
if ( OK == playList.Open() )
{
PlayEvent playEvent;
while ( OK == playList.GetNext( playEvent ) )
{
cout << playEvent.id() << ":"
<< playEvent.name().gets() << endl;
}
PlayListFile::Iter iter( playList );
ObjIndexKey statusKey = { ISAMFile::duplicates, 1,
{{ PlayEvent::Status, 0 }} };
if ( OK == iter.Open()
&& OK == iter.AddIndex( statusKey )
&& OK == iter.SelectIndex( statusKey )
&& OK == iter.GetFirst( playEvent ) )
{
while ( !iter.IsNull( playEvent ) )
{
if ( PlayEvent::Cued == playEvent.status() )
{
cout << "first cued event is: " << playEvent.id() << endl;
break;
}
playEvent = ++iter;
}
}
}
return 0;
}
//End of File