MythTV  master
sockethandler.cpp
Go to the documentation of this file.
1 #include <QStringList>
2 #include <utility>
3 
5 #include "sockethandler.h"
6 
8  QString hostname) :
9  ReferenceCounter("SocketHandler"),
10  m_socket(sock), m_parent(parent),
11  m_hostname(std::move(hostname))
12 {
13  if (m_socket)
14  m_socket->IncrRef();
15 }
16 
18 {
19  if (m_socket)
20  {
21  m_socket->DecrRef();
22  m_socket = nullptr;
23  }
24 }
25 
26 bool SocketHandler::WriteStringList(const QStringList &strlist)
27 {
28  if (!m_socket)
29  return false;
30 
31  return m_socket->WriteStringList(strlist);
32 }
33 
34 bool SocketHandler::SendReceiveStringList(QStringList &strlist,
35  uint min_reply_length)
36 {
37  if (!m_socket)
38  return false;
39 
40  return m_socket->SendReceiveStringList(strlist, min_reply_length);
41 }
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
SocketHandler::SocketHandler
SocketHandler(MythSocket *sock, MythSocketManager *parent, QString hostname)
Definition: sockethandler.cpp:7
MythSocketManager
Definition: mythsocketmanager.h:21
SocketHandler::~SocketHandler
~SocketHandler() override
Definition: sockethandler.cpp:17
MythSocket
Class for communcating between myth backends and frontends.
Definition: mythsocket.h:25
mythlogging.h
MythSocket::WriteStringList
bool WriteStringList(const QStringList &list)
Definition: mythsocket.cpp:301
SocketHandler::m_socket
MythSocket * m_socket
Definition: sockethandler.h:44
sockethandler.h
SocketHandler::WriteStringList
bool WriteStringList(const QStringList &strlist)
Definition: sockethandler.cpp:26
SocketHandler::SendReceiveStringList
bool SendReceiveStringList(QStringList &strlist, uint min_reply_length=0)
Definition: sockethandler.cpp:34
uint
unsigned int uint
Definition: compat.h:81
std
Definition: mythchrono.h:23
musicbrainzngs.caa.hostname
string hostname
Definition: caa.py:17
ReferenceCounter::IncrRef
virtual int IncrRef(void)
Increments reference count.
Definition: referencecounter.cpp:101
ReferenceCounter
General purpose reference counter.
Definition: referencecounter.h:26
MythSocket::SendReceiveStringList
bool SendReceiveStringList(QStringList &list, uint min_reply_length=0, std::chrono::milliseconds timeoutMS=kLongTimeout)
Definition: mythsocket.cpp:326