mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 23:55:08 +00:00
Add BaseIpcMessage::GetRequestId
This commit is contained in:
parent
5c43bd9a09
commit
8eff5e2e4f
@ -104,3 +104,7 @@ const char* IpcIdToString(IpcId id) {
|
||||
BaseIpcMessage::BaseIpcMessage(IpcId method_id) : method_id(method_id) {}
|
||||
|
||||
BaseIpcMessage::~BaseIpcMessage() = default;
|
||||
|
||||
lsRequestId BaseIpcMessage::GetRequestId() {
|
||||
return std::monostate();
|
||||
}
|
||||
|
@ -75,6 +75,8 @@ struct BaseIpcMessage {
|
||||
BaseIpcMessage(IpcId method_id);
|
||||
virtual ~BaseIpcMessage();
|
||||
|
||||
virtual lsRequestId GetRequestId();
|
||||
|
||||
template <typename T>
|
||||
T* As() {
|
||||
assert(method_id == T::kIpcId);
|
||||
@ -87,6 +89,10 @@ struct RequestMessage : public BaseIpcMessage {
|
||||
// number | string, actually no null
|
||||
lsRequestId id;
|
||||
RequestMessage() : BaseIpcMessage(T::kIpcId) {}
|
||||
|
||||
lsRequestId GetRequestId() override {
|
||||
return id;
|
||||
}
|
||||
};
|
||||
|
||||
// NotificationMessage does not have |id|.
|
||||
|
Loading…
Reference in New Issue
Block a user