File: CQtManagedRestrictedModificationHash.cpp

package info (click to toggle)
konclude 0.7.0%2B1137~dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 48,824 kB
  • sloc: cpp: 378,238; xml: 116,067; makefile: 38; sh: 8; ansic: 3
file content (694 lines) | stat: -rw-r--r-- 21,448 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
/*
 *		Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
 *
 *		This file is part of the reasoning system Konclude.
 *		For details and support, see <http://konclude.com/>.
 *
 *		Konclude is free software: you can redistribute it and/or modify
 *		it under the terms of version 3 of the GNU Lesser General Public
 *		License (LGPLv3) as published by the Free Software Foundation.
 *
 *		Konclude is distributed in the hope that it will be useful,
 *		but WITHOUT ANY WARRANTY; without even the implied warranty of
 *		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *		GNU (Lesser) General Public License for more details.
 *
 *		You should have received a copy of the GNU (Lesser) General Public
 *		License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
 *
 * 		This file incorporates work covered by the following copyright and  
 * 		permission notice (to be compatible with LGPLv2.1,
 *		this code is available/released under GPLv3, 
 * 		see https://www.gnu.org/licenses/gpl-faq.html#AllCompatibility):
 *
 *
 * 			Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 * 			Contact: http://www.qt-project.org/legal
 *
 * 			This file is part of the QtCore module of the Qt Toolkit.
 *
 * 			$QT_BEGIN_LICENSE:LGPL$
 * 			Commercial License Usage
 * 			Licensees holding valid commercial Qt licenses may use this file in
 * 			accordance with the commercial license agreement provided with the
 * 			Software or, alternatively, in accordance with the terms contained in
 * 			a written agreement between you and Digia.  For licensing terms and
 * 			conditions see http://qt.digia.com/licensing.  For further information
 * 			use the contact form at http://qt.digia.com/contact-us.
 *
 * 			GNU Lesser General Public License Usage
 * 			Alternatively, this file may be used under the terms of the GNU Lesser
 * 			General Public License version 2.1 as published by the Free Software
 * 			Foundation and appearing in the file LICENSE.LGPL included in the
 *			packaging of this file.  Please review the following information to
 * 			ensure the GNU Lesser General Public License version 2.1 requirements
 * 			will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 *
 * 			In addition, as a special exception, Digia gives you certain additional
 * 			rights.  These rights are described in the Digia Qt LGPL Exception
 * 			version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 *
 * 			GNU General Public License Usage
 * 			Alternatively, this file may be used under the terms of the GNU
 * 			General Public License version 3.0 as published by the Free Software
 * 			Foundation and appearing in the file LICENSE.GPL included in the
 * 			packaging of this file.  Please review the following information to
 * 			ensure the GNU General Public License version 3.0 requirements will be
 * 			met: http://www.gnu.org/copyleft/gpl.html.
 *
 *
 * 			$QT_END_LICENSE$
 *
 *
 */
 
#ifndef KONCLUDE_UTILITIES_CONTAINER_CQTMANAGEDRESTRICTEDMODIFICATIONHASH_CPP
#define KONCLUDE_UTILITIES_CONTAINER_CQTMANAGEDRESTRICTEDMODIFICATIONHASH_CPP


#include "CQtManagedRestrictedModificationHash.h"


namespace Konclude {

	namespace Utilities {

		namespace Container {


#ifdef KONCLUDE_EMPLOY_QT_MANAGED_RESTRICTED_MODIFICATION_HASH_CONTAINER


