Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XalanVector.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
22 #if !defined(XALANVECTOR_HEADER_GUARD_1357924680)
23 #define XALANVECTOR_HEADER_GUARD_1357924680
24 
25 
26 
27 // Base include file. Must be first.
29 
30 
33 
34 
35 #include <cstddef>
36 #include <algorithm>
37 #include <cassert>
38 #include <new>
39 #include <iterator>
40 #include <stdexcept>
41 
42 
43 
44 
45 
46 XALAN_CPP_NAMESPACE_BEGIN
47 
48 
49 #if defined(_MSC_VER)
50 #pragma warning(push)
51 #pragma warning(disable: 4100)
52 #endif
53 
54 
55 
56 XALAN_USING_XERCES(MemoryManager)
57 
58 
59 
60 template <class Type, class ConstructionTraits = MemoryManagedConstructionTraits<Type> >
62 {
63 public:
64 
65 
66  typedef Type value_type;
67  typedef value_type* pointer;
68  typedef const value_type* const_pointer;
69  typedef value_type& reference;
70  typedef const value_type& const_reference;
71  typedef size_t size_type;
72  typedef ptrdiff_t difference_type;
73 
74 #if defined(XALAN_VCPP_USE_PTRIT)
75  typedef std::_Ptrit<
76  Type,
77  ptrdiff_t,
78  pointer,
79  reference,
80  pointer,
81  reference> iterator;
82 
83  typedef std::_Ptrit<
84  Type,
85  ptrdiff_t,
86  const_pointer,
87  const_reference,
88  pointer,
89  reference> const_iterator;
90 #else
91  typedef value_type* iterator;
92  typedef const value_type* const_iterator;
93 #endif
94 
95 #if defined(XALAN_HAS_STD_ITERATORS)
96  typedef XALAN_STD_QUALIFIER reverse_iterator<iterator> reverse_iterator_;
98 #elif defined(XALAN_RW_NO_CLASS_PARTIAL_SPEC)
99  typedef XALAN_STD_QUALIFIER reverse_iterator<
100  iterator,
101  XALAN_STD_QUALIFIER random_access_iterator_tag,
102  value_type> reverse_iterator_;
103  typedef XALAN_STD_QUALIFIER reverse_iterator<
104  const_iterator,
105  XALAN_STD_QUALIFIER random_access_iterator_tag,
106  const value_type> const_reverse_iterator_;
107 #else
110 #endif
111 
112  typedef reverse_iterator_ reverse_iterator;
113  typedef const_reverse_iterator_ const_reverse_iterator;
114 
116 
117  typedef typename ConstructionTraits::Constructor Constructor;
119 
121  MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMORY_MGR,
122  size_type initialAllocation = size_type(0)) :
123  m_memoryManager(&theManager),
124  m_size(0),
125  m_allocation(initialAllocation),
126  m_data(initialAllocation > 0 ? allocate(initialAllocation) : 0)
127  {
128  invariants();
129  }
130 
131  static XalanVector*
133  MemoryManager& theManager,
134  size_type initialAllocation = size_type(0))
135  {
136  typedef XalanVector ThisType;
137 
138  XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
139 
140  ThisType* theResult = theGuard.get();
141 
142  new (theResult) ThisType(theManager, initialAllocation);
143 
144  theGuard.release();
145 
146  return theResult;
147  }
148 
150  const ThisType& theSource,
151  MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMORY_MGR,
152  size_type theInitialAllocation = size_type(0)) :
153  m_memoryManager(&theManager),
154  m_size(0),
155  m_allocation(0),
156  m_data(0)
157  {
158  if (theSource.m_size > 0)
159  {
160  ThisType theTemp(theManager, local_max(theSource.m_size, theInitialAllocation));
161 
162  theTemp.insert(theTemp.begin(), theSource.begin(), theSource.end());
163 
164  swap(theTemp);
165 
166  }
167  else if (theInitialAllocation > 0)
168  {
169  m_data = allocate(theInitialAllocation);
170 
171  m_allocation = theInitialAllocation;
172  }
173 
174  invariants();
175  }
176 
178  const_iterator theFirst,
179  const_iterator theLast,
180  MemoryManager& theManager) :
181  m_memoryManager(&theManager),
182  m_size(0),
183  m_allocation(0),
184  m_data(0)
185 
186  {
187  ThisType theTemp(theManager);
188 
189  theTemp.insert(theTemp.begin(), theFirst, theLast);
190 
191  swap(theTemp);
192 
193  invariants();
194  }
195 
196  static XalanVector*
198  const_iterator theFirst,
199  const_iterator theLast,
200  MemoryManager& theManager)
201  {
202  typedef XalanVector ThisType;
203 
204  XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
205 
206  ThisType* theResult = theGuard.get();
207 
208  new (theResult) ThisType(theFirst, theLast, theManager);
209 
210  theGuard.release();
211 
212  return theResult;
213  }
214 
216  size_type theInsertSize,
217  const value_type& theData,
218  MemoryManager& theManager) :
219  m_memoryManager(&theManager),
220  m_size(0),
221  m_allocation(0),
222  m_data(0)
223  {
224  ThisType theTemp(theManager);
225 
226  theTemp.insert(theTemp.begin(), theInsertSize, theData);
227 
228  swap(theTemp);
229 
230  invariants();
231  }
232 
234  {
235  invariants();
236 
237  if (m_allocation != 0)
238  {
239  destroy(begin(), end());
240 
241  deallocate(m_data);
242  }
243  }
244 
245  void
246  push_back(const value_type& data)
247  {
248  invariants();
249 
250  doPushBack(data);
251 
252  invariants();
253  }
254 
255  void
257  {
258  invariants();
259 
260  --m_size;
261 
262  destroy(m_data[m_size]);
263 
264  invariants();
265  }
266 
267  iterator
269  iterator theFirst,
270  iterator theLast)
271  {
272  invariants();
273 
274  if (theFirst != theLast)
275  {
276  XALAN_STD_QUALIFIER copy(
277  theLast,
278  end(),
279  theFirst);
280 
281  shrinkCount(local_distance(theFirst, theLast));
282  }
283 
284  invariants();
285 
286  return theFirst;
287  }
288 
289  iterator
290  erase(iterator position)
291  {
292  return erase(position, position + 1);
293  }
294 
295  void
297  iterator thePosition,
298  const_iterator theFirst,
299  const_iterator theLast)
300  {
301  // Since we're using bare pointers for now, we can
302  // assert this...
303  assert(theFirst <= theLast);
304  assert(thePosition >= begin());
305  assert(thePosition <= end());
306 
307  invariants();
308 
309  const size_type theInsertSize =
310  local_distance(theFirst, theLast);
311 
312  if (theInsertSize == 0)
313  {
314  return;
315  }
316 
317  const size_type theTotalSize = size() + theInsertSize;
318 
319  if (thePosition == end())
320  {
321  pointer thePointer = ensureCapacity(theTotalSize);
322 
323  while (theFirst != theLast)
324  {
325  Constructor::construct(thePointer, *theFirst, *m_memoryManager);
326 
327  ++thePointer;
328  ++m_size;
329  ++theFirst;
330  }
331  }
332  else
333  {
334  if (theTotalSize > capacity())
335  {
336  assert (m_memoryManager != 0);
337 
338  ThisType theTemp(*m_memoryManager, theTotalSize);
339 
340  // insert everything up to the position...
341  theTemp.insert(theTemp.end(), begin(), thePosition);
342 
343  // insert the new stuff...
344  theTemp.insert(theTemp.end(), theFirst, theLast);
345 
346  // insert everything from the position to the end...
347  theTemp.insert(theTemp.end(), thePosition, end());
348 
349  swap(theTemp);
350  }
351  else
352  {
353  // insert into the middle of the vector that has enough capacity
354  const iterator theOriginalEnd = end();
355 
356  const size_type theRightSplitSize =
357  local_distance(thePosition, theOriginalEnd);
358 
359  if (theRightSplitSize <= theInsertSize)
360  {
361  // inserted range will go to or beyond edge of current vector
362 
363  // append from inserted range, all values that will extend
364  // beyond the current vector
365  const const_iterator toInsertSplit = theFirst + theRightSplitSize;
366  const_iterator toInsertIter = toInsertSplit;
367 
368  while (toInsertIter != theLast)
369  {
370  doPushBack(*toInsertIter);
371 
372  ++toInsertIter;
373  }
374 
375  // copy the "right" of the current vector to the end
376  toInsertIter = thePosition;
377  while (toInsertIter != theOriginalEnd)
378  {
379  doPushBack(*toInsertIter);
380 
381  ++toInsertIter;
382  }
383 
384  // copy the remaining part of inserted range into
385  // the original vector spaces
386  XALAN_STD_QUALIFIER copy(theFirst, toInsertSplit, thePosition);
387  }
388  else
389  {
390  // inserted range will not extend beyond edge of current vector
391 
392  // move end of current vector by insertion size
393  const_iterator toMoveIter = end() - theInsertSize;
394 
395  while (toMoveIter != theOriginalEnd)
396  {
397  doPushBack(*toMoveIter);
398 
399  ++toMoveIter;
400  }
401 
402  // reverse copy the remaining part of the "right" piece of the current vector
403  XALAN_STD_QUALIFIER copy_backward(thePosition, theOriginalEnd - theInsertSize, theOriginalEnd);
404 
405  // insert into current vector
406  XALAN_STD_QUALIFIER copy(theFirst, theLast, thePosition);
407  }
408  }
409  }
410 
411  invariants();
412  }
413 
414  void
416  iterator thePosition,
417  size_type theCount,
418  const value_type& theData)
419  {
420  invariants();
421 
422  const size_type theTotalSize = size() + theCount;
423 
424  // Needs to be optimized
425  if (thePosition == end())
426  {
427  pointer thePointer = ensureCapacity(theTotalSize);
428 
429  for (size_type index = 0; index < theCount; ++index)
430  {
431  Constructor::construct(thePointer, theData, *m_memoryManager);
432 
433  ++thePointer;
434  ++m_size;
435  }
436  }
437  else
438  {
439  if (theTotalSize > capacity())
440  {
441  assert ( m_memoryManager != 0 );
442 
443  ThisType theTemp(*m_memoryManager, theTotalSize);
444 
445  // insert everything up to the position...
446  theTemp.insert(theTemp.end(), begin(), thePosition);
447 
448  // insert the new stuff...
449  theTemp.insert(theTemp.end(), theCount, theData);
450 
451  // insert everything from the position to the end...
452  theTemp.insert(theTemp.end(), thePosition, end());
453 
454  swap(theTemp);
455  }
456  else
457  {
458  // insert into the middle of the vector that has enough capacity
459  const iterator theOriginalEnd = end();
460 
461  const size_type theRightSplitSize =
462  local_distance(thePosition, theOriginalEnd);
463 
464  if (theRightSplitSize <= theCount)
465  {
466  // inserted range will go to or beyond edge of current vector
467 
468  // append all copies that will extend
469  // beyond the current vector
470  for (size_type i = 0; i < (theCount - theRightSplitSize); ++i)
471  {
472  doPushBack(theData);
473  }
474 
475  // copy the "right" of the current vector to the end
476  iterator toInsertIter = thePosition;
477 
478  while (toInsertIter != theOriginalEnd)
479  {
480  doPushBack(*toInsertIter);
481 
482  ++toInsertIter;
483  }
484 
485  // copy the remaining part of inserted range into
486  // the original vector spaces
487  XALAN_STD_QUALIFIER fill(thePosition, thePosition + theRightSplitSize, theData);
488  }
489  else
490  {
491  // inserted range will not extend beyond edge of current vector
492 
493  // move end of current vector by insertion size
494  const_iterator toMoveIter = end() - theCount;
495 
496  while (toMoveIter != theOriginalEnd)
497  {
498  doPushBack(*toMoveIter);
499 
500  ++toMoveIter;
501  }
502 
503  // reverse copy the remaining part of the "right" piece of the current vector
504  XALAN_STD_QUALIFIER copy_backward(thePosition, theOriginalEnd - theCount, theOriginalEnd);
505 
506  // insert into current vector
507  XALAN_STD_QUALIFIER fill(thePosition, thePosition + theCount, theData);
508  }
509  }
510  }
511 
512  invariants();
513  }
514 
515  iterator
517  iterator thePosition,
518  const value_type& theData)
519  {
520  if (m_allocation > m_size)
521  {
522  insert(thePosition, 1, theData);
523 
524  return thePosition;
525  }
526  else
527  {
528  const size_type theDistance =
529  local_distance(begin(), thePosition);
530 
531  insert(thePosition, 1, theData);
532 
533  return begin() + theDistance;
534  }
535  }
536 
537  void
539  const_iterator theFirst,
540  const_iterator theLast)
541  {
542  clear();
543 
544  insert(
545  begin(),
546  theFirst,
547  theLast);
548  }
549 
550  void
552  iterator theFirst,
553  iterator theLast)
554  {
555  assign(
556  const_iterator(theFirst),
557  const_iterator(theLast));
558  }
559 
560  void
562  size_type theCount,
563  const value_type& theData)
564  {
565  clear();
566 
567  insert(theCount, theData);
568  }
569 
570  size_type
571  size() const
572  {
573  invariants();
574 
575  return m_size;
576  }
577 
578  size_type
579  max_size() const
580  {
581  invariants();
582 
583  return ~size_type(0);
584  }
585 
586  void
587  resize(size_type theSize)
588  {
589  const ConstructibleType defaultValue(*m_memoryManager);
590 
591  resize(theSize, defaultValue.value);
592  }
593 
594  void
595  resize( size_type theSize,
596  const value_type& theValue)
597  {
598  invariants();
599 
600  if (m_size > theSize)
601  {
602  shrinkToSize(theSize);
603  }
604  else if (m_size < theSize)
605  {
606  // Reserve memory up-front...
607  reserve(theSize);
608 
609  assert(m_allocation >= theSize);
610 
611  const value_type* const theEnd = m_data + theSize;
612 
613  // Fill the new area...
614  for (value_type* data = endPointer();
615  data != theEnd;
616  ++data, ++m_size)
617  {
618  Constructor::construct(data, theValue, *m_memoryManager);
619  }
620  }
621 
622  assert(m_size == theSize);
623 
624  invariants();
625  }
626 
627  size_type
628  capacity() const
629  {
630  invariants();
631 
632  return m_allocation;
633  }
634 
635  bool
636  empty() const
637  {
638  invariants();
639 
640  return m_size == 0 ? true : false;
641  }
642 
643  void
644  reserve(size_type theSize)
645  {
646  invariants();
647 
648  if (theSize > m_allocation)
649  {
650  doReserve(theSize);
651  }
652 
653  invariants();
654  }
655 
656  reference
658  {
659  invariants();
660 
661  return m_data[0];
662  }
663 
664  const_reference
665  front() const
666  {
667  invariants();
668 
669  return m_data[0];
670  }
671 
672  reference
674  {
675  return m_data[m_size - 1];
676  }
677 
678  const_reference
679  back() const
680  {
681  return m_data[m_size - 1];
682  }
683 
684  iterator
686  {
687  invariants();
688 
689  return m_data;
690  }
691 
692  const_iterator
693  begin() const
694  {
695  invariants();
696 
697  return m_data;
698  }
699 
700  iterator
701  end()
702  {
703  invariants();
704 
705  return endPointer();
706  }
707 
708  const_iterator
709  end() const
710  {
711  invariants();
712 
713  return endPointer();
714  }
715 
716  reverse_iterator
718  {
719  invariants();
720 
721  return reverse_iterator(end());
722  }
723 
724  const_reverse_iterator
725  rbegin() const
726  {
727  invariants();
728 
729  return const_reverse_iterator(end());
730  }
731 
732  reverse_iterator
734  {
735  invariants();
736 
737  return reverse_iterator(begin());
738  }
739 
740  const_reverse_iterator
741  rend() const
742  {
743  invariants();
744 
745  return const_reverse_iterator(begin());
746  }
747 
748 
749  reference
750  at(size_type theIndex)
751  {
752  if (theIndex >= m_size)
753  {
754  outOfRange();
755  }
756 
757  return m_data[theIndex];
758  }
759 
760  const_reference
761  at(size_type theIndex) const
762  {
763  if (theIndex >= m_size)
764  {
765  outOfRange();
766  }
767 
768  return m_data[theIndex];
769  }
770 
771  reference
772  operator[](size_type theIndex)
773  {
774  assert (theIndex < m_size);
775 
776  return m_data[theIndex];
777  }
778 
779  const_reference
780  operator[](size_type theIndex) const
781  {
782  assert (theIndex < m_size);
783 
784  return m_data[theIndex];
785  }
786 
787  void
789  {
790  invariants();
791 
792  if (m_size > 0)
793  {
794  shrinkToSize(0);
795  }
796 
797  invariants();
798  }
799 
800  // Operators...
801  ThisType&
802  operator=(const ThisType& theRHS)
803  {
804  invariants();
805 
806  if (&theRHS != this)
807  {
808  if (m_allocation < theRHS.m_size)
809  {
810  ThisType theTemp(theRHS,*m_memoryManager);
811 
812  swap(theTemp);
813  }
814  else
815  {
816  const_iterator theRHSCopyEnd = theRHS.end();
817 
818  if (m_size > theRHS.m_size)
819  {
820  // Resize to the target size...
821  shrinkToSize(theRHS.m_size);
822  }
823  else if (m_size < theRHS.m_size)
824  {
825  theRHSCopyEnd =
826  theRHS.begin() + m_size;
827 
828  insert(
829  end(),
830  theRHSCopyEnd,
831  theRHS.end());
832  }
833 
834  // Copy everything that already exists...
835  XALAN_STD_QUALIFIER copy(
836  theRHS.begin(),
837  theRHSCopyEnd,
838  begin());
839  }
840  }
841 
842  invariants();
843 
844  return *this;
845  }
846 
847  void
848  swap(ThisType& theOther)
849  {
850  invariants();
851 
852  MemoryManager* const theTempManager = m_memoryManager;
853  const size_type theTempLength = m_size;
854  const size_type theTempAllocation = m_allocation;
855  value_type* const theTempData = m_data;
856 
857  m_memoryManager = theOther.m_memoryManager;
858  m_size = theOther.m_size;
859  m_allocation = theOther.m_allocation;
860  m_data = theOther.m_data;
861 
862  theOther.m_memoryManager = theTempManager;
863  theOther.m_size = theTempLength;
864  theOther.m_allocation = theTempAllocation;
865  theOther.m_data = theTempData;
866 
867  invariants();
868  }
869 
870  const MemoryManager*
872  {
873  return m_memoryManager;
874  }
875 
876  MemoryManager&
878  {
879  assert (m_memoryManager != 0);
880 
881  return *m_memoryManager;
882  }
883 
884  // Detaches the allocated memory from the vector, and returns
885  // the pointer to the caller. The caller then owns the memory
886  // and must destroy any objects and deallocate it using the
887  // the memory manager returned from getMemoryManager()
888  pointer
890  {
891  m_size = 0;
892  m_allocation = 0;
893 
894  value_type* const theTemp = m_data;
895 
896  m_data = 0;
897 
898  return theTemp;
899  }
900 
901 private:
902 
903 #if defined(NDEBUG)
904  void
905  invariants() const
906  {
907  }
908 #else
909  void
910  invariants() const
911  {
912  assert(m_allocation >= m_size);
913  assert(m_data == 0 && m_allocation == 0 || m_data != 0 && m_allocation != 0);
914  }
915 #endif
916 
917  size_type
918  local_distance(
919  const_iterator theFirst,
920  const_iterator theLast)
921  {
922  // Since we're using bare pointers for now, we can
923  // assert this...
924  assert(theFirst <= theLast);
925 
926 #if defined(XALAN_HAS_STD_DISTANCE)
927  return XALAN_STD_QUALIFIER distance(theFirst, theLast);
928 #else
929  size_type theDistance;
930 
931  XALAN_STD_QUALIFIER distance(theFirst, theLast, theDistance);
932 
933  return theDistance;
934 #endif
935  }
936 
937  value_type*
938  allocate(size_type size)
939  {
940  const size_type theBytesNeeded = size * sizeof(value_type);
941 
942  assert (m_memoryManager != 0);
943 
944  void* pointer = m_memoryManager->allocate(theBytesNeeded);
945 
946  assert(pointer != 0);
947 
948  return (value_type*) pointer;
949  }
950 
951  void
952  deallocate(value_type* pointer)
953  {
954  assert(m_memoryManager != 0);
955 
956  m_memoryManager->deallocate(pointer);
957 
958  }
959 
960  static void
961  destroy(value_type& theValue)
962  {
963  theValue.~Type();
964  }
965 
966  static void
967  destroy(
968  iterator theFirst,
969  iterator theLast)
970  {
971  for(; theFirst != theLast; ++theFirst)
972  {
973  destroy(*theFirst);
974  }
975  }
976 
977  void
978  doPushBack(const value_type& data)
979  {
980  invariants();
981 
982  if (m_size < m_allocation)
983  {
984  Constructor::construct(endPointer(), data, *m_memoryManager);
985 
986  ++m_size;
987  }
988  else
989  {
990  assert(m_size == m_allocation);
991 
992  const size_type theNewSize = m_size == 0 ? 1 : size_type((m_size * 1.6) + 0.5);
993  assert(theNewSize > m_size);
994 
995  ThisType theTemp(*this, *m_memoryManager, theNewSize);
996 
997  theTemp.doPushBack(data);
998 
999  swap(theTemp);
1000  }
1001 
1002  invariants();
1003  }
1004 
1005  pointer
1006  ensureCapacity(size_type theSize)
1007  {
1008  if (theSize > capacity())
1009  {
1010  doReserve(theSize);
1011  }
1012 
1013  return endPointer();
1014  }
1015 
1016  void
1017  doReserve(size_type theSize)
1018  {
1019  invariants();
1020 
1021  assert(theSize > m_allocation);
1022 
1023  ThisType theTemp(*this, *m_memoryManager, theSize);
1024 
1025  swap(theTemp);
1026 
1027  invariants();
1028  }
1029 
1030  pointer
1031  endPointer()
1032  {
1033  return m_data + m_size;
1034  }
1035 
1036  const_pointer
1037  endPointer() const
1038  {
1039  return m_data + m_size;
1040  }
1041 
1042  static void
1043  outOfRange()
1044  {
1045  throw XALAN_STD_QUALIFIER out_of_range("");
1046  }
1047 
1048  void
1049  shrinkToSize(size_type theSize)
1050  {
1051  assert(m_size > theSize);
1052 
1053  do
1054  {
1055  pop_back();
1056  } while (m_size > theSize);
1057  }
1058 
1059  void
1060  shrinkCount(size_type theCount)
1061  {
1062  assert(m_size >= theCount);
1063 
1064  while (theCount > 0)
1065  {
1066  pop_back();
1067 
1068  --theCount;
1069  }
1070  }
1071 
1072  size_type
1073  local_max(
1074  size_type theLHS,
1075  size_type theRHS)
1076  {
1077  return theLHS > theRHS ? theLHS : theRHS;
1078  }
1079 
1080 #if defined(XALAN_DEVELOPMENT)
1081  //not implemented
1082  XalanVector(const XalanVector&);
1083  XalanVector();
1084 #endif
1085 
1086  // Data members...
1087  MemoryManager* m_memoryManager;
1088 
1089  size_type m_size;
1090 
1091  size_type m_allocation;
1092 
1093  value_type* m_data;
1094 };
1095 
1096 
1097 
1098 template <class Type>
1099 inline void
1101  XalanVector<Type>& theLHS,
1102  XalanVector<Type>& theRHS)
1103 {
1104  theLHS.swap(theRHS);
1105 }
1106 
1107 
1108 
1109 template <class Type>
1110 inline bool
1112  const XalanVector<Type>& theLHS,
1113  const XalanVector<Type>& theRHS)
1114 {
1115  if (theLHS.size() != theRHS.size())
1116  {
1117  return false;
1118  }
1119  else if (theLHS.size() == 0)
1120  {
1121  return true;
1122  }
1123  else
1124  {
1125  return XALAN_STD_QUALIFIER equal(theLHS.begin(), theLHS.end(), theRHS.begin());
1126  }
1127 }
1128 
1129 
1130 
1131 template <class Type>
1132 inline bool
1134  const XalanVector<Type>& theLHS,
1135  const XalanVector<Type>& theRHS)
1136 {
1137  return !(theLHS == theRHS);
1138 }
1139 
1140 
1141 
1142 template <class Type>
1143 inline bool
1145  const XalanVector<Type>& theLHS,
1146  const XalanVector<Type>& theRHS)
1147 {
1148  return XALAN_STD_QUALIFIER lexicographical_compare(
1149  theLHS.begin(),
1150  theLHS.end(),
1151  theRHS.begin(),
1152  theRHS.end());
1153 }
1154 
1155 
1156 
1157 template <class Type>
1158 inline bool
1160  const XalanVector<Type>& theLHS,
1161  const XalanVector<Type>& theRHS)
1162 {
1163  return !(theRHS < theLHS);
1164 }
1165 
1166 
1167 
1168 template <class Type>
1169 inline bool
1171  const XalanVector<Type>& theLHS,
1172  const XalanVector<Type>& theRHS)
1173 {
1174  return theRHS < theLHS;
1175 }
1176 
1177 
1178 
1179 template <class Type>
1180 inline bool
1182  const XalanVector<Type>& theLHS,
1183  const XalanVector<Type>& theRHS)
1184 {
1185  return !(theLHS < theRHS);
1186 }
1187 
1188 
1189 
1190 #if defined(_MSC_VER)
1191 #pragma warning(pop)
1192 #endif
1193 
1194 
1195 
1196 XALAN_CPP_NAMESPACE_END
1197 
1198 
1199 
1200 #endif // XALANVECTOR_HEADER_GUARD_1357924680

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo