| | 1 | /* $Header: d:/cvsroot/tads/tads3/TCHOSTSI.H,v 1.2 1999/05/17 02:52:27 MJRoberts Exp $ */ |
| | 2 | |
| | 3 | /* |
| | 4 | * Copyright (c) 1999, 2002 Michael J. Roberts. All Rights Reserved. |
| | 5 | * |
| | 6 | * Please see the accompanying license file, LICENSE.TXT, for information |
| | 7 | * on using and copying this software. |
| | 8 | */ |
| | 9 | /* |
| | 10 | Name |
| | 11 | tchostsi.h - stdio implementation of host interface |
| | 12 | Function |
| | 13 | |
| | 14 | Notes |
| | 15 | |
| | 16 | Modified |
| | 17 | 04/22/99 MJRoberts - Creation |
| | 18 | */ |
| | 19 | |
| | 20 | #ifndef TCHOSTSI_H |
| | 21 | #define TCHOSTSI_H |
| | 22 | |
| | 23 | #include "t3std.h" |
| | 24 | #include "tchost.h" |
| | 25 | |
| | 26 | /* ------------------------------------------------------------------------ */ |
| | 27 | /* |
| | 28 | * stdio host interface |
| | 29 | */ |
| | 30 | class CTcHostIfcStdio: public CTcHostIfc |
| | 31 | { |
| | 32 | public: |
| | 33 | CTcHostIfcStdio() |
| | 34 | { |
| | 35 | /* by default, show progress messages */ |
| | 36 | show_progress_ = TRUE; |
| | 37 | |
| | 38 | /* there's no status prefix string yet */ |
| | 39 | status_prefix_ = 0; |
| | 40 | } |
| | 41 | |
| | 42 | ~CTcHostIfcStdio() |
| | 43 | { |
| | 44 | /* free our status prefix string */ |
| | 45 | lib_free_str(status_prefix_); |
| | 46 | } |
| | 47 | |
| | 48 | /* set the status message prefix string */ |
| | 49 | void set_status_prefix(const char *str) |
| | 50 | { |
| | 51 | /* delete any former prefix string */ |
| | 52 | lib_free_str(status_prefix_); |
| | 53 | |
| | 54 | /* store a copy of the string */ |
| | 55 | status_prefix_ = lib_copy_str(str); |
| | 56 | } |
| | 57 | |
| | 58 | /* display information messages */ |
| | 59 | void v_print_msg(const char *msg, va_list args); |
| | 60 | |
| | 61 | /* display a process step message */ |
| | 62 | void v_print_step(const char *msg, va_list args); |
| | 63 | |
| | 64 | /* display error messages */ |
| | 65 | void v_print_err(const char *msg, va_list args); |
| | 66 | |
| | 67 | /* turn status (step) messages on/off */ |
| | 68 | void set_show_progress(int flag) { show_progress_ = flag; } |
| | 69 | |
| | 70 | protected: |
| | 71 | /* |
| | 72 | * internal display routine - formats the message, converts it to |
| | 73 | * the console character set and displays the result on the standard |
| | 74 | * output |
| | 75 | */ |
| | 76 | void v_printf(const char *msg, va_list args); |
| | 77 | |
| | 78 | /* flag: show progress (step) messages */ |
| | 79 | int show_progress_; |
| | 80 | |
| | 81 | /* status prefix message */ |
| | 82 | char *status_prefix_; |
| | 83 | }; |
| | 84 | |
| | 85 | #endif /* TCHOSTSI_H */ |