util - static void set_status (int status) {exit_status =...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// // util - // A utility class to provide various services not conveniently // included in other modules. // #ifndef __UTIL_H__ #define __UTIL_H__ # #include <iostream> #include <vector> # #ifdef __GNUC__ #include <stdexcept> #endif # using namespace std; u #include "trace.h" # // // ydc_exn - // Indicate a problem where processing should be abandoned and // the main function should take control. // class ydc_exn: public runtime_error { public: explicit ydc_exn (const string &what); }; } // // octal - // Convert integer to octal string. // const string octal (int decimal); c // // sys_info - // Keep track of execname and exit status. Must be initialized // as the first thing done inside main. Main should call: // sys_info::set_execname (argv[0]); // before anything else. // class sys_info { private: static string execname; static int exit_status; public: static void set_execname (const string &argv0); static const string &get_execname () {return execname; }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: static void set_status (int status) {exit_status = status; } static int get_status () {return exit_status; } }; } // // complain -// Used for starting error messages. Sets the exit status to // EXIT_FAILURE, writes the program name to cerr, and then // returns the cerr ostream. Example: // complain() << filename << ": some problem" << endl; // ostream &complain(); o // // operator<< (vector) -// An overloaded template operator which allows vectors to be // printed out as a single operator, each element separated from // the next with spaces. The item_t must have an output operator // defined for it. // template <typename item_t> ostream &operator<< (ostream &out, const vector<item_t> &vec); o // // Put the RCS Id string in the object file. // RCSH(__util_h__, "$Id: util.h,v 1.2 2010-01-21 18:22:36-08 - - $") " #endif...
View Full Document

This note was uploaded on 01/26/2010 for the course CMPS 109 taught by Professor Bailey,d during the Spring '08 term at UCSC.

Page1 / 2

util - static void set_status (int status) {exit_status =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online