--- a/sources/interface.h Wed Jan 27 12:41:50 2021 +0200 +++ b/sources/interface.h Wed Jan 27 19:48:41 2021 +0200 @@ -1,5 +1,5 @@ /* - Copyright 2014 - 2016 Teemu Piippo + Copyright 2014 - 2021 Teemu Piippo All rights reserved. Redistribution and use in source and binary forms, with or without @@ -49,26 +49,27 @@ }; Interface(); - void connect(String address, String password); + virtual ~Interface(); + void connect(std::string address, std::string password); void disconnected(); RCONSession* getSession() { return &m_session; } - void handleCommand(const String& input); - void handleInput(); + void handleCommand(const std::string& input, bool *shouldquit); + void handleInput(bool *shouldquit); void needRefresh(); - void __cdecl print(const char* fmtstr, ...); - void __cdecl printWarning(const char* fmtstr, ...); - void __cdecl printError(const char* fmtstr, ...); - void __cdecl printText(const char* fmtstr, ...); + void __cdecl print(const char* fmtstr, ...) GNUATTRIBUTE((format(printf, 2, 3))); + void __cdecl printWarning(const char* fmtstr, ...) GNUATTRIBUTE((format(printf, 2, 3))); + void __cdecl printError(const char* fmtstr, ...) GNUATTRIBUTE((format(printf, 2, 3))); + void __cdecl printText(const char* fmtstr, ...) GNUATTRIBUTE((format(printf, 2, 3))); void render(); void renderFull(); - void setPlayerNames(const StringList& names); - void setTitle(const String& message); - void tabComplete(const String& part, String complete); + void setPlayerNames(const std::vector<std::string>& names); + void setTitle(const std::string& message); + void tabComplete(const std::string& part, std::string complete); void updateStatusBar(); void vprint(const char* fmtstr, va_list args); private: - StringList m_inputHistory; + std::vector<std::string> m_inputHistory; int m_inputCursor; int m_cursorPosition; int m_inputPanning; @@ -78,15 +79,15 @@ bool m_needOutputRender; bool m_needNicklistRender; struct { char ch; int x; } m_cursorCharacter; - Vector<ColoredLine> m_outputLines; + std::vector<ColoredLine> m_outputLines; int m_outputScroll; - String m_title; + std::string m_title; InputState m_inputState; std::function<void(bool)> m_disconnectCallback; - IPAddress m_remoteAddress; - String m_statusBarText; - List<ColoredLine> m_playerNames; - String m_pasteBuffer; + net::ip_address m_remoteAddress; + std::string m_statusBarText; + std::vector<ColoredLine> m_playerNames; + std::string m_pasteBuffer; RCONSession m_session; void detachInput(); @@ -94,13 +95,13 @@ int findPreviousWord(); void flushInput(); chtype getColorPair(Color fg, Color bg); - const String& getCurrentInput(); - String& getEditableInput(); - String getPromptString(); + const std::string& getCurrentInput(); + std::string& getEditableInput(); + std::string getPromptString(); void moveInputCursor(int delta); int nicklistWidth(); void positionCursor(); - void printToConsole(String message); + void printToConsole(std::string message); int renderColorline(int y, int x0, int width, const ColoredLine& line, bool allowWrap); void renderInput(); void renderNicklist(); @@ -111,6 +112,7 @@ void safeDisconnect(std::function<void(bool)> afterwards); void setInputState(InputState newstate); void yank(int a, int b); + bool tryResolveAddress(const std::string& address_string, net::ip_address *target); }; END_ZFC_NAMESPACE \ No newline at end of file