#include <cstdlib>
using namespace std;
class Book {
public:
char* PrintTitle( ) { return( title ); };
bool Unpack( TextBuffer& );
private:
char title[128];
char ISBN[12];
char authors[128];
char price[8];
int quantity;
};
bool Book::Unpack( TextBuffer& buffer ) {
char temp[6];
if ( !buffer.Unpack( title, "<title>", "</title>" ) )
return( false );
if ( !buffer.Unpack( ISBN, "<ISBN>", "</ISBN>" ) )
return( false );
if ( !buffer.Unpack( authors, "<authors>", "</authors>" ) )
return( false );
if ( !buffer.Unpack( price, "<price>", "</price>" ) )
return( false );
if ( !buffer.Unpack( temp, "<quantity>", "</quantity>" ) )
return( false );
quantity = atoi( temp );
return( true );
}
|