437{
438 bool printAttributeDifferences = false;
439 bool printRelationshipDifferences = false;
440 bool printMethodDifferences = false;
441 bool printSubClasses = false;
442
443 if (argc == 1) {
446 }
447
448 for (int i = 1; i < argc; i++) {
449 if (!strcmp(argv[i], "-a"))
450 printAttributeDifferences = true;
451 else if (!strcmp(argv[i], "-r"))
452 printRelationshipDifferences = true;
453 else if (!strcmp(argv[i], "-m"))
454 printMethodDifferences = true;
455 else if (!strcmp(argv[i], "-sb"))
456 printSubClasses = true;
457 else if (!strcmp(argv[i], "-all")) {
458 printAttributeDifferences = true;
459 printRelationshipDifferences = true;
460 printMethodDifferences = true;
461 printSubClasses = true;
462 } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
465 } else if (!strcmp(argv[i], "-v")) {
468 } else if (argc == (i + 2) && argv[i][0] != '-' && argv[i + 1][0] != '-') {
471 } else {
472 std::cerr << "Unknown parameter: \"" << argv[i] << "\"\n\n";
473
476 }
477 }
478
481
482 try {
483
484 const char* szNoClasses = " No classes were found in \"";
485 const char* szExiting = ", exiting ...\n";
486
489
492
493 if (classes1.empty()) {
494 std::cerr <<
"ERROR:" << szNoClasses <<
schemaFile1 <<
"\" database file" << szExiting;
496 }
497
498 if (classes2.empty()) {
499 std::cerr <<
"ERROR:" << szNoClasses <<
schemaFile2 <<
"\" database file" << szExiting;
501 }
502
503 OksClass::Map::const_iterator class_iterator1 = classes1.begin();
504 OksClass::Map::const_iterator class_iterator2 = classes2.begin();
505
506 std::cout << std::endl;
507
509
511
512 for (; class_iterator1 != classes1.end(); ++class_iterator1) {
513 c1 = class_iterator1->second;
514 const std::string& className = c1->
get_name();
515
517 std::cout <<
"\n DIFFERENCE " << ++
classDiffsCount <<
". There is no class \"" << className <<
"\" in the \""
519
520 continue;
521 }
522
523 std::cout << "TESTING IN CLASSES \"" << className << "\"... ";
524 std::cout.flush();
525
526
527
528
529
530
531
532
533 if ((*c1 != *c2) == false) {
534 std::cout << " no differences were found\n";
535 continue;
536 }
537
538 std::cout << std::endl
539 <<
" DIFFERENCE " << ++
classDiffsCount <<
'.' <<
" The CLASSES \"" << className <<
"\" differed:\n";
540
542
546
551 }
552
555 <<
" in the FILE \"" <<
schemaFile1 <<
"\" it is: \""
557 <<
" in the FILE \"" <<
schemaFile2 <<
"\" it is: \""
559 }
560
561 {
562
564 const std::string* spn;
565
566 if (slist) {
567 for (std::list<std::string*>::const_iterator spi = slist->begin(); spi != slist->end(); ++spi) {
568 spn = *spi;
571 <<
"\" defined in the \"" <<
schemaFile2 <<
"\" database file.\n";
572
573 continue;
574 }
575 }
576 }
577
579
580 if (slist) {
581 for (std::list<std::string*>::const_iterator spi = slist->begin(); spi != slist->end(); ++spi) {
582 spn = *spi;
585 <<
"\" defined in the \"" <<
schemaFile1 <<
"\" database file.\n";
586
587 continue;
588 }
589 }
590 }
591 }
592
593 if (printSubClasses) {
594 std::cout << " ALL SUBCLASS(ES) of the CLASS \"" << className << "\"\n";
595 std::cout <<
" in the FILE \"" <<
schemaFile1 <<
"\"\n";
597 std::cout <<
" in the FILE \"" <<
schemaFile2 <<
"\"\n";
599 }
600 }
601
602 for (; class_iterator2 != classes2.end(); ++class_iterator2) {
603 if (!kernel1.
find_class(class_iterator2->second->get_name())) {
604 std::cout <<
"\n DIFFERENCE " << ++
classDiffsCount <<
". There is no class \""
605 << class_iterator2->second->get_name() <<
"\" in the \"" <<
schemaFile1 <<
"\" database file.\n";
606 }
607 }
608
609 std::cout <<
"\nFound " <<
classDiffsCount <<
" differences, exiting...\n";
610 }
611
612 catch (oks::exception& ex) {
613 std::cerr << "Caught oks exception:\n" << ex << std::endl;
615 }
616
617 catch (std::exception& e) {
618 std::cerr << "Caught standard C++ exception: " << e.what() << std::endl;
620 }
621
623}
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)