			template <class Key, class T>
			Q_INLINE_TEMPLATE void CQtManagedRestrictedModificationHash<Key, T>::deleteNode(Node *node)
			{
				deleteNode2(reinterpret_cast<CQtManagedRestrictedModificationHashData::Node*>(node));
				d->freeNode(node,mMemMan);
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE void CQtManagedRestrictedModificationHash<Key, T>::deleteNode2(CQtManagedRestrictedModificationHashData::Node *node)
			{
#ifdef Q_CC_BOR
				concrete(node)->~CQtManagedRestrictedModificationHashNode<Key, T>();
#elif defined(QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION)
				concrete(node)->~CQtManagedRestrictedModificationHashNode();
#else
				concrete(node)->~Node();
#endif
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE void CQtManagedRestrictedModificationHash<Key, T>::duplicateNode(CQtManagedRestrictedModificationHashData::Node *node, void *newNode)
			{
				Node *concreteNode = concrete(node);
				if (QTypeInfo<T>::isDummy) {
					(void) new (newNode) DummyNode(concreteNode->key);
				} else {
					(void) new (newNode) Node(concreteNode->key, concreteNode->value);
				}
			}


			template <class Key, class T>
			Q_INLINE_TEMPLATE typename CQtManagedRestrictedModificationHash<Key, T>::Node *
				CQtManagedRestrictedModificationHash<Key, T>::createNode(uint ah, const Key &akey, const T &avalue, Node **anextNode)
			{
				Node *node;

				if (QTypeInfo<T>::isDummy) {
					node = reinterpret_cast<Node *>(new (d->allocateNode(alignOfDummyNode(),mMemMan)) DummyNode(akey));
				} else {
					node = new (d->allocateNode(alignOfNode(),mMemMan)) Node(akey, avalue);
				}

				node->h = ah;
				node->next = *anextNode;
				*anextNode = node;
				++d->size;
				return node;
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE CQtManagedRestrictedModificationHash<Key, T> &CQtManagedRestrictedModificationHash<Key, T>::unite(const CQtManagedRestrictedModificationHash<Key, T> &other)
			{
				CQtManagedRestrictedModificationHash<Key, T> copy(other);
				const_iterator it = copy.constEnd();
				while (it != copy.constBegin()) {
					--it;
					insertMulti(it.key(), it.value());
				}
				return *this;
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE void CQtManagedRestrictedModificationHash<Key, T>::freeData(CQtManagedRestrictedModificationHashData *x)
			{
				x->free_helper(deleteNode2,mMemMan);
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE void CQtManagedRestrictedModificationHash<Key, T>::clear()
			{
				*this = CQtManagedRestrictedModificationHash<Key,T>(mContext);
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE void CQtManagedRestrictedModificationHash<Key, T>::detach_helper()
			{
				CQtManagedRestrictedModificationHashData *x = d->detach_helper2(duplicateNode, deleteNode2,
					QTypeInfo<T>::isDummy ? sizeof(DummyNode) : sizeof(Node),
					QTypeInfo<T>::isDummy ? alignOfDummyNode() : alignOfNode(),this,mMemMan);
				//if (!d->ref.deref())
				if (d->refHash == this)
					freeData(d);
				d = x;
			}



			template <class Key, class T>
			Q_INLINE_TEMPLATE bool CQtManagedRestrictedModificationHash<Key, T>::copyRestricted_helper(CQtManagedRestrictedModificationHashData::Node *node, void* assistValue)
			{
				Node *concreteNode = concrete(node);
				return concreteNode->value.restrictedCopy(assistValue);
			}


			template <class Key, class T>
			Q_INLINE_TEMPLATE void CQtManagedRestrictedModificationHash<Key, T>::detach_helper_RestrictedCopy(void* assistValue) {
				CQtManagedRestrictedModificationHashData *x = d->restricted_detach_helper2(copyRestricted_helper,assistValue,duplicateNode, deleteNode2,
					QTypeInfo<T>::isDummy ? sizeof(DummyNode) : sizeof(Node),
					QTypeInfo<T>::isDummy ? alignOfDummyNode() : alignOfNode(),this,mMemMan);
				//if (!d->ref.deref())
				if (d->refHash == this)
					freeData(d);
				d = x;
			}



			template <class Key, class T>
			Q_INLINE_TEMPLATE CQtManagedRestrictedModificationHash<Key, T> &CQtManagedRestrictedModificationHash<Key, T>::operator=(const CQtManagedRestrictedModificationHash<Key, T> &other)
			{
				if (d != other.d) {
					//other.d->ref.ref();
					//if (!d->ref.deref())
					if (d->refHash == this)
						freeData(d);
					d = other.d;
					if (!d->sharable)
						detach_helper();
				}
				return *this;
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE CQtManagedRestrictedModificationHash<Key, T>* CQtManagedRestrictedModificationHash<Key, T>::init(const CQtManagedRestrictedModificationHash<Key, T>& other, CContext* context)
			{
				if (d != other.d) {
					if (d->refHash == this)
						freeData(d);
					mContext = context;
					mMemMan = CContext::getMemoryAllocationManager(mContext);
					d = other.d;
					if (!d->sharable)
						detach_helper();
				}
				mContext = context;
				mMemMan = CContext::getMemoryAllocationManager(mContext);
				return this;
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE CQtManagedRestrictedModificationHash<Key, T>* CQtManagedRestrictedModificationHash<Key, T>::init(CContext* context)
			{
				if (d->refHash == this)
					freeData(d);
				mContext = context;					
				mMemMan = CContext::getMemoryAllocationManager(mContext);
				d = &CQtManagedRestrictedModificationHashData::shared_null;
				return this;
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE CQtManagedRestrictedModificationHash<Key, T>* CQtManagedRestrictedModificationHash<Key, T>::init(CQtManagedRestrictedModificationHash<Key, T>* other, CContext* context)
			{
				if (other) {
					if (d != other->d) {
						if (d->refHash ==  this)
							freeData(d);
						mContext = context;
						mMemMan = CContext::getMemoryAllocationManager(mContext);
						if (other) {
							d = other->d;
							if (!d->sharable)
								detach_helper();
						}
					}
				} else {
					if (d->refHash == this)
						freeData(d);
					d = &CQtManagedRestrictedModificationHashData::shared_null;
				}
				mContext = context;
				mMemMan = CContext::getMemoryAllocationManager(mContext);
				return this;
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE const T CQtManagedRestrictedModificationHash<Key, T>::value(const Key &akey) const
			{
				Node *node;
				if (d->size == 0 || (node = *findNode(akey)) == e) {
					return T();
				} else {
					return node->value;
				}
			}


			template <class Key, class T>
			Q_INLINE_TEMPLATE T* CQtManagedRestrictedModificationHash<Key, T>::valuePointer(const Key& akey) const {
				Node *node;
				if (d->size == 0 || (node = *findNode(akey)) == e) {
					return nullptr;
				} else {
					return &node->value;
				}
			}


			template <class Key, class T>
			Q_INLINE_TEMPLATE const T CQtManagedRestrictedModificationHash<Key, T>::value(const Key &akey, const T &adefaultValue) const
			{
				Node *node;
				if (d->size == 0 || (node = *findNode(akey)) == e) {
					return adefaultValue;
				} else {
					return node->value;
				}
			}


			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE bool CQtManagedRestrictedModificationHash<Key, T>::tryGetValuePointer(const Key& akey, T*& valuePointer) const {
				Node *node;
				if (d->size == 0 || (node = *findNode(akey)) == e) {
					return false;
				} else {
					valuePointer = &node->value;
					return true;
				}
			}


			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE bool CQtManagedRestrictedModificationHash<Key, T>::tryGetValue(const Key& akey, T* value) const {
				Node *node;
				if (d->size == 0 || (node = *findNode(akey)) == e) {
					return false;
				} else {
					*value = node->value;
					return true;
				}
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE QList<Key> CQtManagedRestrictedModificationHash<Key, T>::uniqueKeys() const
			{
				QList<Key> res;
				const_iterator i = begin();
				if (i != end()) {
					for (;;) {
						const Key &aKey = i.key();
						res.append(aKey);
						do {
							if (++i == end())
								goto break_out_of_outer_loop;
						} while (aKey == i.key());
					}
				}
break_out_of_outer_loop:
				return res;
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE QList<Key> CQtManagedRestrictedModificationHash<Key, T>::keys() const
			{
				QList<Key> res;
				const_iterator i = begin();
				while (i != end()) {
					res.append(i.key());
					++i;
				}
				return res;
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE QList<Key> CQtManagedRestrictedModificationHash<Key, T>::keys(const T &avalue) const
			{
				QList<Key> res;
				const_iterator i = begin();
				while (i != end()) {
					if (i.value() == avalue)
						res.append(i.key());
					++i;
				}
				return res;
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE const Key CQtManagedRestrictedModificationHash<Key, T>::key(const T &avalue) const
			{
				return key(avalue, Key());
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE const Key CQtManagedRestrictedModificationHash<Key, T>::key(const T &avalue, const Key &defaultValue) const
			{
				const_iterator i = begin();
				while (i != end()) {
					if (i.value() == avalue)
						return i.key();
					++i;
				}

				return defaultValue;
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE QList<T> CQtManagedRestrictedModificationHash<Key, T>::values() const
			{
				QList<T> res;
				const_iterator i = begin();
				while (i != end()) {
					res.append(i.value());
					++i;
				}
				return res;
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE QList<T> CQtManagedRestrictedModificationHash<Key, T>::values(const Key &akey) const
			{
				QList<T> res;
				Node *node = *findNode(akey);
				if (node != e) {
					do {
						res.append(node->value);
					} while ((node = node->next) != e && node->key == akey);
				}
				return res;
			}



			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE CQtManagedRestrictedModificationList<Key> CQtManagedRestrictedModificationHash<Key, T>::uniqueKeysInManagedRestrictedModificationList(CContext* context) const
			{
				CQtManagedRestrictedModificationList<Key> res(context);
				const_iterator i = begin();
				if (i != end()) {
					for (;;) {
						const Key &aKey = i.key();
						res.append(aKey);
						do {
							if (++i == end())
								goto break_out_of_outer_loop;
						} while (aKey == i.key());
					}
				}
break_out_of_outer_loop:
				return res;
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE CQtManagedRestrictedModificationList<Key> CQtManagedRestrictedModificationHash<Key, T>::keysInManagedRestrictedModificationList(CContext* context) const
			{
				CQtManagedRestrictedModificationList<Key> res(context);
				const_iterator i = begin();
				while (i != end()) {
					res.append(i.key());
					++i;
				}
				return res;
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE CQtManagedRestrictedModificationList<Key> CQtManagedRestrictedModificationHash<Key, T>::keysInManagedRestrictedModificationList(const T &avalue, CContext* context) const
			{
				CQtManagedRestrictedModificationList<Key> res(context);
				const_iterator i = begin();
				while (i != end()) {
					if (i.value() == avalue)
						res.append(i.key());
					++i;
				}
				return res;
			}


			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE CQtManagedRestrictedModificationList<T> CQtManagedRestrictedModificationHash<Key, T>::valuesInManagedRestrictedModificationList(CContext* context) const
			{
				CQtManagedRestrictedModificationList<T> res(context);
				const_iterator i = begin();
				while (i != end()) {
					res.append(i.value());
					++i;
				}
				return res;
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE CQtManagedRestrictedModificationList<T> CQtManagedRestrictedModificationHash<Key, T>::valuesInManagedRestrictedModificationList(const Key &akey, CContext* context) const
			{
				CQtManagedRestrictedModificationList<T> res(context);
				Node *node = *findNode(akey);
				if (node != e) {
					do {
						res.append(node->value);
					} while ((node = node->next) != e && node->key == akey);
				}
				return res;
			}


			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE int CQtManagedRestrictedModificationHash<Key, T>::count(const Key &akey) const
			{
				int cnt = 0;
				Node *node = *findNode(akey);
				if (node != e) {
					do {
						++cnt;
					} while ((node = node->next) != e && node->key == akey);
				}
				return cnt;
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE const T CQtManagedRestrictedModificationHash<Key, T>::operator[](const Key &akey) const
			{
				return value(akey);
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE T &CQtManagedRestrictedModificationHash<Key, T>::operator[](const Key &akey)
			{
				detach();

				uint h;
				Node **node = findNode(akey, &h);
				if (*node == e) {
					if (d->willGrow(mMemMan))
						node = findNode(akey, &h);
					return createNode(h, akey, T(), node)->value;
				}
				return (*node)->value;
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE typename CQtManagedRestrictedModificationHash<Key, T>::iterator CQtManagedRestrictedModificationHash<Key, T>::insert(const Key &akey,
				const T &avalue)
			{
				detach();

				uint h;
				Node **node = findNode(akey, &h);
				if (*node == e) {
					if (d->willGrow(mMemMan))
						node = findNode(akey, &h);
					return iterator(createNode(h, akey, avalue, node));
				}

				if (!QTypeInfo<T>::isDummy)
					(*node)->value = avalue;
				return iterator(*node);
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE typename CQtManagedRestrictedModificationHash<Key, T>::iterator CQtManagedRestrictedModificationHash<Key, T>::insertMulti(const Key &akey,
				const T &avalue)
			{
				detach();
				d->willGrow(mMemMan);

				uint h;
				Node **nextNode = findNode(akey, &h);
				return iterator(createNode(h, akey, avalue, nextNode));
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE int CQtManagedRestrictedModificationHash<Key, T>::remove(const Key &akey)
			{
				if (isEmpty()) // prevents detaching shared null
					return 0;
				detach();

				int oldSize = d->size;
				Node **node = findNode(akey);
				if (*node != e) {
					bool deleteNext = true;
					do {
						Node *next = (*node)->next;
						deleteNext = (next != e && next->key == (*node)->key);
						deleteNode(*node);
						*node = next;
						--d->size;
					} while (deleteNext);
					d->hasShrunk(mMemMan);
				}
				return oldSize - d->size;
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE T CQtManagedRestrictedModificationHash<Key, T>::take(const Key &akey)
			{
				if (isEmpty()) // prevents detaching shared null
					return T();
				detach();

				Node **node = findNode(akey);
				if (*node != e) {
					T t = (*node)->value;
					Node *next = (*node)->next;
					deleteNode(*node);
					*node = next;
					--d->size;
					d->hasShrunk(mMemMan);
					return t;
				}
				return T();
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE typename CQtManagedRestrictedModificationHash<Key, T>::iterator CQtManagedRestrictedModificationHash<Key, T>::erase(iterator it)
			{
				if (it == iterator(e))
					return it;

				iterator ret = it;
				++ret;

				Node *node = it;
				Node **node_ptr = reinterpret_cast<Node **>(&d->buckets[node->h % d->numBuckets]);
				while (*node_ptr != node)
					node_ptr = &(*node_ptr)->next;
				*node_ptr = node->next;
				deleteNode(node);
				--d->size;
				return ret;
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE void CQtManagedRestrictedModificationHash<Key, T>::reserve(int asize)
			{
				detach();
				d->rehash(-qMax(asize, 1),mMemMan);
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE typename CQtManagedRestrictedModificationHash<Key, T>::const_iterator CQtManagedRestrictedModificationHash<Key, T>::find(const Key &akey) const
			{
				return const_iterator(*findNode(akey));
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE typename CQtManagedRestrictedModificationHash<Key, T>::const_iterator CQtManagedRestrictedModificationHash<Key, T>::constFind(const Key &akey) const
			{
				return const_iterator(*findNode(akey));
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE typename CQtManagedRestrictedModificationHash<Key, T>::iterator CQtManagedRestrictedModificationHash<Key, T>::find(const Key &akey)
			{
				detach();
				return iterator(*findNode(akey));
			}

			template <class Key, class T>
			Q_INLINE_TEMPLATE bool CQtManagedRestrictedModificationHash<Key, T>::contains(const Key &akey) const
			{
				return *findNode(akey) != e;
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE typename CQtManagedRestrictedModificationHash<Key, T>::Node **CQtManagedRestrictedModificationHash<Key, T>::findNode(const Key &akey,
				uint *ahp) const
			{
				Node **node;
				uint h = qHash(akey);

				if (d->numBuckets) {
					node = reinterpret_cast<Node **>(&d->buckets[h % d->numBuckets]);
					Q_ASSERT(*node == e || (*node)->next);
					while (*node != e && !(*node)->same_key(h, akey))
						node = &(*node)->next;
				} else {
					node = const_cast<Node **>(reinterpret_cast<const Node * const *>(&e));
				}
				if (ahp)
					*ahp = h;
				return node;
			}

			template <class Key, class T>
			Q_OUTOFLINE_TEMPLATE bool CQtManagedRestrictedModificationHash<Key, T>::operator==(const CQtManagedRestrictedModificationHash<Key, T> &other) const
			{
				if (size() != other.size())
					return false;
				if (d == other.d)
					return true;

				const_iterator it = begin();

				while (it != end()) {
					const Key &akey = it.key();

					const_iterator it2 = other.find(akey);
					do {
						if (it2 == other.end() || !(it2.key() == akey))
							return false;
						if (!QTypeInfo<T>::isDummy && !(it.value() == it2.value()))
							return false;
						++it;
						++it2;
					} while (it != end() && it.key() == akey);
				}
				return true;
			}


#endif // KONCLUDE_EMPLOY_QT_MANAGED_RESTRICTED_MODIFICATION_HASH_CONTAINER


		}; // end namespace Container

	}; // end namespace Utilities

}; // end namespace Konclude

#endif // KONCLUDE_UTILITIES_CONTAINER_CQTMANAGEDRESTRICTEDMODIFICATIONHASH_CPP