LCOV - code coverage report
Current view: top level - dbe/apps/SchemaEditor - SchemaKernelWrapper.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 456 0
Test Date: 2026-07-12 15:23:06 Functions: 0.0 % 67 0

            Line data    Source code
       1              : // DUNE DAQ modification notice:
       2              : // This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
       3              : // Fork baseline commit: dbe-02-12-17 (2022-05-12).
       4              : // Renamed since fork: yes (from src/SchemaEditor/SchemaKernelWrapper.cpp to apps/SchemaEditor/SchemaKernelWrapper.cpp).
       5              : 
       6              : /// Including QT
       7              : #include <QMessageBox>
       8              : /// Including Schema
       9              : #include "dbe/SchemaKernelWrapper.hpp"
      10              : /// Include oks
      11              : #include "oks/kernel.hpp"
      12              : #include "oks/class.hpp"
      13              : #include "oks/file.hpp"
      14              : 
      15              : using namespace dunedaq;
      16              : using namespace dunedaq::oks;
      17              : 
      18            0 : dbse::KernelWrapper & dbse::KernelWrapper::GetInstance()
      19              : {
      20            0 :   static KernelWrapper KernelManager;
      21            0 :   return KernelManager;
      22              : }
      23              : 
      24            0 : OksKernel * dbse::KernelWrapper::GetKernel()
      25              : {
      26            0 :   return Kernel;
      27              : }
      28              : 
      29            0 : void dbse::KernelWrapper::SetActiveSchema ( const std::string & ActiveSchema )
      30              : {
      31            0 :   OksFile * File = Kernel->find_schema_file ( ActiveSchema );
      32              : 
      33            0 :   if ( File && IsFileWritable( ActiveSchema ))
      34              :   {
      35            0 :     Kernel->set_active_schema ( File );
      36            0 :     emit active_updated();
      37              :   }
      38            0 : }
      39              : 
      40            0 : void dbse::KernelWrapper::GetClassList ( std::vector<OksClass *> & ClassList ) const
      41              : {
      42            0 :   for ( OksClass::Map::const_iterator i = Kernel->classes().begin();
      43            0 :         i != Kernel->classes().end(); ++i )
      44              :   {
      45            0 :     ClassList.push_back ( i->second );
      46              :   }
      47            0 : }
      48              : 
      49            0 : void dbse::KernelWrapper::GetClassListString ( QStringList & ClassListString ) const
      50              : {
      51            0 :   std::vector<OksClass *> ClassList;
      52              : 
      53            0 :   for ( OksClass::Map::const_iterator i = Kernel->classes().begin();
      54            0 :         i != Kernel->classes().end(); ++i )
      55              :   {
      56            0 :     ClassList.push_back ( i->second );
      57              :   }
      58              : 
      59            0 :   for ( OksClass * ClassInfo : ClassList )
      60              :   {
      61            0 :     ClassListString.append ( QString::fromStdString ( ClassInfo->get_name() ) );
      62              :   }
      63            0 : }
      64              : 
      65            0 : std::string dbse::KernelWrapper::GetActiveSchema () const
      66              : {
      67            0 :   auto file = Kernel->get_active_schema();
      68            0 :   if ( file) {
      69            0 :     return file->get_full_file_name();
      70              :   }
      71              :   else {
      72            0 :     return "";
      73              :   }
      74              : }
      75              : 
      76              : // void dbse::KernelWrapper::AddInclude( std::string IncludeFile ) const
      77              : // {
      78              : //   auto ActiveSchema = Kernel->get_active_schema();
      79              : //   ActiveSchema->add_include_file( IncludeFile );
      80              : //   Kernel->load_schema( IncludeFile, ActiveSchema );
      81              : // }
      82            0 : void dbse::KernelWrapper::AddInclude( std::string schemaFile, std::string IncludeFile ) const
      83              : {
      84            0 :   auto ParentSchema = Kernel->find_schema_file( schemaFile );
      85            0 :   if ( ParentSchema != nullptr) {
      86            0 :     ParentSchema->add_include_file( IncludeFile );
      87            0 :     Kernel->load_schema( IncludeFile, ParentSchema );
      88              :   }
      89            0 : }
      90              : 
      91            0 : void dbse::KernelWrapper::RemoveInclude( std::string schemaFile, std::string IncludeFile ) const
      92              : {
      93            0 :   auto ParentSchema = Kernel->find_schema_file( schemaFile );
      94            0 :   if (ParentSchema != nullptr) {
      95            0 :     ParentSchema->remove_include_file( IncludeFile );
      96              :   }
      97            0 : }
      98              : 
      99            0 : void dbse::KernelWrapper::GetSchemaFiles ( std::vector<std::string> & SchemaFiles )
     100              : {
     101            0 :   for ( OksFile::Map::const_iterator i = Kernel->schema_files().begin();
     102            0 :         i != Kernel->schema_files().end(); ++i )
     103              :   {
     104            0 :     SchemaFiles.push_back ( * ( i->first ) );
     105              :   }
     106            0 : }
     107              : 
     108            0 : void dbse::KernelWrapper::GetSchemaFiles ( std::vector<OksFile*> & SchemaFiles )
     109              : {
     110            0 :   for (auto [name, file]:  Kernel->schema_files())
     111              :   {
     112            0 :     SchemaFiles.push_back ( file );
     113              :   }
     114            0 : }
     115              : 
     116              : std::vector<OksClass*>
     117            0 : dbse::KernelWrapper::get_schema_classes (std::string& filename)
     118              : {
     119            0 :   auto file = Kernel->find_schema_file ( filename );
     120            0 :   std::vector<OksClass*> list;
     121            0 :   auto klist = Kernel->create_list_of_schema_classes(file);
     122            0 :   if (klist != nullptr) {
     123            0 :     for (auto cls: *klist) {
     124            0 :       list.push_back(cls/*->get_name()*/);
     125              :     }
     126            0 :     delete klist;
     127              :   }
     128            0 :   return list;
     129            0 : }
     130              : 
     131            0 : void dbse::KernelWrapper::GetIncludedList ( const std::string & filename,
     132              :                                             std::set<std::string> & included_files )
     133              : {
     134            0 :   Kernel->get_includes ( filename, included_files );
     135            0 : }
     136            0 : void dbse::KernelWrapper::get_all_includes ( const std::string & filename,
     137              :                                             std::set<std::string> & included_files )
     138              : {
     139            0 :   auto parentschema = Kernel->find_schema_file( filename );
     140            0 :   if ( parentschema != nullptr) {
     141            0 :     std::set<OksFile*> includes;
     142            0 :     parentschema->get_all_include_files(Kernel, includes);
     143            0 :     for (auto file : includes) {
     144            0 :       included_files.insert(file->get_full_file_name());
     145              :     }
     146            0 :   }
     147            0 : }
     148              : 
     149            0 : void dbse::KernelWrapper::get_direct_includes ( const std::string & filename,
     150              :                                             std::set<std::string> & included_files )
     151              : {
     152            0 :   auto parentschema = Kernel->find_schema_file( filename );
     153            0 :   if ( parentschema != nullptr) {
     154            0 :     for (auto file : parentschema->get_include_files()) {
     155            0 :       included_files.insert(file);
     156            0 :     }
     157              :   }
     158            0 : }
     159              : 
     160            0 : bool dbse::KernelWrapper::IsFileWritable (const std::string & FileName ) const
     161              : {
     162            0 :   OksFile * File = Kernel->find_schema_file ( FileName );
     163              : 
     164            0 :   if ( File )
     165              :   {
     166            0 :     return ( !File->is_read_only() );
     167              :   }
     168              : 
     169              :   return false;
     170              : }
     171              : 
     172            0 : bool dbse::KernelWrapper::is_file_modified (const std::string & FileName ) const
     173              : {
     174            0 :   OksFile* file = Kernel->find_schema_file ( FileName );
     175            0 :   if (file != nullptr) {
     176            0 :     return file->is_updated();
     177              :   }
     178              :   return false;
     179              : }
     180              : 
     181            0 : OksClass * dbse::KernelWrapper::FindClass ( std::string ClassName ) const
     182              : {
     183            0 :   return Kernel->find_class ( ClassName );
     184              : }
     185              : 
     186            0 : OksFile* dbse::KernelWrapper::LoadSchema ( const std::string & SchemaName ) const
     187              : {
     188            0 :   return Kernel->load_schema ( SchemaName );
     189              : }
     190              : 
     191            0 : void dbse::KernelWrapper::SaveAllSchema() const
     192              : {
     193            0 :   Kernel->save_all_schema();
     194            0 : }
     195              : 
     196            0 : std::string dbse::KernelWrapper::ModifiedSchemaFiles() const
     197              : {
     198            0 :   std::string modified{""};
     199            0 :   for (auto [name, file] : Kernel->schema_files()) {
     200            0 :     if (file->is_updated()) {
     201            0 :       modified += file->get_full_file_name() + "\n\n";
     202              :     }
     203              :   }
     204            0 :   return modified;
     205            0 : }
     206              : 
     207            0 : std::vector<std::string> dbse::KernelWrapper::get_modified_schema_files() const
     208              : {
     209            0 :   std::vector<std::string> modified;
     210            0 :   for (auto [name, file] : Kernel->schema_files()) {
     211            0 :     if (file->is_updated()) {
     212            0 :       modified.push_back(file->get_full_file_name());
     213              :     }
     214              :   }
     215            0 :   return modified;
     216            0 : }
     217              : 
     218            0 : std::string dbse::KernelWrapper::SaveModifiedSchema() const
     219              : {
     220            0 :   std::string saved{""};
     221            0 :   for (auto [name, file] : Kernel->schema_files()) {
     222            0 :     if (file->is_updated()) {
     223            0 :       Kernel->save_schema(file);
     224            0 :       saved += file->get_full_file_name() + "\n\n";
     225              :     }
     226              :   }
     227            0 :   return saved;
     228            0 : }
     229              : 
     230            0 : void dbse::KernelWrapper::SaveSchema(const std::string& schema_file) const
     231              : {
     232            0 :   OksFile * file = Kernel->find_schema_file ( schema_file );
     233            0 :   Kernel->save_schema(file);
     234            0 : }
     235              : 
     236              : 
     237            0 : void dbse::KernelWrapper::CloseAllSchema() const
     238              : {
     239            0 :   Kernel->close_all_schema();
     240            0 : }
     241              : 
     242            0 : void dbse::KernelWrapper::CreateNewSchema ( const std::string & SchemaName ) const
     243              : {
     244            0 :   Kernel->new_schema ( SchemaName );
     245            0 : }
     246              : 
     247            0 : bool dbse::KernelWrapper::AnyClassReferenceThis ( OksClass * SchemaClass )
     248              : {
     249            0 :   std::vector<OksClass *> ClassList;
     250            0 :   GetClassList ( ClassList );
     251              : 
     252            0 :   for ( OksClass * ClassInfo : ClassList )
     253              :   {
     254            0 :     const std::list<OksRelationship *> * RelationshipList = ClassInfo->direct_relationships();
     255              : 
     256            0 :     if ( RelationshipList != nullptr )
     257              :     {
     258            0 :       for ( OksRelationship * RelationshipInfo : *RelationshipList )
     259              :       {
     260            0 :         if ( RelationshipInfo->get_class_type()->get_name() == SchemaClass->get_name() )
     261              :         {
     262            0 :           return true;
     263              :         }
     264              :       }
     265              :     }
     266              :   }
     267              : 
     268            0 :   return false;
     269            0 : }
     270              : 
     271            0 : QString dbse::KernelWrapper::GetCardinalityStringRelationship (
     272              :   OksRelationship * SchemaRelationship ) const
     273              : {
     274            0 :   QString RelationshipLowCc (
     275            0 :     OksRelationship::card2str ( SchemaRelationship->get_low_cardinality_constraint() ) );
     276            0 :   QString RelationshipHighCc (
     277            0 :     OksRelationship::card2str ( SchemaRelationship->get_high_cardinality_constraint() ) );
     278              : 
     279            0 :   if ( RelationshipLowCc == "zero" )
     280              :   {
     281            0 :     RelationshipLowCc = "0";
     282              :   }
     283            0 :   else if ( RelationshipLowCc == "one" )
     284              :   {
     285            0 :     RelationshipLowCc = "1";
     286              :   }
     287            0 :   else if ( RelationshipLowCc == "many" )
     288              :   {
     289            0 :     RelationshipLowCc = "n";
     290              :   }
     291              : 
     292            0 :   if ( RelationshipHighCc == "zero" )
     293              :   {
     294            0 :     RelationshipHighCc = "0";
     295              :   }
     296            0 :   else if ( RelationshipHighCc == "one" )
     297              :   {
     298            0 :     RelationshipHighCc = "1";
     299              :   }
     300            0 :   else if ( RelationshipHighCc == "many" )
     301              :   {
     302            0 :     RelationshipHighCc = "n";
     303              :   }
     304              : 
     305            0 :   return QString ( RelationshipLowCc + ':' + RelationshipHighCc );
     306            0 : }
     307              : 
     308            0 : bool dbse::KernelWrapper::IsActive() const
     309              : {
     310            0 :   OksFile * ActiveSchemaFile = Kernel->get_active_schema();
     311            0 :   return ( ActiveSchemaFile != nullptr );
     312              : }
     313              : 
     314            0 : void dbse::KernelWrapper::SetInheritanceMode ( bool Mode )
     315              : {
     316            0 :   InheritanceMode = Mode;
     317            0 : }
     318              : 
     319            0 : bool dbse::KernelWrapper::GetInheritanceMode() const
     320              : {
     321            0 :   return InheritanceMode;
     322              : }
     323              : 
     324            0 : QUndoStack * dbse::KernelWrapper::GetUndoStack()
     325              : {
     326            0 :   return CommandStack;
     327              : }
     328              : 
     329            0 : void dbse::KernelWrapper::PushSetAbstractClassCommand ( OksClass * Class, bool Value )
     330              : {
     331            0 :   try
     332              :   {
     333            0 :     CommandStack->push ( new SetAbstractClassCommand ( Class, Value ) );
     334              :   }
     335            0 :   catch ( oks::exception & Ex )
     336              :   {
     337            0 :     QMessageBox::warning ( 0, "Schema editor",
     338            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     339            0 :   }
     340            0 : }
     341              : 
     342            0 : void dbse::KernelWrapper::PushSetDescriptionClassCommand ( OksClass * Class,
     343              :                                                            std::string Description )
     344              : {
     345            0 :   try
     346              :   {
     347            0 :     CommandStack->push ( new SetDescriptionClassCommand ( Class, Description ) );
     348              :   }
     349            0 :   catch ( oks::exception & Ex )
     350              :   {
     351            0 :     QMessageBox::warning ( 0, "Schema editor",
     352            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     353            0 :   }
     354            0 : }
     355              : 
     356            0 : void dbse::KernelWrapper::PushAddSuperClassCommand ( OksClass * Class,
     357              :                                                      std::string SuperClass )
     358              : {
     359            0 :   try
     360              :   {
     361            0 :     CommandStack->push ( new AddSuperClassCommand ( Class, SuperClass ) );
     362              :   }
     363            0 :   catch ( oks::exception & Ex )
     364              :   {
     365            0 :     QMessageBox::warning ( 0, "Schema editor",
     366            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     367            0 :   }
     368            0 : }
     369              : 
     370            0 : void dbse::KernelWrapper::PushRemoveSuperClassCommand ( OksClass * Class,
     371              :                                                      std::string SuperClass )
     372              : {
     373            0 :   try
     374              :   {
     375            0 :     CommandStack->push ( new RemoveSuperClassCommand ( Class, SuperClass ) );
     376              :   }
     377            0 :   catch ( oks::exception & Ex )
     378              :   {
     379            0 :     QMessageBox::warning ( 0, "Schema editor",
     380            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     381            0 :   }
     382            0 : }
     383              : 
     384            0 : void dbse::KernelWrapper::PushCreateClassCommand ( std::string ClassName,
     385              :                                                    std::string ClassDescription,
     386              :                                                    bool Abstract )
     387              : {
     388            0 :   try
     389              :   {
     390            0 :     CommandStack->push ( new CreateClassCommand ( ClassName, ClassDescription, Abstract ) );
     391              :   }
     392            0 :   catch ( ... )
     393              :   {
     394            0 :     QMessageBox::warning ( 0, "Schema editor", QString ( "Error" ) );
     395            0 :   }
     396            0 : }
     397              : 
     398            0 : void dbse::KernelWrapper::PushRemoveClassCommand ( OksClass * Class, std::string ClassName,
     399              :                                                    std::string ClassDescription, bool Abstract )
     400              : {
     401            0 :   try
     402              :   {
     403            0 :     CommandStack->push ( new RemoveClassCommand ( Class, ClassName, ClassDescription,
     404            0 :                                                   Abstract ) );
     405              :   }
     406            0 :   catch ( oks::exception & Ex )
     407              :   {
     408            0 :     QMessageBox::warning ( 0, "Schema editor",
     409            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     410            0 :   }
     411            0 : }
     412              : 
     413            0 : void dbse::KernelWrapper::PushSetNameRelationshipCommand ( OksClass* Class,
     414              :                                                            OksRelationship * Relationship,
     415              :                                                            std::string Name )
     416              : {
     417            0 :   try
     418              :   {
     419            0 :     CommandStack->push ( new SetNameRelationshipCommand ( Class, Relationship, Name ) );
     420              :   }
     421            0 :   catch ( oks::exception & Ex )
     422              :   {
     423            0 :     QMessageBox::warning ( 0, "Schema editor",
     424            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     425            0 :   }
     426            0 : }
     427              : 
     428            0 : void dbse::KernelWrapper::PushSetClassTypeRelationshipCommand ( OksClass* Class,
     429              :                                                                 OksRelationship * Relationship,
     430              :                                                                 std::string ClassType )
     431              : {
     432            0 :   try
     433              :   {
     434            0 :     CommandStack->push ( new SetClassTypeRelationshipCommand ( Class, Relationship, ClassType ) );
     435              :   }
     436            0 :   catch ( oks::exception & Ex )
     437              :   {
     438            0 :     QMessageBox::warning ( 0, "Schema editor",
     439            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     440            0 :   }
     441            0 : }
     442              : 
     443            0 : void dbse::KernelWrapper::PushSetDescriptionRelationshipCommand (
     444              :   OksClass* Class,
     445              :   OksRelationship * Relationship,
     446              :   std::string Description )
     447              : {
     448            0 :   try
     449              :   {
     450            0 :     CommandStack->push ( new SetDescriptionRelationshipCommand ( Class, Relationship, Description ) );
     451              :   }
     452            0 :   catch ( oks::exception & Ex )
     453              :   {
     454            0 :     QMessageBox::warning ( 0, "Schema editor",
     455            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     456            0 :   }
     457            0 : }
     458              : 
     459            0 : void dbse::KernelWrapper::PushSetLowCcRelationshipCommand (
     460              :   OksClass* Class, OksRelationship * Relationship, OksRelationship::CardinalityConstraint NewCardinality )
     461              : {
     462            0 :   try
     463              :   {
     464            0 :     CommandStack->push ( new SetLowCcRelationshipCommand ( Class, Relationship, NewCardinality ) );
     465              :   }
     466            0 :   catch ( oks::exception & Ex )
     467              :   {
     468            0 :     QMessageBox::warning ( 0, "Schema editor",
     469            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     470            0 :   }
     471            0 : }
     472              : 
     473            0 : void dbse::KernelWrapper::PushSetHighCcRelationshipCommand (
     474              :   OksClass* Class, OksRelationship * Relationship, OksRelationship::CardinalityConstraint NewCardinality )
     475              : {
     476            0 :   try
     477              :   {
     478            0 :     CommandStack->push ( new SetHighCcRelationshipCommand ( Class, Relationship, NewCardinality ) );
     479              :   }
     480            0 :   catch ( oks::exception & Ex )
     481              :   {
     482            0 :     QMessageBox::warning ( 0, "Schema editor",
     483            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     484            0 :   }
     485            0 : }
     486              : 
     487            0 : void dbse::KernelWrapper::PushSetIsCompositeRelationshipCommand (
     488              :   OksClass* Class, OksRelationship * Relationship,
     489              :   bool Value )
     490              : {
     491            0 :   try
     492              :   {
     493            0 :     CommandStack->push ( new SetIsCompositeRelationshipCommand ( Class, Relationship, Value ) );
     494              :   }
     495            0 :   catch ( oks::exception & Ex )
     496              :   {
     497            0 :     QMessageBox::warning ( 0, "Schema editor",
     498            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     499            0 :   }
     500            0 : }
     501              : 
     502            0 : void dbse::KernelWrapper::PushSetIsDependentRelationshipCommand (
     503              :   OksClass* Class,
     504              :   OksRelationship * Relationship,
     505              :   bool Value )
     506              : {
     507            0 :   try
     508              :   {
     509            0 :     CommandStack->push ( new SetIsDependentRelationshipCommand ( Class, Relationship, Value ) );
     510              :   }
     511            0 :   catch ( oks::exception & Ex )
     512              :   {
     513            0 :     QMessageBox::warning ( 0, "Schema editor",
     514            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     515            0 :   }
     516            0 : }
     517              : 
     518            0 : void dbse::KernelWrapper::PushSetIsExclusiveRelationshipCommand (
     519              :   OksClass* Class,
     520              :   OksRelationship * Relationship,
     521              :   bool Value )
     522              : {
     523            0 :   try
     524              :   {
     525            0 :     CommandStack->push ( new SetIsExclusiveRelationshipCommand ( Class, Relationship, Value ) );
     526              :   }
     527            0 :   catch ( oks::exception & Ex )
     528              :   {
     529            0 :     QMessageBox::warning ( 0, "Schema editor",
     530            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     531            0 :   }
     532            0 : }
     533              : 
     534            0 : void dbse::KernelWrapper::PushAddRelationship ( OksClass * Class, std::string Name,
     535              :                                                 std::string Description, std::string Type,
     536              :                                                 bool Composite, bool Exclusive, bool Dependent,
     537              :                                                 OksRelationship::CardinalityConstraint LowCc,
     538              :                                                 OksRelationship::CardinalityConstraint HighCc )
     539              : {
     540            0 :   try
     541              :   {
     542            0 :     CommandStack->push (
     543              :       new AddRelationship ( Class, Name, Description, Type, Composite, Exclusive, Dependent,
     544            0 :                             LowCc, HighCc ) );
     545              :   }
     546            0 :   catch ( oks::exception & Ex )
     547              :   {
     548            0 :     QMessageBox::warning ( 0, "Schema editor",
     549            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     550            0 :   }
     551            0 : }
     552              : 
     553            0 : void dbse::KernelWrapper::PushRemoveRelationship ( OksClass * Class,
     554              :                                                    OksRelationship * Relationship,
     555              :                                                    std::string Name, std::string Description,
     556              :                                                    std::string Type, bool Composite, bool Exclusive,
     557              :                                                    bool Dependent,
     558              :                                                    OksRelationship::CardinalityConstraint LowCc,
     559              :                                                    OksRelationship::CardinalityConstraint HighCc )
     560              : {
     561            0 :   try
     562              :   {
     563            0 :     CommandStack->push (
     564              :       new RemoveRelationship ( Class, Relationship, Name, Description, Type, Composite,
     565            0 :                                Exclusive, Dependent, LowCc, HighCc ) );
     566              :   }
     567            0 :   catch ( oks::exception & Ex )
     568              :   {
     569            0 :     QMessageBox::warning ( 0, "Schema editor",
     570            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     571            0 :   }
     572            0 : }
     573              : 
     574            0 : void dbse::KernelWrapper::PushSetMethodImplementationLanguage ( OksClass * Class,
     575              :                                                                 OksMethod * Method,
     576              :                                                                 OksMethodImplementation * Implementation,
     577              :                                                                 std::string Language )
     578              : {
     579            0 :   try
     580              :   {
     581            0 :     CommandStack->push ( new SetMethodImplementationLanguage ( Class, Method, Implementation, Language ) );
     582              :   }
     583            0 :   catch ( oks::exception & Ex )
     584              :   {
     585            0 :     QMessageBox::warning ( 0, "Schema editor",
     586            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     587            0 :   }
     588            0 : }
     589              : 
     590            0 : void dbse::KernelWrapper::PushSetMethodImplementationPrototype (
     591              :   OksClass * Class, OksMethod * Method, OksMethodImplementation * Implementation, std::string Prototype )
     592              : {
     593            0 :   try
     594              :   {
     595            0 :     CommandStack->push ( new SetMethodImplementationPrototype ( Class, Method, Implementation, Prototype ) );
     596              :   }
     597            0 :   catch ( oks::exception & Ex )
     598              :   {
     599            0 :     QMessageBox::warning ( 0, "Schema editor",
     600            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     601            0 :   }
     602            0 : }
     603              : 
     604            0 : void dbse::KernelWrapper::PushSetMethodImplementationBody ( OksClass * Class,
     605              :                                                             OksMethod * Method,
     606              :                                                             OksMethodImplementation * Implementation,
     607              :                                                             std::string Body )
     608              : {
     609            0 :   try
     610              :   {
     611            0 :     CommandStack->push ( new SetMethodImplementationBody ( Class, Method, Implementation, Body ) );
     612              :   }
     613            0 :   catch ( oks::exception & Ex )
     614              :   {
     615            0 :     QMessageBox::warning ( 0, "Schema editor",
     616            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     617            0 :   }
     618            0 : }
     619              : 
     620            0 : void dbse::KernelWrapper::PushAddMethodImplementationComand ( OksClass * Class,
     621              :                                                               OksMethod * Method,
     622              :                                                               std::string Language,
     623              :                                                               std::string Prototype, std::string Body )
     624              : {
     625            0 :   try
     626              :   {
     627            0 :     CommandStack->push ( new AddMethodImplementationComand ( Class, Method, Language, Prototype,
     628            0 :                                                              Body ) );
     629              :   }
     630            0 :   catch ( oks::exception & Ex )
     631              :   {
     632            0 :     QMessageBox::warning ( 0, "Schema editor",
     633            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     634            0 :   }
     635            0 : }
     636              : 
     637            0 : void dbse::KernelWrapper::PushRemoveMethodImplementationComand ( OksClass * Class,
     638              :                                                                  OksMethod * Method,
     639              :                                                                  std::string Language,
     640              :                                                                  std::string Prototype,
     641              :                                                                  std::string Body )
     642              : {
     643            0 :   try
     644              :   {
     645            0 :     CommandStack->push ( new RemoveMethodImplementationComand ( Class, Method, Language, Prototype,
     646            0 :                                                                 Body ) );
     647              :   }
     648            0 :   catch ( oks::exception & Ex )
     649              :   {
     650            0 :     QMessageBox::warning ( 0, "Schema editor",
     651            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     652            0 :   }
     653            0 : }
     654              : 
     655            0 : void dbse::KernelWrapper::PushSetNameMethodCommand ( OksClass * Class, OksMethod * Method, std::string name )
     656              : {
     657            0 :   try
     658              :   {
     659            0 :     CommandStack->push ( new SetNameMethodCommand ( Class, Method, name ) );
     660              :   }
     661            0 :   catch ( oks::exception & Ex )
     662              :   {
     663            0 :     QMessageBox::warning ( 0, "Schema editor",
     664            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     665            0 :   }
     666            0 : }
     667              : 
     668            0 : void dbse::KernelWrapper::PushSetDescriptionMethodCommand ( OksClass * Class, OksMethod * Method,
     669              :                                                             std::string description )
     670              : {
     671            0 :   try
     672              :   {
     673            0 :     CommandStack->push ( new SetDescriptionMethodCommand ( Class, Method, description ) );
     674              :   }
     675            0 :   catch ( oks::exception & Ex )
     676              :   {
     677            0 :     QMessageBox::warning ( 0, "Schema editor",
     678            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     679            0 :   }
     680            0 : }
     681              : 
     682            0 : void dbse::KernelWrapper::PushAddMethodCommand ( OksClass * Class, std::string name,
     683              :                                                  std::string description )
     684              : {
     685            0 :   try
     686              :   {
     687            0 :     CommandStack->push ( new AddMethodCommand ( Class, name, description ) );
     688              :   }
     689            0 :   catch ( oks::exception & Ex )
     690              :   {
     691            0 :     QMessageBox::warning ( 0, "Schema editor",
     692            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     693            0 :   }
     694            0 : }
     695              : 
     696            0 : void dbse::KernelWrapper::PushRemoveMethodCommand ( OksClass * Class, OksMethod * Method,
     697              :                                                     std::string name, std::string description )
     698              : {
     699            0 :   try
     700              :   {
     701            0 :     CommandStack->push ( new RemoveMethodCommand ( Class, Method, name, description ) );
     702              :   }
     703            0 :   catch ( oks::exception & Ex )
     704              :   {
     705            0 :     QMessageBox::warning ( 0, "Schema editor",
     706            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     707            0 :   }
     708            0 : }
     709              : 
     710            0 : void dbse::KernelWrapper::PushSetAttributeNameCommand ( OksClass * Class,
     711              :                                                         OksAttribute * Attribute,
     712              :                                                         std::string NewName )
     713              : {
     714            0 :   try
     715              :   {
     716            0 :     CommandStack->push ( new SetAttributeNameCommand ( Class, Attribute, NewName ) );
     717              :   }
     718            0 :   catch ( oks::exception & Ex )
     719              :   {
     720            0 :     QMessageBox::warning ( 0, "Schema editor",
     721            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     722            0 :   }
     723            0 : }
     724              : 
     725            0 : void dbse::KernelWrapper::PushSetAttributeDescriptionCommand ( OksClass * Class,
     726              :                                                                OksAttribute * Attribute,
     727              :                                                                std::string NewDescription )
     728              : {
     729            0 :   try
     730              :   {
     731            0 :     CommandStack->push ( new SetAttributeDescriptionCommand ( Class, Attribute, NewDescription ) );
     732              :   }
     733            0 :   catch ( oks::exception & Ex )
     734              :   {
     735            0 :     QMessageBox::warning ( 0, "Schema editor",
     736            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     737            0 :   }
     738            0 : }
     739              : 
     740            0 : void dbse::KernelWrapper::PushSetAttributeTypeCommand ( OksClass * Class,
     741              :                                                         OksAttribute * Attribute,
     742              :                                                         std::string NewType )
     743              : {
     744            0 :   try
     745              :   {
     746            0 :     CommandStack->push ( new SetAttributeTypeCommand ( Class, Attribute, NewType ) );
     747              :   }
     748            0 :   catch ( oks::exception & Ex )
     749              :   {
     750            0 :     QMessageBox::warning ( 0, "Schema editor",
     751            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     752            0 :   }
     753            0 : }
     754              : 
     755            0 : void dbse::KernelWrapper::PushSetAttributeRangeCommand ( OksClass * Class,
     756              :                                                          OksAttribute * Attribute,
     757              :                                                          std::string NewRange )
     758              : {
     759            0 :   try
     760              :   {
     761            0 :     CommandStack->push ( new SetAttributeRangeCommand ( Class, Attribute, NewRange ) );
     762              :   }
     763            0 :   catch ( oks::exception & Ex )
     764              :   {
     765            0 :     QMessageBox::warning ( 0, "Schema editor",
     766            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     767            0 :   }
     768            0 : }
     769              : 
     770            0 : void dbse::KernelWrapper::PushSetAttributeFormatCommand ( OksClass * Class,
     771              :                                                           OksAttribute * Attribute,
     772              :                                                           OksAttribute::Format NewFormat )
     773              : {
     774            0 :   try
     775              :   {
     776            0 :     CommandStack->push ( new SetAttributeFormatCommand ( Class, Attribute, NewFormat ) );
     777              :   }
     778            0 :   catch ( oks::exception & Ex )
     779              :   {
     780            0 :     QMessageBox::warning ( 0, "Schema editor",
     781            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     782            0 :   }
     783            0 : }
     784              : 
     785            0 : void dbse::KernelWrapper::PushSetAttributeMultiCommand ( OksClass * Class,
     786              :                                                          OksAttribute * Attribute,
     787              :                                                          bool NewIsMulti )
     788              : {
     789            0 :   try
     790              :   {
     791            0 :     CommandStack->push ( new SetAttributeMultiCommand ( Class, Attribute, NewIsMulti ) );
     792              :   }
     793            0 :   catch ( oks::exception & Ex )
     794              :   {
     795            0 :     QMessageBox::warning ( 0, "Schema editor",
     796            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     797            0 :   }
     798            0 : }
     799              : 
     800            0 : void dbse::KernelWrapper::PushSetAttributeIsNullCommand ( OksClass * Class,
     801              :                                                           OksAttribute * Attribute,
     802              :                                                           bool NewIsNull )
     803              : {
     804            0 :   try
     805              :   {
     806            0 :     CommandStack->push ( new SetAttributeIsNullCommand ( Class, Attribute, NewIsNull ) );
     807              :   }
     808            0 :   catch ( oks::exception & Ex )
     809              :   {
     810            0 :     QMessageBox::warning ( 0, "Schema editor",
     811            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     812            0 :   }
     813            0 : }
     814              : 
     815            0 : void dbse::KernelWrapper::PushSetAttributeInitialValuesCommand ( OksClass * Class,
     816              :                                                                  OksAttribute * Attribute,
     817              :                                                                  std::string NewValues )
     818              : {
     819            0 :   try
     820              :   {
     821            0 :     CommandStack->push ( new SetAttributeInitialValuesCommand ( Class, Attribute, NewValues ) );
     822              :   }
     823            0 :   catch ( oks::exception & Ex )
     824              :   {
     825            0 :     QMessageBox::warning ( 0, "Schema editor",
     826            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     827            0 :   }
     828            0 : }
     829              : 
     830            0 : void dbse::KernelWrapper::PushAddAttributeCommand ( OksClass * Class, std::string name,
     831              :                                                     std::string type,
     832              :                                                     bool is_mv, std::string range,
     833              :                                                     std::string init_values, std::string description,
     834              :                                                     bool is_null, OksAttribute::Format format )
     835              : {
     836            0 :   try
     837              :   {
     838            0 :     CommandStack->push (
     839              :       new AddAttributeCommand ( Class, name, type, is_mv, range, init_values, description,
     840            0 :                                 is_null, format ) );
     841              :   }
     842            0 :   catch ( oks::exception & Ex )
     843              :   {
     844            0 :     QMessageBox::warning ( 0, "Schema editor",
     845            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     846            0 :   }
     847            0 : }
     848              : 
     849            0 : void dbse::KernelWrapper::PushRemoveAttributeCommand ( OksClass * Class,
     850              :                                                        OksAttribute * Attribute,
     851              :                                                        std::string name, std::string type, bool is_mv,
     852              :                                                        std::string range, std::string init_values,
     853              :                                                        std::string description, bool is_null,
     854              :                                                        OksAttribute::Format format )
     855              : {
     856            0 :   try
     857              :   {
     858            0 :     CommandStack->push (
     859              :       new RemoveAttributeCommand ( Class, Attribute, name, type, is_mv, range, init_values,
     860            0 :                                    description, is_null, format ) );
     861              :   }
     862            0 :   catch ( oks::exception & Ex )
     863              :   {
     864            0 :     QMessageBox::warning ( 0, "Schema editor",
     865            0 :                            QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
     866            0 :   }
     867            0 : }
     868              : 
     869            0 : dbse::KernelWrapper::KernelWrapper ( QObject * parent )
     870              :   : QObject ( parent ),
     871            0 :     Kernel ( new OksKernel() ),
     872            0 :     CommandStack ( new QUndoStack() ),
     873            0 :     InheritanceMode ( false )
     874              : {
     875            0 : }
        

Generated by: LCOV version 2.0-1