* Style cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28209 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexandre Deckner 2008-10-17 08:57:24 +00:00
parent f7de7fa4e3
commit e85ca56c7d
2 changed files with 75 additions and 36 deletions

View File

@ -167,7 +167,7 @@ BColumn::InstantiateFromStream(BMallocIO *stream, bool endianSwap)
int32 version;
uint32 key;
if (stream->Read(&key, sizeof(uint32)) <= 0
|| stream->Read(&version, sizeof(int32)) <=0)
|| stream->Read(&version, sizeof(int32)) <=0)
return 0;
if (endianSwap) {
@ -193,7 +193,7 @@ BColumn::InstantiateFromMessage(const BMessage &message, int32 index)
if (message.FindInt32(kColumnVersionName, index, &messageVersion) != B_OK)
return NULL;
if (version != messageVersion)
if (version != messageVersion)
return NULL;
return _Sanitize(new (std::nothrow) BColumn(message, index));
@ -287,7 +287,7 @@ BViewState::BViewState()
fSecondarySortAttr = 0;
fSecondarySortType = 0;
fReverseSort = false;
_StorePreviousState();
}
@ -310,8 +310,10 @@ BViewState::BViewState(BMallocIO *stream, bool endianSwap)
fViewMode = B_SWAP_INT32(fViewMode);
fLastIconMode = B_SWAP_INT32(fLastIconMode);
fIconSize = B_SWAP_INT32(fIconSize);
swap_data(B_POINT_TYPE, &fListOrigin, sizeof(fListOrigin), B_SWAP_ALWAYS);
swap_data(B_POINT_TYPE, &fIconOrigin, sizeof(fIconOrigin), B_SWAP_ALWAYS);
swap_data(B_POINT_TYPE, &fListOrigin,
sizeof(fListOrigin), B_SWAP_ALWAYS);
swap_data(B_POINT_TYPE, &fIconOrigin,
sizeof(fIconOrigin), B_SWAP_ALWAYS);
fPrimarySortAttr = B_SWAP_INT32(fPrimarySortAttr);
fSecondarySortAttr = B_SWAP_INT32(fSecondarySortAttr);
fPrimarySortType = B_SWAP_INT32(fPrimarySortType);
@ -329,10 +331,14 @@ BViewState::BViewState(const BMessage &message)
message.FindInt32(kViewStateLastIconModeName, (int32 *)&fLastIconMode);
message.FindPoint(kViewStateListOriginName, &fListOrigin);
message.FindPoint(kViewStateIconOriginName, &fIconOrigin);
message.FindInt32(kViewStatePrimarySortAttrName, (int32 *)&fPrimarySortAttr);
message.FindInt32(kViewStatePrimarySortTypeName, (int32 *)&fPrimarySortType);
message.FindInt32(kViewStateSecondarySortAttrName, (int32 *)&fSecondarySortAttr);
message.FindInt32(kViewStateSecondarySortTypeName, (int32 *)&fSecondarySortType);
message.FindInt32(kViewStatePrimarySortAttrName,
(int32 *)&fPrimarySortAttr);
message.FindInt32(kViewStatePrimarySortTypeName,
(int32 *)&fPrimarySortType);
message.FindInt32(kViewStateSecondarySortAttrName,
(int32 *)&fSecondarySortAttr);
message.FindInt32(kViewStateSecondarySortTypeName,
(int32 *)&fSecondarySortType);
message.FindBool(kViewStateReverseSortName, &fReverseSort);
_StorePreviousState();
@ -366,15 +372,20 @@ void
BViewState::ArchiveToMessage(BMessage &message) const
{
message.AddInt32(kViewStateVersionName, kViewStateArchiveVersion);
message.AddInt32(kViewStateViewModeName, static_cast<int32>(fViewMode));
message.AddInt32(kViewStateLastIconModeName, static_cast<int32>(fLastIconMode));
message.AddInt32(kViewStateLastIconModeName,
static_cast<int32>(fLastIconMode));
message.AddPoint(kViewStateListOriginName, fListOrigin);
message.AddPoint(kViewStateIconOriginName, fIconOrigin);
message.AddInt32(kViewStatePrimarySortAttrName, static_cast<int32>(fPrimarySortAttr));
message.AddInt32(kViewStatePrimarySortTypeName, static_cast<int32>(fPrimarySortType));
message.AddInt32(kViewStateSecondarySortAttrName, static_cast<int32>(fSecondarySortAttr));
message.AddInt32(kViewStateSecondarySortTypeName, static_cast<int32>(fSecondarySortType));
message.AddInt32(kViewStatePrimarySortAttrName,
static_cast<int32>(fPrimarySortAttr));
message.AddInt32(kViewStatePrimarySortTypeName,
static_cast<int32>(fPrimarySortType));
message.AddInt32(kViewStateSecondarySortAttrName,
static_cast<int32>(fSecondarySortAttr));
message.AddInt32(kViewStateSecondarySortTypeName,
static_cast<int32>(fSecondarySortType));
message.AddBool(kViewStateReverseSortName, fReverseSort);
message.AddInt32(kViewStateIconSizeName, static_cast<int32>(fIconSize));
}
@ -392,7 +403,7 @@ BViewState::InstantiateFromStream(BMallocIO *stream, bool endianSwap)
version = SwapInt32(version);
}
if (!ValidateStream(stream, key, version))
if (!ValidateStream(stream, key, version))
return NULL;
return _Sanitize(new (std::nothrow) BViewState(stream, endianSwap));
@ -408,7 +419,7 @@ BViewState::InstantiateFromMessage(const BMessage &message)
if (message.FindInt32(kViewStateVersionName, &messageVersion) != B_OK)
return NULL;
if (version != messageVersion)
if (version != messageVersion)
return NULL;
return _Sanitize(new (std::nothrow) BViewState(message));

