5 #include <libutl/Collection.h> 6 #include <libutl/AutoPtr.h> 28 template <
class T = Object>
44 auto rhsCol = findRHS(rhs);
45 if (_col == rhsCol)
return 0;
46 if (rhsCol ==
nullptr)
return 1;
47 if (_col ==
nullptr)
return -1;
48 return _col->compare(*rhsCol);
54 auto rhsCol = findRHS(rhs);
55 if (_col == rhsCol)
return;
56 setCollection(
nullptr);
57 if (rhsCol ==
nullptr)
return;
58 _col = rhsCol->clone();
70 col()->dump(os, level);
76 col()->serialize(stream, io, mode);
82 col()->serialize(rtc, stream, io, mode);
86 update(
const Object*
object)
88 return col()->update(
object);
94 return col()->isOwner();
100 col()->setOwner(owner);
106 return col()->ordering();
112 return col()->ordering();
118 col()->setOrdering(ordering, algorithm);
124 col()->setOrdering(ordering, algorithm);
130 return col()->empty();
136 return col()->isMultiSet();
140 setMultiSet(
bool multiSet)
142 col()->setMultiSet(multiSet);
148 return col()->items();
154 return col()->size();
160 return col()->add(
object);
166 return col()->add(
object);
172 col()->add(collection);
176 addIt(
const Object*
object)
182 addOrUpdate(
const Object&
object)
184 col()->addOrUpdate(
object);
188 addOrUpdate(
const Object*
object)
190 col()->addOrUpdate(
object);
196 col()->copyItems(src, pred, predVal);
201 copyItems(
const ListNode* src,
const Predicate* pred =
nullptr,
bool predVal =
true)
203 col()->copyItems(src, pred, predVal);
210 col()->copyItems(src, pred, predVal);
216 col()->operator+=(rhs);
222 col()->operator+=(rhs);
228 col()->operator+=(rhs);
234 col()->operator-=(rhs);
243 const char* separator,
246 col()->dump(os, level, key, printClassName, indent, separator);
262 toString(
const char* sep,
bool key =
false)
const 288 return col()->beginNew();
294 return col()->beginNew();
300 return col()->createIt();
306 return col()->createIt();
324 return col()->endNew();
330 return col()->endNew();
334 contains(
const Object* key)
const 336 return col()->contains(key);
340 contains(
const Object& key)
const 342 return col()->contains(key);
348 return col()->count(pred, predVal);
352 find(
const Object* key)
const 354 return utl::cast<T>(col()->find(key));
358 find(
const Object& key)
const 360 return utl::cast<T>(col()->find(key));
366 return col()->findIt(key, it);
372 return col()->findIt(key, it);
378 return utl::cast<T>(col()->first());
382 has(
const Object* key)
const 384 return col()->has(key);
388 has(
const Object& key)
const 390 return col()->has(key);
396 return utl::cast<T>(col()->last());
415 return col()->remove(key);
427 return (T*)(col()->take(it));
472 if (col == _col)
return;
478 findRHS(
const Object& rhs)
487 return utl::cast<Collection>(&rhs);
#define UTL_CLASS_IMPL_TPL(className, T)
Implementation of standard UTL++ functionality for a template class.
String toString(const FwdIt &begin, const FwdIt &end, const String &sep, bool key=false)
Obtain a string representation of a sequence (via Object::toString()).
void serialize(bool &b, Stream &stream, uint_t io, uint_t mode=ser_default)
Serialize a boolean.
void deInit()
De-initialize UTL++.
Object comparison abstraction.
default representation (via getSerializeMode())
Store information about a class.
Templated proxy for BidIt.
virtual void dump(Stream &os, uint_t level=uint_t_max) const
Dump a human-readable representation of self to the given output stream.
virtual void copy(const Object &rhs)
Copy another instance.
Logical predicate abstraction.
virtual void serialize(Stream &stream, uint_t io, uint_t mode=ser_default)
Serialize to or from a stream.
Templated proxy for Collection.
unsigned int uint_t
Unsigned integer.
const uint_t uint_t_max
Maximum uint_t value.
Bi-directional iterator abstraction.
#define UTL_CLASS_DECL_TPL(DC, T, BC)
Declaration of standard UTL++ functionality for a template class with one parameter.
virtual int compare(const Object &rhs) const
Compare with another object.
virtual String toString() const
Return a string representation of self.
Root of UTL++ class hierarchy.
void dump(const FwdIt &begin, const FwdIt &end, Stream &os, uint_t level=uint_t_max, bool key=false, bool printClassName=false, uint_t indent=0, const char *separator=nullptr)
Dump objects to the given stream (with Object::dump()).
void init()
Initialize UTL++.
virtual String toString() const
Return a string representation of self.
TCollection(Collection *col)
Constructor.
#define ASSERTD
Do an assertion in DEBUG mode only.
size_t count(const FwdIt &begin, const FwdIt &end, const Predicate *pred=nullptr, bool predVal=true)
Count objects that satisfy a Predicate.