]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Thu, 14 Feb 2008 09:41:41 +0000 (09:41 +0000)
committerguigues <guigues>
Thu, 14 Feb 2008 09:41:41 +0000 (09:41 +0000)
kernel/appli/bbfy/bbfy.cpp
kernel/appli/bbi/bbi.cxx
kernel/src/bbtkConfigurationFile.cxx

index 8123db20035a61d81195550b62097b2039284ad6..7ec9442d94765335c5097b4f2964d049d8fe2f79 100644 (file)
@@ -3,7 +3,7 @@
 #endif
 
 #include <stdio.h>
-#include "xmlParser.h"
+#include "bbtkXML.h"
 #include <iostream>
 #include <fstream>
 #include <sstream>
@@ -139,27 +139,6 @@ void bbfy::CreateBlackBox()
 //==========================================================================
 
 
-//==========================================================================
-void GetTextOrClear(const XMLNode& node, std::string& var) 
-{
-  if (node.nText()>0) 
-    {
-      var = node.getText();
-    }
-  else if (node.nClear()>0) 
-    {
-      var = node.getClear().lpszValue;
-    }
-  else 
-    {
-      std::string mess("Error : element <");
-      mess += node.getName();
-      mess += "> : no text nor <PRE></PRE> clear tag found";
-      throw bbfyException(mess);
-    }
-}
-//==========================================================================
-
 
 //==========================================================================
 void bbfy::ParseXML()
@@ -207,7 +186,7 @@ void bbfy::ParseXML()
            {
              throw bbfyException("Error : blackbox type '"+itkImageToImageFilterString+"' but no <itkparent> tag found (mandatory)");
            }
-         GetTextOrClear(BB.getChildNode("itkparent"),mItkParent);
+         bbtk::GetTextOrClear(BB.getChildNode("itkparent"),mItkParent);
          // 
          mGeneric = false;
          if (BB.isAttributeSet("generic")) mGeneric=true;
@@ -222,7 +201,7 @@ void bbfy::ParseXML()
                                  +vtkImageAlgorithmString
                                  +"' but no <vtkparent> tag found (mandatory)");
            }
-         GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent);
+         bbtk::GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent);
          // 
        }
     else if (bbtype == vtkPolyDataAlgorithmString )
@@ -235,7 +214,7 @@ void bbfy::ParseXML()
                                  +vtkPolyDataAlgorithmString
                                  +"' but no <vtkparent> tag found (mandatory)");
            }
-         GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent);
+         bbtk::GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent);
          // 
        }
      else 
@@ -269,7 +248,7 @@ void bbfy::ParseXML()
   for (i=0,j=0; i<BB.nChildNode("author"); i++) 
     {
       std::string val;
-      GetTextOrClear(BB.getChildNode("author",&j),val);
+      bbtk::GetTextOrClear(BB.getChildNode("author",&j),val);
       mAuthor += val;
     }
 
@@ -277,7 +256,7 @@ void bbfy::ParseXML()
   for (i=0,j=0; i<BB.nChildNode("description"); i++) 
     {
       std::string val;
-      GetTextOrClear(BB.getChildNode("description",&j),val);
+      bbtk::GetTextOrClear(BB.getChildNode("description",&j),val);
       mDescription += val;
     }
   
@@ -285,30 +264,30 @@ void bbfy::ParseXML()
   for (i=0,j=0; i<BB.nChildNode("category"); i++) 
     {
       std::string val;
-      GetTextOrClear(BB.getChildNode("category",&j),val);
+      bbtk::GetTextOrClear(BB.getChildNode("category",&j),val);
       mCategory += val;
     }
 
   // Namespace
   if (BB.nChildNode("namespace"))
     {
-      GetTextOrClear(BB.getChildNode("namespace"),mNamespace);
+      bbtk::GetTextOrClear(BB.getChildNode("namespace"),mNamespace);
     }
 
   // UserConstructor body
   if (BB.nChildNode("constructor"))
     {
-      GetTextOrClear(BB.getChildNode("constructor"),mUserConstructor);
+      bbtk::GetTextOrClear(BB.getChildNode("constructor"),mUserConstructor);
     }
   // UserCopyConstructor body
   if (BB.nChildNode("copyconstructor"))
     {
-      GetTextOrClear(BB.getChildNode("copyconstructor"),mUserCopyConstructor);
+      bbtk::GetTextOrClear(BB.getChildNode("copyconstructor"),mUserCopyConstructor);
     }
   // UserDestructor body
   if (BB.nChildNode("destructor"))
     {
-      GetTextOrClear(BB.getChildNode("destructor"),mUserDestructor);
+      bbtk::GetTextOrClear(BB.getChildNode("destructor"),mUserDestructor);
     }
  
     // Template parameters
