diff --git a/.codedocs b/.codedocs index b2f37aad..11be9fc9 100644 --- a/.codedocs +++ b/.codedocs @@ -1,3 +1,3 @@ PROJECT_NAME = "The Final Cut" -EXCLUDE = debian, icon, logo, m4, scripts, test +EXCLUDE = debian, icon, logo, m4, scripts, examples diff --git a/examples/string-operations.cpp b/examples/string-operations.cpp index f5fe0ba6..0b32aeb6 100644 --- a/examples/string-operations.cpp +++ b/examples/string-operations.cpp @@ -88,19 +88,52 @@ int main (int, char**) std::cout << " stream in: " << streamer9 << std::endl; // ...from long double - FString streamer10; - streamer10 << lDouble(0.333333333333333333L); - std::cout << " stream in: " << streamer10 << std::endl; + try + { + FString streamer10; + streamer10 << lDouble(0.333333333333333333L); + std::cout << " stream in: " << streamer10 << std::endl; + } + catch (const std::invalid_argument& ex) + { + std::cerr << "Invalid argument: " << ex.what() << std::endl; + } + catch (const std::exception& ex) + { + std::cerr << "Arithmetic error: " << ex.what() << std::endl; + } // ...from double - FString streamer11; - streamer11 << double(0.11111111111); - std::cout << " stream in: " << streamer11 << std::endl; + try + { + FString streamer11; + streamer11 << double(0.11111111111); + std::cout << " stream in: " << streamer11 << std::endl; + } + catch (const std::invalid_argument& ex) + { + std::cerr << "Invalid argument: " << ex.what() << std::endl; + } + catch (const std::exception& ex) + { + std::cerr << "Arithmetic error: " << ex.what() << std::endl; + } // ...from float - FString streamer12; - streamer12 << float(0.22222222); - std::cout << " stream in: " << streamer12 << std::endl; + try + { + FString streamer12; + streamer12 << float(0.22222222); + std::cout << " stream in: " << streamer12 << std::endl; + } + catch (const std::invalid_argument& ex) + { + std::cerr << "Invalid argument: " << ex.what() << std::endl; + } + catch (const std::exception& ex) + { + std::cerr << "Arithmetic error: " << ex.what() << std::endl; + } // Test: Streaming from a FString (operator >>)... diff --git a/examples/watch.cpp b/examples/watch.cpp index 74ec5040..639ea215 100644 --- a/examples/watch.cpp +++ b/examples/watch.cpp @@ -9,20 +9,20 @@ #include //---------------------------------------------------------------------- -// class watch +// class Watch //---------------------------------------------------------------------- #pragma pack(push) #pragma pack(1) -class watch : public FDialog +class Watch : public FDialog { public: // Constructor - explicit watch (FWidget* = 0); + explicit Watch (FWidget* = 0); // Destructor - ~watch(); + ~Watch(); // Method void printTime(); @@ -42,10 +42,10 @@ class watch : public FDialog private: // Disable copy constructor - watch (const watch&); + Watch (const Watch&); // Disable assignment operator (=) - watch& operator = (const watch&); + Watch& operator = (const Watch&); // Data Members bool sec; @@ -57,7 +57,7 @@ class watch : public FDialog #pragma pack(pop) //---------------------------------------------------------------------- -watch::watch (FWidget* parent) +Watch::Watch (FWidget* parent) : FDialog(parent) , sec(true) , time_label(0) @@ -91,32 +91,32 @@ watch::watch (FWidget* parent) clock_sw->addCallback ( "toggled", - F_METHOD_CALLBACK (this, &watch::cb_clock) + F_METHOD_CALLBACK (this, &Watch::cb_clock) ); // Connect switch signal "toggled" with a callback member function seconds_sw->addCallback ( "toggled", - F_METHOD_CALLBACK (this, &watch::cb_seconds) + F_METHOD_CALLBACK (this, &Watch::cb_seconds) ); // Connect button signal "clicked" with a callback member function quit_btn->addCallback ( "clicked", - F_METHOD_CALLBACK (this, &watch::cb_exitApp) + F_METHOD_CALLBACK (this, &Watch::cb_exitApp) ); } //---------------------------------------------------------------------- -watch::~watch() +Watch::~Watch() { delOwnTimer(); } //---------------------------------------------------------------------- -void watch::printTime() +void Watch::printTime() { FString str; std::tm now; @@ -135,13 +135,13 @@ void watch::printTime() } //---------------------------------------------------------------------- -void watch::onTimer (FTimerEvent*) +void Watch::onTimer (FTimerEvent*) { printTime(); } //---------------------------------------------------------------------- -void watch::onClose (FCloseEvent* ev) +void Watch::onClose (FCloseEvent* ev) { int ret = FMessageBox::info ( this, "Quit" , "Do you really want\n" @@ -155,7 +155,7 @@ void watch::onClose (FCloseEvent* ev) } //---------------------------------------------------------------------- -void watch::cb_clock (FWidget*, data_ptr) +void Watch::cb_clock (FWidget*, data_ptr) { if ( clock_sw->isChecked() ) { @@ -171,7 +171,7 @@ void watch::cb_clock (FWidget*, data_ptr) } //---------------------------------------------------------------------- -void watch::cb_seconds (FWidget*, data_ptr) +void Watch::cb_seconds (FWidget*, data_ptr) { if ( seconds_sw->isChecked() ) sec = true; @@ -192,13 +192,13 @@ void watch::cb_seconds (FWidget*, data_ptr) } //---------------------------------------------------------------------- -void watch::cb_exitApp (FWidget*, data_ptr) +void Watch::cb_exitApp (FWidget*, data_ptr) { close(); } //---------------------------------------------------------------------- -void watch::adjustSize() +void Watch::adjustSize() { int pw = getParentWidget()->getWidth(); setX (1 + (pw - 22) / 2, false); @@ -214,7 +214,7 @@ int main (int argc, char* argv[]) FApplication app(argc, argv); // Create a simple dialog box - watch w(&app); + Watch w(&app); // Set dialog w as main widget app.setMainWidget(&w);