You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.1 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Turbo Vision - Version 2.0
  3. *
  4. * Copyright (c) 1994 by Borland International
  5. * All Rights Reserved.
  6. *
  7. Modified by Robert H�hne to be used for RHIDE.
  8. *
  9. *
  10. */
  11. #if defined( Uses_TDirCollection ) && !defined( __TDirCollection )
  12. #define __TDirCollection
  13. // Avoid replacing free by MSS's macro
  14. #include <tv/no_mss.h>
  15. class TDirEntry;
  16. class TDirCollection : public TCollection
  17. {
  18. public:
  19. TDirCollection( ccIndex aLimit, ccIndex aDelta) :
  20. TCollection( aLimit, aDelta ) {}
  21. TDirEntry *at( ccIndex index )
  22. { return (TDirEntry *)TCollection::at( index );}
  23. void remove( TDirEntry *item )
  24. { TCollection::remove( item ); }
  25. void free( TDirEntry *item )
  26. { TCollection::free( item ); }
  27. void atPut( ccIndex index, TDirEntry *item )
  28. { TCollection::atPut( index, item ); }
  29. TDirEntry *firstThat( ccTestFunc Test, void *arg );
  30. TDirEntry *lastThat( ccTestFunc Test, void *arg );
  31. private:
  32. virtual void freeItem( void *item )
  33. { delete (TDirEntry *)item; }
  34. #if !defined( NO_STREAM )
  35. virtual const char *streamableName() const
  36. { return name; }
  37. virtual void *readItem( ipstream& );
  38. virtual void writeItem( void *, opstream& );
  39. protected:
  40. TDirCollection( StreamableInit ) : TCollection ( streamableInit ) {}
  41. public:
  42. static const char * const name;
  43. static TStreamable *build();
  44. #endif
  45. };
  46. #include <tv/yes_mss.h>
  47. #if !defined( NO_STREAM )
  48. inline ipstream& operator >> ( ipstream& is, TDirCollection& cl )
  49. { return is >> (TStreamable&)cl; }
  50. inline ipstream& operator >> ( ipstream& is, TDirCollection*& cl )
  51. { return is >> (void *&)cl; }
  52. inline opstream& operator << ( opstream& os, TDirCollection& cl )
  53. { return os << (TStreamable&)cl; }
  54. inline opstream& operator << ( opstream& os, TDirCollection* cl )
  55. { return os << (TStreamable *)cl; }
  56. #endif
  57. inline TDirEntry *TDirCollection::firstThat( ccTestFunc func, void *arg )
  58. {
  59. return (TDirEntry *)TCollection::firstThat( ccTestFunc(func), arg );
  60. }
  61. inline TDirEntry *TDirCollection::lastThat( ccTestFunc func, void *arg )
  62. {
  63. return (TDirEntry *)TCollection::lastThat( ccTestFunc(func), arg );
  64. }
  65. #endif // Uses_TDirCollection