415{
416 bool printAttributeDifferences = false;
417 bool printRelationshipDifferences = false;
418 bool printMethodDifferences = false;
419 bool printSubClasses = false;
420
421 if(argc == 1) {
424 }
425
426 for(int i = 1; i < argc; i++) {
427 if(!strcmp(argv[i], "-a"))
428 printAttributeDifferences = true;
429 else if(!strcmp(argv[i], "-r"))
430 printRelationshipDifferences = true;
431 else if(!strcmp(argv[i], "-m"))
432 printMethodDifferences = true;
433 else if(!strcmp(argv[i], "-sb"))
434 printSubClasses = true;
435 else if(!strcmp(argv[i], "-all")) {
436 printAttributeDifferences = true;
437 printRelationshipDifferences = true;
438 printMethodDifferences = true;
439 printSubClasses = true;
440 }
441 else if(!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
444 }
445 else if(!strcmp(argv[i], "-v")) {
448 }
449 else if(argc == (i + 2) && argv[i][0] != '-' && argv[i+1][0] != '-') {
452 }
453 else {
454 std::cerr << "Unknown parameter: \"" << argv[i] << "\"\n\n";
455
458 }
459 }
460
461
464
465 try {
466
467 const char *szNoClasses = " No classes were found in \"";
468 const char *szExiting = ", exiting ...\n";
469
472
475
476 if(classes1.empty()) {
477 std::cerr <<
"ERROR:" << szNoClasses <<
schemaFile1 <<
"\" database file" << szExiting;
479 }
480
481 if(classes2.empty()) {
482 std::cerr <<
"ERROR:" << szNoClasses <<
schemaFile2 <<
"\" database file" << szExiting;
484 }
485
486 OksClass::Map::const_iterator class_iterator1 = classes1.begin();
487 OksClass::Map::const_iterator class_iterator2 = classes2.begin();
488
489 std::cout << std::endl;
490
491
493
495
496 for(;class_iterator1 != classes1.end();++class_iterator1) {
497 c1 = class_iterator1->second;
498 const std::string& className = c1->
get_name();
499
501 std::cout <<
"\n DIFFERENCE " << ++
classDiffsCount <<
". There is no class \"" << className <<
"\" in the \"" <<
schemaFile2 <<
"\" database file.\n";
502
503 continue;
504 }
505
506 std::cout << "TESTING IN CLASSES \"" << className << "\"... ";
507 std::cout.flush();
508
509
510
511
512
513
514
515
516
517 if((*c1 != *c2) == false) {
518 std::cout << " no differences were found\n";
519 continue;
520 }
521
523 << " The CLASSES \"" << className << "\" differed:\n";
524
526
530
533 << " The Class Descriptions differed: \n"
536 }
537
540 << " The Class Abstraction differed: \n"
543 }
544
545
546 {
547
549 const std::string *spn;
550
551 if(slist) {
552 for(std::list<std::string *>::const_iterator spi = slist->begin(); spi != slist->end(); ++spi) {
553 spn = *spi;
556 <<
" There is no SUPERCLASS \"" << *spn <<
"\" defined in the \"" <<
schemaFile2 <<
"\" database file.\n";
557
558 continue;
559 }
560 }
561 }
562
564
565 if(slist) {
566 for(std::list<std::string *>::const_iterator spi = slist->begin(); spi != slist->end(); ++spi) {
567 spn = *spi;
570 <<
" There is no SUPERCLASS \"" << *spn <<
"\" defined in the \"" <<
schemaFile1 <<
"\" database file.\n";
571
572 continue;
573 }
574 }
575 }
576 }
577
578
579 if(printSubClasses) {
580 std::cout << " ALL SUBCLASS(ES) of the CLASS \"" << className << "\"\n";
583 }
584 }
585
586 for(;class_iterator2 != classes2.end();++class_iterator2) {
587 if(!kernel1.
find_class(class_iterator2->second->get_name())) {
588 std::cout <<
"\n DIFFERENCE " << ++
classDiffsCount <<
". There is no class \"" << class_iterator2->second->get_name() <<
"\" in the \"" <<
schemaFile1 <<
"\" database file.\n";
589 }
590 }
591
592 std::cout <<
"\nFound " <<
classDiffsCount <<
" differences, exiting...\n";
593 }
594
595 catch (oks::exception & ex) {
596 std::cerr << "Caught oks exception:\n" << ex << std::endl;
598 }
599
600 catch (std::exception & e) {
601 std::cerr << "Caught standard C++ exception: " << e.what() << std::endl;
603 }
604
606}
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
std::map< const char *, OksClass *, SortStr > Map
const std::list< std::string * > * direct_super_classes() const noexcept
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)