Torc  0.1
torcupnp.cpp
Go to the documentation of this file.
1 /* Class TorcUPNP
2 *
3 * This file is part of the Torc project.
4 *
5 * Copyright (C) Mark Kendall 2013-18
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 * USA.
21 */
22 
23 // Torc
24 #include "torcupnp.h"
25 
27  : m_usn(QString()),
28  m_location(QString()),
29  m_expiry(-1)
30 {
31 }
32 
33 TorcUPNPDescription::TorcUPNPDescription(const QString &USN, const QString &Location, qint64 Expires)
34  : m_usn(USN),
35  m_location(Location),
36  m_expiry(Expires)
37 {
38 }
39 
40 QString TorcUPNPDescription::GetUSN(void) const
41 {
42  return m_usn;
43 }
44 
46 {
47  return m_location;
48 }
49 
51 {
52  return m_expiry;
53 }
54 
55 void TorcUPNPDescription::SetExpiry(qint64 Expires)
56 {
57  m_expiry = Expires;
58 }
59 
60 QString TorcUPNP::UUIDFromUSN(const QString &USN)
61 {
62  QString result;
63  QString usn = USN.trimmed();
64 
65  if (usn.startsWith(QStringLiteral("uuid:")))
66  {
67  usn = usn.mid(5);
68  int index = usn.indexOf(QStringLiteral("::"));
69 
70  if (index > -1)
71  result = usn.left(index);
72  }
73 
74  return result;
75 }
76 
static QString UUIDFromUSN(const QString &USN)
Definition: torcupnp.cpp:60
QString GetUSN(void) const
Definition: torcupnp.cpp:40
void SetExpiry(qint64 Expires)
Definition: torcupnp.cpp:55
qint64 GetExpiry(void) const
Definition: torcupnp.cpp:50
QString GetLocation(void) const
Definition: torcupnp.cpp:45