@@ -323,7 +302,7 @@ void bbfy::ParseXML()
        {
          mTemplateDeclaration += "class ";
          std::string val;
-         GetTextOrClear(BB.getChildNode("template",&j),val);
+         bbtk::GetTextOrClear(BB.getChildNode("template",&j),val);
          mTemplateDeclaration += val;
          mTemplateDeclaration +=  ",";
          mTemplateImplementation += val;
@@ -332,7 +311,7 @@ void bbfy::ParseXML()
        }
       mTemplateDeclaration += "class ";
       std::string val;
-      GetTextOrClear(BB.getChildNode("template",&j),val);
+      bbtk::GetTextOrClear(BB.getChildNode("template",&j),val);
       mTemplateDeclaration += val;
       mTemplateDeclaration +=  ">";
       mTemplateImplementation += val;
@@ -344,7 +323,7 @@ void bbfy::ParseXML()
   for (i=0,j=0; i<BB.nChildNode("include"); i++) 
     {
       std::string val;
-      GetTextOrClear(BB.getChildNode("include",&j),val);
+      bbtk::GetTextOrClear(BB.getChildNode("include",&j),val);
       mInclude.push_back(val);
     }
   
@@ -421,13 +400,13 @@ void bbfy::ParseXML()
   // process tag given ?
    if (BB.nChildNode("process"))
      {
-       GetTextOrClear(BB.getChildNode("process"),mProcess);
+       bbtk::GetTextOrClear(BB.getChildNode("process"),mProcess);
      }
   // CreateWidget
   // createwidget tag given ?
    if (BB.nChildNode("createwidget"))
      {
-       GetTextOrClear(BB.getChildNode("createwidget"),mCreateWidget);
+       bbtk::GetTextOrClear(BB.getChildNode("createwidget"),mCreateWidget);
      }
 }
 //==========================================================================
index 39fcc08b5026c5cb737886af15636ab42d95f9a0..3a7368b4a4c4500a3207d06754cd9fb900076954 100644 (file)
@@ -14,6 +14,7 @@
 
 static const wxCmdLineEntryDesc cmdLineDesc[] =
 {
+  { wxCMD_LINE_SWITCH, _T("d"), _T("debug"), _T("Debug messages on (message All 9)") },
   { wxCMD_LINE_SWITCH, _T("c"), _T("command"), _T("turn to command line mode after file(s) processing") },
   { wxCMD_LINE_SWITCH, _T("q"), _T("quiet"),   _T("be quiet") },
   { wxCMD_LINE_SWITCH, _T("h"), _T("help"),   _T("print help") },
@@ -41,6 +42,7 @@ public:
   int argc;
   std::vector<std::string> argv;
   bool command;
+  bool debug;
   bool quiet;
   bool help;
   bool graphical_dialog;
@@ -62,6 +64,7 @@ void wxBBIApp::OnInitCmdLine(wxCmdLineParser& parser)
 
 bool wxBBIApp::OnCmdLineParsed(wxCmdLineParser& parser)
 {
+  debug = ( parser.Found(_T("d")) );
   quiet = ( parser.Found(_T("q")) );
   help = ( parser.Found(_T("h")) );
   graphical_dialog = ( parser.Found(_T("g")) );
@@ -120,8 +123,11 @@ bool wxBBIApp::OnInit( )
   //See http://www.wxwindows.org/faqgtk.htm#locale
   setlocale(LC_NUMERIC, "C");
 #endif
+  
+  if (quiet) bbtk::MessageManager::SetMessageLevel("All",0);
+  if (debug) bbtk::MessageManager::SetMessageLevel("All",9);
+  
 
   bbtk::WxConsole *I = new bbtk::WxConsole(0,_T("bbi"),wxSize(600,400));
   SetTopWindow(I);  
   if (!no_command) I->Show(true);
index 634d5172ea5335a88238dabfba9781535c932ad0..0e94df3a02e217b380aa24ccada0b1d038932995 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkConfigurationFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/14 09:32:54 $
-  Version:   $Revision: 1.4 $
+  Date:      $Date: 2008/02/14 09:41:41 $
+  Version:   $Revision: 1.5 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
@@ -62,7 +62,7 @@ namespace bbtk
     // Initialized to mInstall_path+"/"+BBTK_DATA_REL_PATH
     // But can be overriden by value read from bbtk_config.xml
     mData_path = mInstall_path + mFile_separator + BBTK_STRINGIFY_SYMBOL(BBTK_DATA_REL_PATH);
-    //MessageManager::SetMessageLevel("Config",1);
+    MessageManager::SetMessageLevel("Config",1);
     bbtkMessage("Config",1," ==> bin    : '"<<mBin_path<<"'"<<std::endl);
     bbtkMessage("Config",1," ==> prefix : '"<<mInstall_path<<"'"<<std::endl);
     bbtkMessage("Config",1," ==> doc    : '"<<mDoc_path<<"'"<<std::endl);