[Compbench-devel] CompBenchmarks++/libcompbenchmarks/UI Makefile.am, NONE, 1.1 UI.cpp, NONE, 1.1 UI
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-01-22 18:16:55
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv17491 Added Files: Makefile.am UI.cpp UI.h Log Message: libcompbenchmarks moved in a separate directory. --- NEW FILE: UI.h --- /* ---------------------------------------------------------------------------- $Id: UI.h,v 1.1 2007/01/22 18:16:51 xfred Exp $ This is free software. For details, see the GNU Public License in the COPYING file, or Look http://www.fsf.org ------------------------------------------------------------------------- */ #ifndef H_CBMUI #define H_CBMUI #include <string> namespace CBM { /** \brief Basic API for user interface. * * This class defines few methods to interact with compbenchmarks-config, or * with the console. */ class UI { private: protected: /** Unused for now. */ std::string progressMsg; /** Unused for now. */ int progressMax; /** Unused for now. */ int progressCur; public: UI(); /** Typedef for message sent to UI object. */ typedef enum Info { FileCreate, /*!< File creation */ FileRead, /*!< File is being read */ FileWrite, /*!< File has been written */ FileRemove, /*!< File has been removed */ ChecksumOK, /*!< Correct checksum message */ ChecksumFailed, /*!< Bad checksum */ DirectoryCheck, /*!< Directory has been checked */ DirectoryCreate, /*!< Directory has been created */ BenchDownload, /*!< Benchmark downloaded */ BenchExtract, /*!< Benchmark extracted */ BenchPatch, /*!< Benchmark patched */ BenchPreconfigure, /*!< Benchmark pre-configured */ BenchConfigure, /*!< Benchmark configured */ BenchMake, /*!< Benchmark (package) build */ BenchTest, /*!< Benchmark is tested */ BenchBench, /*!< Benchmark ran */ BenchResult, /*!< Benchmark result is being * displayed */ BenchClean, /*!< Package has been cleaned */ BenchUninstall /*!< Package uninstalled */ }; /** Throws a fatal error. Display a message and exits properly. \sa CBMSystem::done() \return 1 if ok. */ virtual int Fatal(std::string msg); /** Display information. Prints an header corresponding to the type, then shows msg. \param type Type of information \param msg Message (clear text) to display */ virtual int Information(Info type, std::string msg); /* virtual int ProgressInit(std::string& msg, int max) = 0; virtual int Progress(int step) = 0; virtual int ProgressDone(void) = 0; */ /** Virtual destructor */ virtual ~UI(); }; extern UI *cbmUI; } #endif --- NEW FILE: UI.cpp --- #include <UI/UI.h> #include <System/System.h> #include <libcompbenchmarks.h> #include <iostream> using namespace CBM; CBM::UI *CBM::cbmUI = 0; UI::UI() { progressMsg=""; progressMax=-1; progressCur=-1; } int UI::Fatal(std::string msg) { std::cerr << "FATAL ERROR: " << msg << std::endl; if (UO_fatal) { CBM::cbmSystem->done(); exit(1); } return(1); } int UI::Information(CBM::UI::Info type, std::string msg) { std::string what; if (!UO_verbose) return(1); switch(type) { case FileCreate: what="Creating file"; break; case FileRead: what="Reading"; break; case FileWrite: what="Writing"; break; case FileRemove: what="Removing"; break; case ChecksumOK: what="MD5 Checksum successfuly verified on"; break; case ChecksumFailed: what="Bad MD5 Checksum on"; break; case DirectoryCheck: what="Checking directory"; break; case DirectoryCreate: what="Creating directory"; break; case BenchDownload: what="Downloading"; break; case BenchExtract: what="Extracting"; break; case BenchPatch: what="Patching"; break; case BenchPreconfigure: what="Preconfiguring"; break; case BenchConfigure: what="Configuring"; break; case BenchTest: what="Testing"; break; case BenchMake: what="Making"; break; case BenchBench: what="Running benchmark"; break; case BenchResult: what="Benchmark result :"; break; case BenchClean: what="Cleaning"; break; case BenchUninstall: what="Uninstalling"; break; default: what="(?)"; } std::cout << what << " " << msg << std::endl; return(1); } UI::~UI() { } --- NEW FILE: Makefile.am --- # ----------------------------------------------------------------------------- # $Id: Makefile.am,v 1.1 2007/01/22 18:16:51 xfred Exp $ # # This is free software. # For details, see the GNU Public License in the COPYING file, or # Look http://www.fsf.org # ----------------------------------------------------------------------------- noinst_LTLIBRARIES = libUI.la sources = UI.cpp libUI_la_SOURCES = $(sources) libUIinclude_HEADERS = $(sources:.cpp=.h) libUIincludedir = $(includedir)/compbenchmarks/UI INCLUDES = -I $(top_srcdir)/libcompbenchmarks |