View File

@ -64,18 +64,18 @@ class BColumn {
void ArchiveToMessage(BMessage &) const;
const char* Title() const;
float Offset() const;
float Width() const;
alignment Alignment() const;
float Offset() const;
float Width() const;
alignment Alignment() const;
const char* AttrName() const;
uint32 AttrType() const;
uint32 AttrType() const;
const char* DisplayAs() const;
uint32 AttrHash() const;
bool StatField() const;
bool Editable() const;
uint32 AttrHash() const;
bool StatField() const;
bool Editable() const;
void SetOffset(float);
void SetWidth(float);
void SetOffset(float);
void SetWidth(float);
private:
void _Init(const char *title, float offset, float width,
@ -83,16 +83,16 @@ class BColumn {
const char* displayAs, bool statField, bool editable);
static BColumn* _Sanitize(BColumn* column);
BString fTitle;
float fOffset;
float fWidth;
alignment fAlignment;
BString fAttrName;
BString fDisplayAs;
uint32 fAttrHash;
uint32 fAttrType;
bool fStatField;
bool fEditable;
BString fTitle;
float fOffset;
float fWidth;
alignment fAlignment;
BString fAttrName;
BString fDisplayAs;
uint32 fAttrHash;
uint32 fAttrType;
bool fStatField;
bool fEditable;
};
@ -169,114 +169,133 @@ BColumn::Title() const
return fTitle.String();
}
inline float
BColumn::Offset() const
{
return fOffset;
}
inline float
BColumn::Width() const
{
return fWidth;
}
inline alignment
BColumn::Alignment() const
{
return fAlignment;
}
inline const char *
BColumn::AttrName() const
{
return fAttrName.String();
}
inline uint32
BColumn::AttrHash() const
{
return fAttrHash;
}
inline uint32
BColumn::AttrType() const
{
return fAttrType;
}
inline const char *
BColumn::DisplayAs() const
{
return fDisplayAs.String();
}
inline bool
BColumn::StatField() const
{
return fStatField;
}
inline bool
BColumn::Editable() const
{
return fEditable;
}
inline void
BColumn::SetWidth(float w)
{
fWidth = w;
}
inline void
BColumn::SetOffset(float o)
{
fOffset = o;
}
inline uint32
BViewState::ViewMode() const
{
return fViewMode;
}
inline uint32
BViewState::LastIconMode() const
{
return fLastIconMode;
}
inline uint32
BViewState::IconSize() const
{
return fIconSize;
}
inline BPoint
BViewState::ListOrigin() const
{
return fListOrigin;
}
inline BPoint
BViewState::IconOrigin() const
{
return fIconOrigin;
}
inline uint32
BViewState::PrimarySort() const
{
return fPrimarySortAttr;
}
inline uint32
BViewState::SecondarySort() const
{
return fSecondarySortAttr;
}
inline uint32
BViewState::PrimarySortType() const
{
@ -295,24 +314,28 @@ BViewState::ReverseSort() const
return fReverseSort;
}
inline void
BViewState::SetViewMode(uint32 mode)
{
fViewMode = mode;
}
inline void
BViewState::SetLastIconMode(uint32 mode)
{
fLastIconMode = mode;
}
inline void
BViewState::SetIconSize(uint32 size)
{
fIconSize = size;
}
inline void
BViewState::SetListOrigin(BPoint newOrigin)
{
@ -331,30 +354,35 @@ BViewState::SetPrimarySort(uint32 attr)
fPrimarySortAttr = attr;
}
inline void
BViewState::SetSecondarySort(uint32 attr)
{
fSecondarySortAttr = attr;
}
inline void
BViewState::SetPrimarySortType(uint32 type)
{
fPrimarySortType = type;
}
inline void
BViewState::SetSecondarySortType(uint32 type)
{
fSecondarySortType = type;
}
inline void
BViewState::SetReverseSort(bool on)
{
fReverseSort = on;
}
inline bool
BViewState::StateNeedsSaving()
{