[Libreoffice-commits] online.git: kit/ChildSession.cpp kit/ChildSession.hpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Nov 12 08:10:23 UTC 2018
kit/ChildSession.cpp | 14 +++++++-------
kit/ChildSession.hpp | 38 +++++++++++++++++++++++++++++++++++---
2 files changed, 42 insertions(+), 10 deletions(-)
New commits:
commit c863e520013ef9908f4c8b0333ae69ef3f53ce7b
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Nov 12 09:03:54 2018 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Nov 12 09:04:01 2018 +0100
RecordedEvent: make members private
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index be1cb831f..bef59c779 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -133,17 +133,17 @@ bool ChildSession::_handleInput(const char *buffer, int length)
for (const auto& eventPair : viewPair.second)
{
const RecordedEvent& event = eventPair.second;
- LOG_TRC("Replaying missed view event: " << viewPair.first << " " << LOKitHelper::kitCallbackTypeToString(event._type)
- << ": " << event._payload);
- loKitCallback(event._type, event._payload);
+ LOG_TRC("Replaying missed view event: " << viewPair.first << " " << LOKitHelper::kitCallbackTypeToString(event.getType())
+ << ": " << event.getPayload());
+ loKitCallback(event.getType(), event.getPayload());
}
}
for (const auto& eventPair : _stateRecorder.getRecordedEvents())
{
const RecordedEvent& event = eventPair.second;
- LOG_TRC("Replaying missed event: " << LOKitHelper::kitCallbackTypeToString(event._type) << ": " << event._payload);
- loKitCallback(event._type, event._payload);
+ LOG_TRC("Replaying missed event: " << LOKitHelper::kitCallbackTypeToString(event.getType()) << ": " << event.getPayload());
+ loKitCallback(event.getType(), event.getPayload());
}
for (const auto& pair : _stateRecorder.getRecordedStates())
@@ -154,8 +154,8 @@ bool ChildSession::_handleInput(const char *buffer, int length)
for (const auto& event : _stateRecorder.getRecordedEventsVector())
{
- LOG_TRC("Replaying missed event (part of sequence): " << LOKitHelper::kitCallbackTypeToString(event._type) << ": " << event._payload);
- loKitCallback(event._type, event._payload);
+ LOG_TRC("Replaying missed event (part of sequence): " << LOKitHelper::kitCallbackTypeToString(event.getType()) << ": " << event.getPayload());
+ loKitCallback(event.getType(), event.getPayload());
}
_stateRecorder.clear();
diff --git a/kit/ChildSession.hpp b/kit/ChildSession.hpp
index 292614ff1..898d09e22 100644
--- a/kit/ChildSession.hpp
+++ b/kit/ChildSession.hpp
@@ -78,8 +78,40 @@ public:
struct RecordedEvent
{
- int _type;
+private:
+ int _type = 0;
std::string _payload;
+
+public:
+ RecordedEvent()
+ {
+ }
+
+ RecordedEvent(int type, const std::string& payload)
+ : _type(type),
+ _payload(payload)
+ {
+ }
+
+ void setType(int type)
+ {
+ _type = type;
+ }
+
+ int getType() const
+ {
+ return _type;
+ }
+
+ void setPayload(const std::string& payload)
+ {
+ _payload = payload;
+ }
+
+ const std::string& getPayload() const
+ {
+ return _payload;
+ }
};
/// When the session is inactive, we need to record its state for a replay.
@@ -128,7 +160,7 @@ public:
void recordEvent(const int type, const std::string& payload)
{
- _recordedEvents[type] = {type, payload};
+ _recordedEvents[type] = RecordedEvent(type, payload);
}
void recordViewEvent(const int viewId, const int type, const std::string& payload)
@@ -145,7 +177,7 @@ public:
/// the final state.
void recordEventSequence(const int type, const std::string& payload)
{
- _recordedEventsVector.push_back({type, payload});
+ _recordedEventsVector.emplace_back(type, payload);
}
void clear()
More information about the Libreoffice-commits
mailing list