Skip to content
Snippets Groups Projects
check.cc 789 B
Newer Older
Stephen Smith's avatar
Stephen Smith committed
/*  Copyright (C) 1999-2004 University of Oxford  */

/*  CCOPYRIGHT */
David Flitney's avatar
David Flitney committed

Stephen Smith's avatar
Stephen Smith committed
#include "options.h"
David Flitney's avatar
David Flitney committed

namespace Utilities {

David Flitney's avatar
David Flitney committed
  using namespace std;

David Flitney's avatar
David Flitney committed
  bool OptionParser::check_compulsory_arguments(bool verbose)
  {
    bool okay = true;

    for(Options::iterator option = options_.begin();
	option != options_.end();
	option++) {
    
      if((*option)->compulsory() && (*option)->unset()) {
David Flitney's avatar
David Flitney committed
	if(okay) {
	  if(verbose) {
	    cerr << "***************************************************" << endl;
	    cerr << "The following COMPULSORY options have not been set:" << endl;
	  }
	  okay = false;
	}
	if(verbose)
David Flitney's avatar
David Flitney committed
	  (*option)->usage(cerr); cerr << endl;
David Flitney's avatar
David Flitney committed
      }
    }
    if(!okay && verbose)
      cerr << "***************************************************" << endl; 

    return okay;
  }

}