KSquare Utilities
KKB::XmlAttributeList Class Reference

#include <XmlStream.h>

+ Inheritance diagram for KKB::XmlAttributeList:

Public Member Functions

 XmlAttributeList (bool _owner)
 
 XmlAttributeList (const XmlAttributeList &attributes)
 
void AddAttribute (const KKStr &name, const KKStr &value)
 
KKStrConstPtr AttributeNameByIndex (kkuint32 index) const
 
KKStrConstPtr AttributeValueByIndex (kkuint32 index) const
 
KKStrConstPtr AttributeValueByName (const KKStr &name) const
 
DateTime AttributeValueDateTime (const KKStr &name) const
 
kkint32 AttributeValueInt32 (const KKStr &name) const
 
const KKStrAttributeValueKKStr (const KKStr &name) const
 
XmlAttributePtr LookUpByName (const KKStr &name) const
 
virtual XmlAttributePtr PopFromBack ()
 
virtual XmlAttributePtr PopFromFromt ()
 
virtual void PushOnBack (XmlAttributePtr a)
 
virtual void PushOnFront (XmlAttributePtr a)
 
- Public Member Functions inherited from KKB::KKQueue< XmlAttribute >
 KKQueue (bool _owner=true)
 
 KKQueue (const KKQueue &q, bool _owner)
 Constructor, similar to the Copy Constructor except that you can control whether it duplicates the contents. More...
 
virtual ~KKQueue ()
 Virtual destructor; if owns its contents will also call the destructor on each one entry that it contains. More...
 
virtual void Add (EntryPtr _entry)
 
virtual void AddFirst (EntryPtr _entry)
 
virtual void AddQueue (const KKQueue &q)
 Add the contents of a separate KKQueue container to this container. More...
 
EntryPtr BackOfQueue () const
 
void DeleteContents ()
 
void DeleteEntry (EntryPtr _entry)
 
void DeleteEntry (kkuint32 _idx)
 
KKQueueDuplicateListAndContents () const
 Creates a new container including duplicating the contents, which also makes the new instance the owner of those contents. More...
 
kkuint32 FindTheKthElement (kkuint32 k, Functor pred)
 
EntryPtr FrontOfQueue () const
 
EntryPtr GetFirst () const
 
EntryPtr GetLast () const
 
EntryPtr IdxToPtr (kkuint32 idx) const
 
kkint32 LocateEntry (EntryConstPtr _entry) const
 
EntryPtr LookAtBack () const
 
EntryPtr LookAtFront () const
 
bool operator!= (const KKQueue< XmlAttribute > &rightSide) const
 returns False if NOT every entry in both containers point to the same elements More...
 
KKQueueoperator= (const KKQueue &q)
 Assignment Operator. More...
 
bool operator== (const KKQueue< XmlAttribute > &rightSide) const
 Returns True if every entry in both containers point to the same elements. More...
 
XmlAttributeoperator[] (kkuint32 i) const
 
bool Owner () const
 
void Owner (bool _owner)
 
virtual EntryPtr PopFromFront ()
 
kkint32 PtrToIdx (EntryConstPtr _entry) const
 
kkint32 QueueSize () const
 
void RandomizeOrder ()
 Randomizes the order of the vector. More...
 
void RandomizeOrder (kkint64 seed)
 
void RandomizeOrder (RandomNumGenerator &randomVariable)
 Randomizes the order of the vector. More...
 
virtual EntryPtr RemoveFirst ()
 
virtual EntryPtr RemoveLast ()
 
void SetIdxToPtr (kkuint32 _idx, XmlAttribute *_ptr)
 
void SwapIndexes (size_t idx1, size_t idx2)
 

Additional Inherited Members

- Public Types inherited from KKB::KKQueue< XmlAttribute >
typedef std::vector< XmlAttribute * >::const_iterator const_iterator
 
typedef std::vector< XmlAttribute * >::iterator iterator
 
- Protected Member Functions inherited from KKB::KKQueue< XmlAttribute >
 KKQueue (const KKQueue &q)
 Copy Constructor creating new instance; including duplicating contents if owner set to true. More...
 

Detailed Description

Definition at line 136 of file XmlStream.h.

Constructor & Destructor Documentation

XmlAttributeList::XmlAttributeList ( bool  _owner)

Definition at line 235 of file XmlStream.cpp.

References XmlAttributeList().

Referenced by XmlAttributeList().

235  :
236  KKQueue<XmlAttribute> (_owner)
237 {
238 }
XmlAttributeList::XmlAttributeList ( const XmlAttributeList attributes)

Definition at line 241 of file XmlStream.cpp.

242 {
244  for (idx = attributes.begin (); idx != attributes.end (); ++idx)
245  PushOnBack (*idx);
246 }
std::vector< XmlAttribute * >::const_iterator const_iterator
Definition: KKQueue.h:89
virtual void PushOnBack(XmlAttributePtr a)
Definition: XmlStream.cpp:250

Member Function Documentation

void XmlAttributeList::AddAttribute ( const KKStr name,
const KKStr value 
)

Definition at line 366 of file XmlStream.cpp.

