Changeset 201 for trunk/src/statistics.h


Ignore:
Timestamp:
05/04/2009 09:21:44 AM (3 years ago)
Author:
guyru
Message:

Re-factor the Statistics constructor to use exceptions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/statistics.h

    r199 r201  
    2424#include "configuration.h" 
    2525#include <vector>  
     26#include <exception>  
    2627namespace statistics { 
    2728 
     
    5556        void save(); 
    5657 
     58        /** 
     59         * Loads data from the backend. 
     60         */ 
     61        void load_data(); 
     62 
    5763        int _games_started; 
    5864        int _games_finished; 
     
    6167        std::vector<int> score_distribution; 
    6268        configuration::Configuration *backend; 
     69}; 
     70 
     71class BadConfiguration : public std::exception { 
     72        virtual const char* what() const throw() 
     73        { 
     74                return "Bad Configuration"; 
     75        } 
    6376}; 
    6477 
Note: See TracChangeset for help on using the changeset viewer.