1 /* 2 * Copyright 2002-2007 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT license. 4 */ 5 #ifndef SUPPORT_H 6 #define SUPPORT_H 7 8 9 #include <DiskDeviceDefs.h> 10 #include <HashMap.h> 11 #include <HashString.h> 12 #include <Slider.h> 13 #include <String.h> 14 15 16 class BPartition; 17 18 19 const char* string_for_size(off_t size, char *string); 20 21 void dump_partition_info(const BPartition* partition); 22 23 bool is_valid_partitionable_space(size_t size); 24 25 enum { 26 GO_CANCELED = 0, 27 GO_SUCCESS 28 }; 29 30 31 static const uint32 kMegaByte = 0x100000; 32 33 class SpaceIDMap : public HashMap<HashString, partition_id> { 34 public: 35 SpaceIDMap(); 36 virtual ~SpaceIDMap(); 37 38 partition_id SpaceIDFor(partition_id parentID, 39 off_t spaceOffset); 40 41 private: 42 partition_id fNextSpaceID; 43 }; 44 45 class SizeSlider : public BSlider { 46 public: 47 SizeSlider(const char* name, const char* label, 48 BMessage* message, int32 minValue, 49 int32 maxValue); 50 virtual ~SizeSlider(); 51 52 virtual const char* UpdateText() const; 53 int32 Size(); 54 int32 Offset(); 55 56 private: 57 off_t fStartOffset; 58 off_t fEndOffset; 59 mutable BString fStatusLabel; 60 }; 61 62 #endif // SUPPORT_H 63