Rev | Line | |
---|
[583] | 1 | #include <stdio.h>
|
---|
| 2 | #include <stdlib.h>
|
---|
| 3 | #include <typeinfo>
|
---|
| 4 | #include <iostream.h>
|
---|
| 5 | #include <string>
|
---|
| 6 |
|
---|
| 7 | #include "ppersist.h"
|
---|
| 8 | #include "anydataobj.h"
|
---|
| 9 | #include "sambainit.h"
|
---|
| 10 |
|
---|
[742] | 11 | #ifdef __MWERKS__
|
---|
| 12 | #include <console.h>
|
---|
| 13 | #endif
|
---|
| 14 |
|
---|
[583] | 15 | int main(int narg, char* arg[])
|
---|
| 16 | {
|
---|
[742] | 17 |
|
---|
| 18 | #ifdef __MWERKS__
|
---|
| 19 | narg = ccommand(&arg);
|
---|
| 20 | #endif
|
---|
| 21 |
|
---|
[583] | 22 | SambaInitiator smbinit;
|
---|
| 23 |
|
---|
| 24 | if (narg < 2) {
|
---|
[589] | 25 | cerr << " Usage: scanppf filename [s]\n " << endl;
|
---|
[583] | 26 | exit(0);
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | try {
|
---|
| 30 | string flnm = arg[1];
|
---|
[589] | 31 | bool seq=false;
|
---|
| 32 | if (narg > 2) seq=true;
|
---|
[583] | 33 | PPersist* op = NULL;
|
---|
| 34 | cout << " Opening PPF file " << flnm << endl;
|
---|
| 35 | PInPersist s(flnm);
|
---|
| 36 | int nt = s.NbTags();
|
---|
| 37 | cout << " Number of tags in file = " << nt << endl;
|
---|
| 38 | if (nt < 1) {
|
---|
| 39 | op = s.ReadObject();
|
---|
| 40 | cout << " Object Type " << typeid(*op).name() << endl;
|
---|
| 41 | if (op) delete op;
|
---|
| 42 | }
|
---|
[589] | 43 | else if (!seq) {
|
---|
| 44 | for(int i=0; i<nt; i++) {
|
---|
| 45 | cout << ">>> TagNum= " << i << " TagName= " << s.GetTagName(i) << endl;
|
---|
| 46 | s.GotoTagNum(i);
|
---|
| 47 | op = s.ReadObject();
|
---|
| 48 | cout << " Object Type " << typeid(*op).name() << endl;
|
---|
| 49 | if (op) delete op;
|
---|
| 50 | }
|
---|
| 51 | } else {
|
---|
| 52 | while (1) {
|
---|
| 53 | op = s.ReadObject();
|
---|
| 54 | cout << " Object Type " << typeid(*op).name() << endl;
|
---|
| 55 | if (op) delete op;
|
---|
| 56 | }
|
---|
[583] | 57 | }
|
---|
| 58 | }
|
---|
| 59 | catch (PThrowable pex) {
|
---|
| 60 | cerr << " scanppf/Error - Exception catched " << pex.Msg() << endl;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | cout << " ----------- End of scanppf ------------- " << endl;
|
---|
| 64 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.