home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Found / FWCollec / FWOrdCol.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.4 KB  |  103 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWOrdCol.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWFound.hpp"
  11.  
  12. #ifndef FWORDCOL_H
  13. #include "FWOrdCol.h"
  14. #endif
  15.  
  16. #ifndef FWODEXCE_H
  17. #include "FWODExce.h"
  18. #endif
  19.  
  20. //======================================================================================
  21. // Runtime Informations
  22. //======================================================================================
  23.  
  24. #ifdef FW_BUILD_MAC
  25. #pragma segment fwcollec
  26. #endif
  27.  
  28. //======================================================================================
  29. // Default Matching Proc
  30. //======================================================================================
  31.  
  32. static FW_Boolean FW_PrivOrderedCollection_DefaultMatchProc(const void* v1, const void* v2)
  33. {
  34.     return (v1 == v2);
  35. }
  36.  
  37. //======================================================================================
  38. // Class FW_CPrivOrderedCollection
  39. //======================================================================================
  40.  
  41. FW_DEFINE_AUTO(FW_CPrivOrderedCollection)
  42.  
  43. //--------------------------------------------------------------------------------------
  44. // FW_CPrivOrderedCollection::FW_CPrivOrderedCollection
  45. //--------------------------------------------------------------------------------------
  46.  
  47. FW_CPrivOrderedCollection::FW_CPrivOrderedCollection(FW_OrderedCollection_MatchProc matchProc) :
  48.     fImplementation(NULL),
  49.     fMatchProc(matchProc ? matchProc : &FW_PrivOrderedCollection_DefaultMatchProc)
  50. {
  51.     FW_PlatformError error;
  52.     fImplementation = FW_PrivNewLinkedList(&error);
  53.     FW_FailOnError(error);
  54.     
  55.     FW_END_CONSTRUCTOR
  56. }
  57.  
  58. //--------------------------------------------------------------------------------------
  59. // FW_CPrivOrderedCollection::~FW_CPrivOrderedCollection
  60. //--------------------------------------------------------------------------------------
  61.  
  62. FW_CPrivOrderedCollection::~FW_CPrivOrderedCollection()
  63. {
  64.     FW_START_DESTRUCTOR
  65.     FW_PrivDeleteLinkedList(fImplementation);
  66. }
  67.  
  68. //======================================================================================
  69. // FW_CPrivOrderedCollectionIterator
  70. //======================================================================================
  71.  
  72. FW_DEFINE_AUTO(FW_CPrivOrderedCollectionIterator)
  73.  
  74. //--------------------------------------------------------------------------------------
  75. // FW_CPrivOrderedCollectionIterator::FW_CPrivOrderedCollectionIterator
  76. //--------------------------------------------------------------------------------------
  77.  
  78. FW_CPrivOrderedCollectionIterator::FW_CPrivOrderedCollectionIterator(const FW_CPrivOrderedCollection* collection)    
  79.     : fImplementation(NULL)
  80. {
  81.     FW_PlatformError error;
  82.     fImplementation = FW_PrivNewLinkedListIterator(collection ? collection->fImplementation : NULL, &error);
  83.     FW_FailOnError(error);
  84.     
  85.     FW_END_CONSTRUCTOR
  86. }
  87.  
  88. //--------------------------------------------------------------------------------------
  89. // FW_CPrivOrderedCollectionIterator::~FW_CPrivOrderedCollectionIterator
  90. //--------------------------------------------------------------------------------------
  91.  
  92. FW_CPrivOrderedCollectionIterator::~FW_CPrivOrderedCollectionIterator()                        
  93. {
  94.     FW_START_DESTRUCTOR
  95.     FW_PrivDeleteLinkedListIterator(fImplementation);
  96. }
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.