| 1 |
#ifndef LSP_REQUEST_H |
| 2 |
#define LSP_REQUEST_H |
| 3 |
|
| 4 |
#include "IPathConverter.hpp" |
| 5 |
#include "LSP/MessageWithParams.h" |
| 6 |
#include "wx/string.h" |
| 7 |
#include <wx/filename.h> |
| 8 |
|
| 9 |
namespace LSP |
| 10 |
{ |
| 11 |
|
| 12 |
class WXDLLIMPEXP_SDK Request : public LSP::MessageWithParams |
| 13 |
{ |
| 14 |
int m_id = wxNOT_FOUND; |
| 15 |
wxString m_server_name; |
| 16 |
|
| 17 |
public: |
| 18 |
Request(); |
| 19 |
virtual ~Request(); |
| 20 |
|
| 21 |
void SetId(int id) { this->m_id = id; } |
| 22 |
int GetId() const { return m_id; } |
| 23 |
|
| 24 |
virtual JSONItem ToJSON(const wxString& name) const; |
| 25 |
virtual void FromJSON(const JSONItem& json); |
| 26 |
|
| 27 |
/** |
| 28 |
* @brief is this request position dependant? (i.e. the response should be diplsayed where the request was |
| 29 |
* triggered?) |
| 30 |
*/ |
| 31 |
virtual bool IsPositionDependantRequest() const { return false; } |
| 32 |
|
| 33 |
/** |
| 34 |
* @brief in case 'IsPositionDependantRequest' is true, return true if the response is valid at |
| 35 |
* a given position. Usually, when the user moves while waiting for a response, it makes no sense on |
| 36 |
* displaying the response in the wrong location... |
| 37 |
*/ |
| 38 |
virtual bool IsValidAt(const wxString& filename, size_t line, size_t col) const |
| 39 |
{ |
| 40 |
wxUnusedVar(filename); |
| 41 |
wxUnusedVar(line); |
| 42 |
wxUnusedVar(col); |
| 43 |
return true; |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* @brief this method will get called by the protocol for handling the response. |
| 48 |
* Override it in the various requests |
| 49 |
*/ |
| 50 |
virtual void OnResponse(const LSP::ResponseMessage& response, wxEvtHandler* owner) |
| 51 |
{ |
| 52 |
wxUnusedVar(response); |
| 53 |
wxUnusedVar(owner); |
| 54 |
} |
| 55 |
|
| 56 |
void SetServerName(const wxString& server_name) { this->m_server_name = server_name; } |
| 57 |
const wxString& GetServerName() const { return m_server_name; } |
| 58 |
}; |
| 59 |
}; // namespace LSP |
| 60 |
|
| 61 |
#endif // REQUEST_H |