2007-10-11 01:35:22 +04:00
|
|
|
/*
|
2007-10-31 20:02:52 +03:00
|
|
|
* Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de.
|
2007-10-11 01:35:22 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _MUTABLE_PARTITION_H
|
|
|
|
#define _MUTABLE_PARTITION_H
|
|
|
|
|
|
|
|
#include <List.h>
|
|
|
|
#include <Partition.h>
|
|
|
|
|
|
|
|
|
|
|
|
struct user_partition_data;
|
|
|
|
|
|
|
|
|
|
|
|
class BMutablePartition {
|
|
|
|
public:
|
2007-10-31 20:02:52 +03:00
|
|
|
void UninitializeContents();
|
|
|
|
|
2007-10-11 01:35:22 +04:00
|
|
|
off_t Offset() const;
|
|
|
|
void SetOffset(off_t offset);
|
|
|
|
|
|
|
|
off_t Size() const;
|
|
|
|
void SetSize(off_t size);
|
|
|
|
|
|
|
|
off_t ContentSize() const;
|
|
|
|
void SetContentSize(off_t size);
|
|
|
|
|
|
|
|
off_t BlockSize() const;
|
|
|
|
void SetBlockSize(off_t blockSize);
|
|
|
|
|
|
|
|
uint32 Status() const;
|
2007-10-31 20:02:52 +03:00
|
|
|
void SetStatus(uint32 status);
|
2007-10-11 01:35:22 +04:00
|
|
|
|
|
|
|
uint32 Flags() const;
|
|
|
|
void SetFlags(uint32 flags);
|
2007-10-31 20:02:52 +03:00
|
|
|
void ClearFlags(uint32 flags);
|
2007-10-11 01:35:22 +04:00
|
|
|
|
2007-10-31 20:02:52 +03:00
|
|
|
dev_t VolumeID() const;
|
|
|
|
void SetVolumeID(dev_t volumeID);
|
2007-10-11 01:35:22 +04:00
|
|
|
|
|
|
|
int32 Index() const;
|
|
|
|
|
|
|
|
const char* Name() const;
|
|
|
|
status_t SetName(const char* name);
|
|
|
|
|
|
|
|
const char* ContentName() const;
|
|
|
|
status_t SetContentName(const char* name);
|
|
|
|
|
|
|
|
const char* Type() const;
|
2007-10-31 20:02:52 +03:00
|
|
|
status_t SetType(const char* type);
|
2007-10-11 01:35:22 +04:00
|
|
|
|
|
|
|
const char* ContentType() const;
|
2007-10-31 20:02:52 +03:00
|
|
|
status_t SetContentType(const char* type);
|
2007-10-11 01:35:22 +04:00
|
|
|
|
|
|
|
const char* Parameters() const;
|
|
|
|
status_t SetParameters(const char* parameters);
|
|
|
|
|
|
|
|
const char* ContentParameters() const;
|
|
|
|
status_t SetContentParameters(const char* parameters);
|
|
|
|
|
|
|
|
status_t CreateChild(int32 index,
|
|
|
|
BMutablePartition** child);
|
2007-10-14 01:29:33 +04:00
|
|
|
status_t CreateChild(int32 index, const char* type,
|
|
|
|
const char* name, const char* parameters,
|
|
|
|
BMutablePartition** child);
|
2007-10-11 01:35:22 +04:00
|
|
|
status_t DeleteChild(int32 index);
|
2007-10-14 01:29:33 +04:00
|
|
|
status_t DeleteChild(BMutablePartition* child);
|
2007-10-31 20:02:52 +03:00
|
|
|
void DeleteAllChildren();
|
2007-10-11 01:35:22 +04:00
|
|
|
|
2007-10-14 01:29:33 +04:00
|
|
|
BMutablePartition* Parent() const;
|
2007-10-11 01:35:22 +04:00
|
|
|
BMutablePartition* ChildAt(int32 index) const;
|
|
|
|
int32 CountChildren() const;
|
2007-10-14 01:29:33 +04:00
|
|
|
int32 IndexOfChild(BMutablePartition* child) const;
|
2007-10-11 01:35:22 +04:00
|
|
|
|
2007-10-18 07:39:50 +04:00
|
|
|
void SetChangeFlags(uint32 flags);
|
|
|
|
uint32 ChangeFlags() const;
|
2007-10-31 20:02:52 +03:00
|
|
|
void Changed(uint32 flags, uint32 clearFlags = 0);
|
2007-10-18 07:39:50 +04:00
|
|
|
|
2007-10-11 01:35:22 +04:00
|
|
|
// for the partitioning system managing the parent
|
|
|
|
void* ChildCookie() const;
|
|
|
|
void SetChildCookie(void* cookie);
|
|
|
|
|
|
|
|
private:
|
|
|
|
BMutablePartition(
|
2007-10-14 04:07:03 +04:00
|
|
|
BPartition::Delegate* delegate);
|
2007-10-11 01:35:22 +04:00
|
|
|
~BMutablePartition();
|
|
|
|
|
2007-10-14 01:29:33 +04:00
|
|
|
status_t Init(const user_partition_data* partitionData,
|
|
|
|
BMutablePartition* parent);
|
2007-10-11 01:35:22 +04:00
|
|
|
|
|
|
|
const user_partition_data* PartitionData() const;
|
|
|
|
|
|
|
|
private:
|
2007-10-14 04:07:03 +04:00
|
|
|
friend class BPartition::Delegate;
|
2007-10-11 01:35:22 +04:00
|
|
|
|
2007-10-14 04:07:03 +04:00
|
|
|
BPartition::Delegate* GetDelegate() const;
|
2007-10-11 01:35:22 +04:00
|
|
|
|
2007-10-14 04:07:03 +04:00
|
|
|
BPartition::Delegate* fDelegate;
|
2007-10-11 01:35:22 +04:00
|
|
|
user_partition_data* fData;
|
2007-10-14 01:29:33 +04:00
|
|
|
BMutablePartition* fParent;
|
2007-10-11 01:35:22 +04:00
|
|
|
BList fChildren;
|
2007-10-18 07:39:50 +04:00
|
|
|
uint32 fChangeFlags;
|
2007-10-11 01:35:22 +04:00
|
|
|
void* fChildCookie;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _MUTABLE_PARTITION_H
|