References PushOnBack(), and KKB::XmlAttribute::XmlAttribute().

369 {
370  PushOnBack (new XmlAttribute (name, value));
371 }
virtual void PushOnBack(XmlAttributePtr a)
Definition: XmlStream.cpp:250
KKStrConstPtr XmlAttributeList::AttributeNameByIndex ( kkuint32  index) const

Definition at line 320 of file XmlStream.cpp.

321 {
322  if (index >= size ())
323  return NULL;
324  else
325  return &(at (index)->Name ());
326 }
KKStrConstPtr XmlAttributeList::AttributeValueByIndex ( kkuint32  index) const

Definition at line 311 of file XmlStream.cpp.

312 {
313  if (index >= size ())
314  return NULL;
315  else
316  return &(at (index)->Value ());
317 }
KKStrConstPtr XmlAttributeList::AttributeValueByName ( const KKStr name) const

Definition at line 301 of file XmlStream.cpp.

References LookUpByName(), and KKB::XmlAttribute::Value().

Referenced by AttributeValueDateTime(), AttributeValueInt32(), and AttributeValueKKStr().

302 {
303  XmlAttributePtr a = LookUpByName (name);
304  if (a)
305  return &(a->Value ());
306  else
307  return NULL;
308 }
const KKStr & Value() const
Definition: XmlStream.h:123
XmlAttributePtr LookUpByName(const KKStr &name) const
Definition: XmlStream.cpp:375
DateTime XmlAttributeList::AttributeValueDateTime ( const KKStr name) const

Definition at line 352 of file XmlStream.cpp.

References AttributeValueByName(), and KKB::DateTime::DateTime().

353 {
355  if (!s)
356  return DateTime ();
357 
358  DateTime dt (*s);
359  return dt;
360 }
KKStrConstPtr AttributeValueByName(const KKStr &name) const
Definition: XmlStream.cpp:301
kkint32 XmlAttributeList::AttributeValueInt32 ( const KKStr name) const

Definition at line 341 of file XmlStream.cpp.

References AttributeValueByName(), and KKB::KKStr::ToInt32().

342 {
344  if (!s)
345  return 0;
346  else
347  return s->ToInt32 ();
348 }
KKStrConstPtr AttributeValueByName(const KKStr &name) const
Definition: XmlStream.cpp:301
kkint32 ToInt32() const
Definition: KKStr.cpp:3587
const KKStr & XmlAttributeList::AttributeValueKKStr ( const KKStr name) const

Definition at line 330 of file XmlStream.cpp.

References AttributeValueByName(), KKB::KKStr::Concat(), and KKB::KKStr::EmptyStr().

331 {
333  if (s)
334  return *s;
335  else
336  return KKStr::EmptyStr ();
337 }
KKStrConstPtr AttributeValueByName(const KKStr &name) const
Definition: XmlStream.cpp:301
static const KKStr & EmptyStr()
Static method that returns an Empty String.
Definition: KKStr.cpp:3453
XmlAttributePtr XmlAttributeList::LookUpByName ( const KKStr name) const

Definition at line 375 of file XmlStream.cpp.

Referenced by AttributeValueByName().

376 {
377  NameIndex::const_iterator idx;
378  idx = nameIndex.find (name);
379  if (idx == nameIndex.end ())
380  return NULL;
381 
382  if (idx->first != name)
383  return NULL;
384 
385  return idx->second;
386 }
XmlAttributePtr XmlAttributeList::PopFromBack ( )
virtual

Removes the last element in the container and returns its pointer. If the container is empty will return NULL.

Reimplemented from KKB::KKQueue< XmlAttribute >.

Definition at line 264 of file XmlStream.cpp.

265 {
267  if (a)
268  DeleteFromNameIndex (a);
269  return a;
270 }
virtual EntryPtr PopFromBack()
Definition: KKQueue.h:648
XmlAttributePtr XmlAttributeList::PopFromFromt ( )
virtual

Definition at line 273 of file XmlStream.cpp.

274 {
276  if (a)
277  DeleteFromNameIndex (a);
278  return a;
279 }
virtual EntryPtr PopFromFront()
Definition: KKQueue.h:596
void XmlAttributeList::PushOnBack ( XmlAttributePtr  _entry)
virtual

Adds '_entry' to the End of the container.

Reimplemented from KKB::KKQueue< XmlAttribute >.

Definition at line 250 of file XmlStream.cpp.

Referenced by AddAttribute().

251 {
253  nameIndex.insert (NameIndexPair (a->Name (), a));
254 }
virtual void PushOnBack(EntryPtr _entry)
Definition: KKQueue.h:398
void XmlAttributeList::PushOnFront ( XmlAttributePtr  _entry)
virtual

Adds '_entry' to the Front of the container.

Reimplemented from KKB::KKQueue< XmlAttribute >.

Definition at line 257 of file XmlStream.cpp.

258 {
260  nameIndex.insert (NameIndexPair (a->Name (), a));
261 }
virtual void PushOnFront(EntryPtr _entry)
Definition: KKQueue.h:383

The documentation for this class was generated from the following files: