(Re)moved Jid deprecated methods
[iris.git] / src / xmpp / jid / jid.h
blob591cca214464c552b23b0488eee9f2c8f7c5355e
1 /*
2 * jid.h
3 * Copyright (C) 2003 Justin Karneges
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef XMPP_JID_H
22 #define XMPP_JID_H
24 #include <QString>
26 #ifdef IRIS_XMPP_JID_DEPRECATED
27 #define IRIS_XMPP_JID_DECL_DEPRECATED Q_DECL_DEPRECATED
28 #else
29 #define IRIS_XMPP_JID_DECL_DEPRECATED
30 #endif
32 namespace XMPP
34 class Jid
36 public:
37 Jid();
38 ~Jid();
40 Jid(const QString &s);
41 Jid(const QString &node, const QString& domain, const QString& resource = "");
42 Jid(const char *s);
43 Jid & operator=(const QString &s);
44 Jid & operator=(const char *s);
46 bool isNull() const { return null; }
47 const QString & domain() const { return d; }
48 const QString & node() const { return n; }
49 const QString & resource() const { return r; }
50 const QString & bare() const { return b; }
51 const QString & full() const { return f; }
53 Jid withNode(const QString &s) const;
54 Jid withDomain(const QString &s) const;
55 Jid withResource(const QString &s) const;
57 bool isValid() const;
58 bool isEmpty() const;
59 bool compare(const Jid &a, bool compareRes=true) const;
60 inline bool operator==(const Jid &other) const { return compare(other, true); }
61 inline bool operator!=(const Jid &other) const { return !(*this == other); }
63 private:
64 void set(const QString &s);
65 void set(const QString &domain, const QString &node, const QString &resource="");
67 void setDomain(const QString &s);
68 void setNode(const QString &s);
69 void setResource(const QString &s);
71 private:
72 void reset();
73 void update();
75 QString f, b, d, n, r;
76 bool valid, null;
80 #endif