ArnLib  4.0.x
Active Registry Network
ArnItemB.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 ARNITEMB_HPP
33 #define ARNITEMB_HPP
34 
35 #include "ArnLib_global.hpp"
36 #include "ArnLinkHandle.hpp"
37 #include "ArnError.hpp"
38 #include "Arn.hpp"
39 #include "ArnBasicItem.hpp"
40 #include <QObject>
41 #include <QString>
42 #include <QByteArray>
43 #include <QVariant>
44 
45 class ArnItemBPrivate;
46 
47 
49 
59 class ARNLIBSHARED_EXPORT ArnItemB : public QObject, public ArnBasicItem
60 {
61  Q_OBJECT
62  Q_DECLARE_PRIVATE(ArnItemB)
63 
64 public:
66 
68  ArnItemB( QObject* parent = arnNullptr);
69 
70  virtual ~ArnItemB();
71 
73 
76  bool open( const QString& path);
77 
78 signals:
80 
85  void arnLinkDestroyed();
86 
88 protected:
90 
94  bool openUuid( const QString& path);
95 
97 
101  bool openUuidPipe( const QString& path);
102 
104 
107  bool openFolder( const QString& path);
108 
110 
117  void arnImport( const QByteArray& data, int ignoreSame = Arn::SameValue::DefaultAction);
118 
119  void setValue( const ArnItemB& other, int ignoreSame = Arn::SameValue::DefaultAction);
120 
122 
126  void setValue( int value, int ignoreSame = Arn::SameValue::DefaultAction);
127 
129 
133  void setValue( ARNREAL value, int ignoreSame = Arn::SameValue::DefaultAction);
134 
136 
140  void setValue( bool value, int ignoreSame = Arn::SameValue::DefaultAction);
141 
143 
147  void setValue( const QString& value, int ignoreSame = Arn::SameValue::DefaultAction);
148 
150 
154  void setValue( const QByteArray& value, int ignoreSame = Arn::SameValue::DefaultAction);
155 
157 
161  void setValue( const QVariant& value, int ignoreSame = Arn::SameValue::DefaultAction);
162 
164 
168  void setValue( const char* value, int ignoreSame = Arn::SameValue::DefaultAction);
169 
171 
176  void setValue( uint value, int ignoreSame = Arn::SameValue::DefaultAction);
177 
179 
184  void setValue( qint64 value, int ignoreSame = Arn::SameValue::DefaultAction);
185 
187 
192  void setValue( quint64 value, int ignoreSame = Arn::SameValue::DefaultAction);
193 
195 
203  void setBits( int mask, int value, int ignoreSame = Arn::SameValue::DefaultAction);
204 
206 
211  void addValue( int value);
212 
214 
219  void addValue( ARNREAL value);
220 
222 
226  void setBlockEcho( bool blockEcho);
227 
229  virtual void itemUpdated( const ArnLinkHandle& handleData, const QByteArray* value = arnNullptr);
230  virtual void modeUpdate( Arn::ObjectMode mode, bool isSetup = false);
231  virtual void itemCreatedBelow( const QString& path);
232  virtual void itemModeChangedBelow( const QString& path, uint linkId, Arn::ObjectMode mode);
233 
234  virtual void arnEvent( QEvent* ev, bool isAlienThread);
235  virtual void customEvent( QEvent* ev);
236 
238  bool openWithFlags( const QString& path, Arn::LinkFlags linkFlags);
239  void setEnableSetValue( bool enable);
240  void setEnableUpdNotify( bool enable);
241  void setValue( const QByteArray& value, int ignoreSame, ArnLinkHandle& handleData);
242  void arnImport( const QByteArray& data, int ignoreSame, ArnLinkHandle& handleData);
243 
244  ArnItemB( ArnItemBPrivate& dd, QObject* parent);
245  ArnItemBPrivate* const d_ptr;
246 
249  using ArnBasicItem::type;
251  using ArnBasicItem::addMode;
252  using ArnBasicItem::getMode;
267  using ArnBasicItem::toInt;
269  using ArnBasicItem::toReal;
270  using ArnBasicItem::toBool;
274  using ArnBasicItem::operator=;
276 
277 private:
278  void init();
279  inline void doEvent( QEvent* ev);
280 };
281 
282 #endif // ARNITEMB_HPP
bool isUncrossed() const
Get the Uncrossed state of an object.
QString toString(bool *isOk=arnNullptr) const
void setValue(const ArnBasicItem &other, int ignoreSame=Arn::SameValue::DefaultAction)
ArnBasicItem & setPipeMode()
Set general mode as Pipe for this Arn Data Object
bool isMaster() const
Arn::ObjectSyncMode syncMode() const
bool toBool(bool *isOk=arnNullptr) const
bool open(const QString &path)
Open a handle to an Arn Data Object
ArnBasicItem & setSaveMode()
Set general mode as Save for this Arn Data Object
void setIgnoreSameValue(bool isIgnore=true)
Set skipping of equal value.
void setUncrossed(bool isUncrossed=true)
Set a Bidirectional item as Uncrossed.
Arn::ObjectMode getMode() const
Use with care, link must be "referenced" before use, otherwise it might have been deleted...
int toInt(bool *isOk=arnNullptr) const
ARNREAL toReal(bool *isOk=arnNullptr) const
QByteArray toByteArray(bool *isOk=arnNullptr) const
void addValue(int value)
AtomicOp adds an integer to an Arn Data Object
void setBits(int mask, int value, int ignoreSame=Arn::SameValue::DefaultAction)
AtomicOp assign an integer to specified bits in an Arn Data Object
void arnImport(const QByteArray &data, int ignoreSame=Arn::SameValue::DefaultAction)
Import data to an Arn Data Object
Assigning same value gives default action set in ArnM or ArnItem.
Definition: Arn.hpp:68
QVariant toVariant(bool *isOk=arnNullptr) const
ArnBasicItem & setBiDirMode()
Set general mode as Bidirectional for this Arn Data Object
void addMode(Arn::ObjectMode mode)
Add general mode settings for this Arn Data Object
Arn::DataType type() const
The type stored in the Arn Data Object
#define ARNREAL
Definition: Arn.hpp:44
bool isAutoDestroy() const
Base class handle for an Arn Data Object.
Definition: ArnItemB.hpp:59
ArnBasicItem & setAutoDestroy()
Set client session sync mode as AutoDestroy for this ArnItem.
double toDouble(bool *isOk=arnNullptr) const
bool isFolder() const
bool isSaveMode() const
bool isBiDirMode() const
#define ARNLIBSHARED_EXPORT
QByteArray arnExport() const
ArnBasicItem & setMaster()
Set client session sync mode as Master for this ArnItem.
bool isProvider() const
bool isPipeMode() const
Base class handle for an Arn Data Object.