408{
409 bool printAttributeDifferences = false;
410 bool printRelationshipDifferences = false;
411 bool printMethodDifferences = false;
412 bool printSubClasses = false;
413
414 if(argc == 1) {
417 }
418
419 for(int i = 1; i < argc; i++) {
420 if(!strcmp(argv[i], "-a"))
421 printAttributeDifferences = true;
422 else if(!strcmp(argv[i], "-r"))
423 printRelationshipDifferences = true;
424 else if(!strcmp(argv[i], "-m"))
425 printMethodDifferences = true;
426 else if(!strcmp(argv[i], "-sb"))
427 printSubClasses = true;
428 else if(!strcmp(argv[i], "-all")) {
429 printAttributeDifferences = true;
430 printRelationshipDifferences = true;
431 printMethodDifferences = true;
432 printSubClasses = true;
433 }
434 else if(!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
437 }
438 else if(!strcmp(argv[i], "-v")) {
441 }
442 else if(argc == (i + 2) && argv[i][0] != '-' && argv[i+1][0] != '-') {
445 }
446 else {
447 std::cerr << "Unknown parameter: \"" << argv[i] << "\"\n\n";
448
451 }
452 }
453
454
457
458 try {
459
460 const char *szNoClasses = " No classes were found in \"";
461 const char *szExiting = ", exiting ...\n";
462
465
468
469 if(classes1.empty()) {
470 std::cerr <<
"ERROR:" << szNoClasses <<
schemaFile1 <<
"\" database file" << szExiting;
472 }
473
474 if(classes2.empty()) {
475 std::cerr <<
"ERROR:" << szNoClasses <<
schemaFile2 <<
"\" database file" << szExiting;
477 }
478
479 OksClass::Map::const_iterator class_iterator1 = classes1.begin();
480 OksClass::Map::const_iterator class_iterator2 = classes2.begin();
481
482 std::cout << std::endl;
483
484
486
488
489 for(;class_iterator1 != classes1.end();++class_iterator1) {
490 c1 = class_iterator1->second;
491 const std::string& className = c1->
get_name();
492
494 std::cout <<
"\n DIFFERENCE " << ++
classDiffsCount <<
". There is no class \"" << className <<
"\" in the \"" <<
schemaFile2 <<
"\" database file.\n";
495
496 continue;
497 }
498
499 std::cout << "TESTING IN CLASSES \"" << className << "\"... ";
500 std::cout.flush();
501
502
503
504
505
506
507
508
509
510 if((*c1 != *c2) == false) {
511 std::cout << " no differences were found\n";
512 continue;
513 }
514
516 << " The CLASSES \"" << className << "\" differed:\n";
517
519
523
526 << " The Class Descriptions differed: \n"
529 }
530
533 << " The Class Abstraction differed: \n"
536 }
537
538
539 {
540
542 const std::string *spn;
543
544 if(slist) {
545 for(std::list<std::string *>::const_iterator spi = slist->begin(); spi != slist->end(); ++spi) {
546 spn = *spi;
549 <<
" There is no SUPERCLASS \"" << *spn <<
"\" defined in the \"" <<
schemaFile2 <<
"\" database file.\n";
550
551 continue;
552 }
553 }
554 }
555
557
558 if(slist) {
559 for(std::list<std::string *>::const_iterator spi = slist->begin(); spi != slist->end(); ++spi) {
560 spn = *spi;
563 <<
" There is no SUPERCLASS \"" << *spn <<
"\" defined in the \"" <<
schemaFile1 <<
"\" database file.\n";
564
565 continue;
566 }
567 }
568 }
569 }
570
571
572 if(printSubClasses) {
573 std::cout << " ALL SUBCLASS(ES) of the CLASS \"" << className << "\"\n";
576 }
577 }
578
579 for(;class_iterator2 != classes2.end();++class_iterator2) {
580 if(!kernel1.
find_class(class_iterator2->second->get_name())) {
581 std::cout <<
"\n DIFFERENCE " << ++
classDiffsCount <<
". There is no class \"" << class_iterator2->second->get_name() <<
"\" in the \"" <<
schemaFile1 <<
"\" database file.\n";
582 }
583 }
584
585 std::cout <<
"\nFound " <<
classDiffsCount <<
" differences, exiting...\n";
586 }
587
588 catch (oks::exception & ex) {
589 std::cerr << "Caught oks exception:\n" << ex << std::endl;
591 }
592
593 catch (std::exception & e) {
594 std::cerr << "Caught standard C++ exception: " << e.what() << std::endl;
596 }
597
599}
bool get_is_abstract() const noexcept
OksClass * find_super_class(const std::string &) const noexcept
const std::string & get_name() const noexcept
const std::string & get_description() const noexcept
const std::list< std::string * > * direct_super_classes() const noexcept
std::map< const char *, OksClass *, SortStr > Map
Provides interface to the OKS kernel.
OksFile * load_file(const std::string &name, bool bind=true)
Load OKS database file.
const OksClass::Map & classes() const
Get classes.
static const char * GetVersion()
Get OKS version. The method returns string containing CVS tag and date of OKS build.
OksClass * find_class(const std::string &class_name) const
Find class by name (C++ string).
static void relationshipsTest(bool printRelationshipDifferences, OksClass *c1, OksClass *c2)
static void ReportSubClasses(OksClass *c)
static void methodsTest(bool printMethodDifferences, OksClass *c1, OksClass *c2)
static void attributesTest(bool printAttributeDifferences, OksClass *c1, OksClass *c2)
static void printUsage(std::ostream &s)