1 /* bzflag 2 * Copyright (c) 1993-2021 Tim Riker 3 * 4 * This package is free software; you can redistribute it and/or 5 * modify it under the terms of the license found in the file 6 * named COPYING that should have accompanied this file. 7 * 8 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 9 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 10 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11 */ 12 13 #ifndef STDBOTHUI_H 14 #define STDBOTHUI_H 15 16 /* interface headers */ 17 #include "BZAdminUI.h" 18 #include "UIMap.h" 19 20 21 class BZAdminClient; 22 23 24 /** This interface is a combination of StdInUI and StdOutUI. It reads commands 25 from stdin and prints the output from the server to stdout. This 26 requires polling of the stdin file descriptor, which isn't defined in 27 standard C or C++, which means that this might not work well on all 28 systems. It should work on most UNIX-like systems though. */ 29 class StdBothUI : public BZAdminUI 30 { 31 public: 32 StdBothUI(BZAdminClient& c); 33 virtual void outputMessage(const std::string& msg, ColorCode color); 34 virtual bool checkCommand(std::string& str); 35 36 /** This function returns a pointer to a dynamically allocated 37 StdBothUI object. */ 38 static BZAdminUI* creator(BZAdminClient&); 39 40 protected: 41 42 static UIAdder uiAdder; 43 44 bool atEOF; 45 46 #ifdef _WIN32 47 public: 48 HANDLE console; 49 HANDLE readEvent, processedEvent; 50 HANDLE thread; 51 char buffer[MessageLen + 1]; 52 int pos; 53 #endif 54 }; 55 56 #endif 57 58 // Local Variables: *** 59 // mode: C++ *** 60 // tab-width: 4 *** 61 // c-basic-offset: 4 *** 62 // indent-tabs-mode: nil *** 63 // End: *** 64 // ex: shiftwidth=4 tabstop=4 65