ArnLib  4.0.x
Active Registry Network
ArnLinkHandle.hpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2022 Michael Wiklund.
2 // All rights reserved.
3 // Contact: arnlib@wiklunden.se
4 //
5 // This file is part of the ArnLib - Active Registry Network.
6 // Parts of ArnLib depend on Qt and/or other libraries that have their own
7 // licenses. Usage of these other libraries is subject to their respective
8 // license agreements.
9 //
10 // GNU Lesser General Public License Usage
11 // This file may be used under the terms of the GNU Lesser General Public
12 // License version 2.1 as published by the Free Software Foundation and
13 // appearing in the file LICENSE_LGPL.txt included in the packaging of this
14 // file. In addition, as a special exception, you may use the rights described
15 // in the Nokia Qt LGPL Exception version 1.1, included in the file
16 // LGPL_EXCEPTION.txt in this package.
17 //
18 // GNU General Public License Usage
19 // Alternatively, this file may be used under the terms of the GNU General Public
20 // License version 3.0 as published by the Free Software Foundation and appearing
21 // in the file LICENSE_GPL.txt included in the packaging of this file.
22 //
23 // Other Usage
24 // Alternatively, this file may be used in accordance with the terms and conditions
25 // contained in a signed written agreement between you and Michael Wiklund.
26 //
27 // This program is distributed in the hope that it will be useful, but WITHOUT ANY
28 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
29 // PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
30 //
31 
32 #ifndef ARNLINKHANDLE_HPP
33 #define ARNLINKHANDLE_HPP
34 
35 #include "Arn.hpp"
36 #include "MQFlags.hpp"
37 #include <QMetaType>
38 #include <QString>
39 #include <QVariant>
40 #include <QMap>
41 
42 
44 
46 class ArnLinkHandle
47 {
48 public:
50  enum Code {
52  Normal = 0,
55  QueueFindRegexp = 0x01,
57  SeqNo = 0x02
58  };
59  Q_DECLARE_FLAGS( Codes, Code)
60 
61  struct Flags {
62  enum E {
64  Text = 0x01,
66  FromRemote = 0x02,
68  FromPersist = 0x04
69  };
70  MQ_DECLARE_FLAGS( Flags)
71  };
72 
73  ArnLinkHandle();
74  ArnLinkHandle( const ArnLinkHandle& other);
75  ArnLinkHandle( const Flags& flags);
76  ~ArnLinkHandle();
77  static const ArnLinkHandle& null();
78 
79  ArnLinkHandle& add( Code code, const QVariant& valueRef);
80  bool has( Code code) const;
81  bool isNull() const;
82  const QVariant& valueRef( Code code) const;
83 
84  const Flags& flags() const;
85  Flags& flags();
86 
87 private:
88  ArnLinkHandle& operator=( const ArnLinkHandle&); // Protect from usage
89  void init();
90  static const ArnLinkHandle* nullPtr();
91 
92  Flags _flags;
93  Codes _codes;
94  typedef QMap<int,QVariant> HandleData;
95  HandleData* _data;
96 };
98 
99 Q_DECLARE_OPERATORS_FOR_FLAGS( ArnLinkHandle::Codes)
100 MQ_DECLARE_OPERATORS_FOR_FLAGS( ArnLinkHandle::Flags)
101 Q_DECLARE_METATYPE( ArnLinkHandle)
102 
103 #endif // ARNLINKHANDLE_HPP
#define MQ_DECLARE_FLAGS(FEStruct)
Flags.
Definition: MQFlagsBase.hpp:49
#define MQ_DECLARE_OPERATORS_FOR_FLAGS(FEStruct)
Definition: MQFlagsBase.hpp:65