haiku/headers/private/storage/MutablePartition.h
Ingo Weinhold 08baf63a9f Decided that BPartition::ImmutableDelegate would basically be a big
collection of no-op methods, which could as well be implemented in
BPartition itself. This makes the Delegate hierarchy unnecessary:
MutableDelegate becomes Delegate, and we save a few casts as a side
effect.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22547 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-14 00:07:03 +00:00

97 lines
2.3 KiB
C++

/*
* Copyright 2007, Ingo Weinhold, bonefish@users.sf.net.
* 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:
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;
uint32 Flags() const;
void SetFlags(uint32 flags);
dev_t Volume() const;
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;
status_t SetType(const char* type) const;
const char* ContentType() const;
status_t SetContentType(const char* type) const;
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);
status_t CreateChild(int32 index, const char* type,
const char* name, const char* parameters,
BMutablePartition** child);
status_t DeleteChild(int32 index);
status_t DeleteChild(BMutablePartition* child);
BMutablePartition* Parent() const;
BMutablePartition* ChildAt(int32 index) const;
int32 CountChildren() const;
int32 IndexOfChild(BMutablePartition* child) const;
// for the partitioning system managing the parent
void* ChildCookie() const;
void SetChildCookie(void* cookie);
private:
BMutablePartition(
BPartition::Delegate* delegate);
~BMutablePartition();
status_t Init(const user_partition_data* partitionData,
BMutablePartition* parent);
const user_partition_data* PartitionData() const;
private:
friend class BPartition::Delegate;
BPartition::Delegate* GetDelegate() const;
BPartition::Delegate* fDelegate;
user_partition_data* fData;
BMutablePartition* fParent;
BList fChildren;
void* fChildCookie;
};
#endif // _MUTABLE_PARTITION_H