NamedObjs.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //---------------------------------------------------------------------------
  2. #ifndef NamedObjsH
  3. #define NamedObjsH
  4. #include <system.hpp>
  5. #include <contnrs.hpp>
  6. //---------------------------------------------------------------------------
  7. class TNamedObjectList;
  8. class TNamedObject : public TPersistent
  9. {
  10. public:
  11. __property UnicodeString Name = { read = FName, write = SetName };
  12. __property bool Hidden = { read = FHidden };
  13. __fastcall TNamedObject() {};
  14. bool __fastcall IsSameName(const UnicodeString & Name);
  15. virtual int __fastcall Compare(TNamedObject * Other);
  16. __fastcall TNamedObject(UnicodeString aName);
  17. void __fastcall MakeUniqueIn(TNamedObjectList * List);
  18. private:
  19. UnicodeString FName;
  20. bool FHidden;
  21. void __fastcall SetName(UnicodeString value);
  22. };
  23. //---------------------------------------------------------------------------
  24. class TNamedObjectList : public TObjectList
  25. {
  26. private:
  27. int __fastcall GetCount();
  28. int __fastcall GetCountIncludingHidden();
  29. virtual void __fastcall Notify(void *Ptr, TListNotification Action);
  30. void __fastcall SetCount(int value);
  31. protected:
  32. int FHiddenCount;
  33. bool FControlledAdd;
  34. void __fastcall Recount();
  35. public:
  36. static const UnicodeString HiddenPrefix;
  37. bool AutoSort;
  38. __fastcall TNamedObjectList();
  39. void __fastcall AlphaSort();
  40. int __fastcall Add(TObject * AObject);
  41. virtual TNamedObject * __fastcall AtObject(Integer Index);
  42. TNamedObject * __fastcall FindByName(const UnicodeString & Name);
  43. __property int Count = { read = GetCount, write = SetCount };
  44. __property int CountIncludingHidden = { read = GetCountIncludingHidden };
  45. };
  46. //---------------------------------------------------------------------------
  47. int __fastcall NamedObjectSortProc(void * Item1, void * Item2);
  48. //---------------------------------------------------------------------------
  49. #endif