Tracker: style fixes to AttributeStream

This commit is contained in:
John Scipione 2014-06-20 17:22:51 -04:00
parent 9e168cf49d
commit 7ec2c512ff
2 changed files with 167 additions and 90 deletions

View File

@ -44,23 +44,30 @@ All rights reserved.
// BMessage node // BMessage node
// partial feeding (part, not the whole buffer) // partial feeding (part, not the whole buffer)
// #pragma mark - AttributeInfo
AttributeInfo::AttributeInfo(const AttributeInfo &cloneThis) AttributeInfo::AttributeInfo(const AttributeInfo &cloneThis)
: fName(cloneThis.fName), :
fInfo(cloneThis.fInfo) fName(cloneThis.fName),
fInfo(cloneThis.fInfo)
{ {
} }
AttributeInfo::AttributeInfo(const char* name, attr_info info) AttributeInfo::AttributeInfo(const char* name, attr_info info)
: fName(name), :
fInfo(info) fName(name),
fInfo(info)
{ {
} }
AttributeInfo::AttributeInfo(const char* name, uint32 type, off_t size) AttributeInfo::AttributeInfo(const char* name, uint32 type, off_t size)
: fName(name) :
fName(name)
{ {
fInfo.size = size; fInfo.size = size;
fInfo.type = type; fInfo.type = type;
@ -73,12 +80,14 @@ AttributeInfo::Name() const
return fName.String(); return fName.String();
} }
uint32 uint32
AttributeInfo::Type() const AttributeInfo::Type() const
{ {
return fInfo.type; return fInfo.type;
} }
off_t off_t
AttributeInfo::Size() const AttributeInfo::Size() const
{ {
@ -93,6 +102,7 @@ AttributeInfo::SetTo(const AttributeInfo &attr)
fInfo = attr.fInfo; fInfo = attr.fInfo;
} }
void void
AttributeInfo::SetTo(const char* name, attr_info info) AttributeInfo::SetTo(const char* name, attr_info info)
{ {
@ -100,6 +110,7 @@ AttributeInfo::SetTo(const char* name, attr_info info)
fInfo = info; fInfo = info;
} }
void void
AttributeInfo::SetTo(const char* name, uint32 type, off_t size) AttributeInfo::SetTo(const char* name, uint32 type, off_t size)
{ {
@ -109,9 +120,13 @@ AttributeInfo::SetTo(const char* name, uint32 type, off_t size)
} }
// #pragma mark - AttributeStreamNode
AttributeStreamNode::AttributeStreamNode() AttributeStreamNode::AttributeStreamNode()
: fReadFrom(NULL), :
fWriteTo(NULL) fReadFrom(NULL),
fWriteTo(NULL)
{ {
} }
@ -121,6 +136,7 @@ AttributeStreamNode::~AttributeStreamNode()
Detach(); Detach();
} }
AttributeStreamNode& AttributeStreamNode&
AttributeStreamNode::operator<<(AttributeStreamNode &source) AttributeStreamNode::operator<<(AttributeStreamNode &source)
{ {
@ -132,23 +148,26 @@ AttributeStreamNode::operator<<(AttributeStreamNode &source)
return source; return source;
} }
void void
AttributeStreamNode::Rewind() AttributeStreamNode::Rewind()
{ {
if (fReadFrom) if (fReadFrom != NULL)
fReadFrom->Rewind(); fReadFrom->Rewind();
} }
void void
AttributeStreamFileNode::MakeEmpty() AttributeStreamFileNode::MakeEmpty()
{ {
TRESPASS(); TRESPASS();
} }
off_t off_t
AttributeStreamNode::Contains(const char* name, uint32 type) AttributeStreamNode::Contains(const char* name, uint32 type)
{ {
if (!fReadFrom) if (fReadFrom == NULL)
return 0; return 0;
return fReadFrom->Contains(name, type); return fReadFrom->Contains(name, type);
@ -159,7 +178,7 @@ off_t
AttributeStreamNode::Read(const char* name, const char* foreignName, AttributeStreamNode::Read(const char* name, const char* foreignName,
uint32 type, off_t size, void* buffer, void (*swapFunc)(void*)) uint32 type, off_t size, void* buffer, void (*swapFunc)(void*))
{ {
if (!fReadFrom) if (fReadFrom == NULL)
return 0; return 0;
return fReadFrom->Read(name, foreignName, type, size, buffer, swapFunc); return fReadFrom->Read(name, foreignName, type, size, buffer, swapFunc);
@ -170,7 +189,7 @@ off_t
AttributeStreamNode::Write(const char* name, const char* foreignName, AttributeStreamNode::Write(const char* name, const char* foreignName,
uint32 type, off_t size, const void* buffer) uint32 type, off_t size, const void* buffer)
{ {
if (!fWriteTo) if (fWriteTo == NULL)
return 0; return 0;
return fWriteTo->Write(name, foreignName, type, size, buffer); return fWriteTo->Write(name, foreignName, type, size, buffer);
@ -181,7 +200,7 @@ bool
AttributeStreamNode::Drive() AttributeStreamNode::Drive()
{ {
ASSERT(CanFeed()); ASSERT(CanFeed());
if (!fReadFrom) if (fReadFrom == NULL)
return false; return false;
Rewind(); Rewind();
@ -192,7 +211,7 @@ AttributeStreamNode::Drive()
const AttributeInfo* const AttributeInfo*
AttributeStreamNode::Next() AttributeStreamNode::Next()
{ {
if (fReadFrom) if (fReadFrom != NULL)
return fReadFrom->Next(); return fReadFrom->Next();
return NULL; return NULL;
@ -202,9 +221,7 @@ AttributeStreamNode::Next()
const char* const char*
AttributeStreamNode::Get() AttributeStreamNode::Get()
{ {
ASSERT(fReadFrom); ASSERT(fReadFrom != NULL);
if (!fReadFrom)
return NULL;
return fReadFrom->Get(); return fReadFrom->Get();
} }
@ -213,7 +230,8 @@ AttributeStreamNode::Get()
bool bool
AttributeStreamNode::Fill(char* buffer) const AttributeStreamNode::Fill(char* buffer) const
{ {
ASSERT(fReadFrom); ASSERT(fReadFrom != NULL);
return fReadFrom->Fill(buffer); return fReadFrom->Fill(buffer);
} }
@ -221,9 +239,10 @@ AttributeStreamNode::Fill(char* buffer) const
bool bool
AttributeStreamNode::Start() AttributeStreamNode::Start()
{ {
if (!fWriteTo) if (fWriteTo == NULL) {
// we are at the head of the stream, start drivin' // we are at the head of the stream, start drivin'
return Drive(); return Drive();
}
return fWriteTo->Start(); return fWriteTo->Start();
} }
@ -237,21 +256,27 @@ AttributeStreamNode::Detach()
fReadFrom = NULL; fReadFrom = NULL;
fWriteTo = NULL; fWriteTo = NULL;
if (tmpFrom) if (tmpFrom != NULL)
tmpFrom->Detach(); tmpFrom->Detach();
if (tmpTo)
if (tmpTo != NULL)
tmpTo->Detach(); tmpTo->Detach();
} }
// #pragma mark - AttributeStreamFileNode
AttributeStreamFileNode::AttributeStreamFileNode() AttributeStreamFileNode::AttributeStreamFileNode()
: fNode(NULL) :
fNode(NULL)
{ {
} }
AttributeStreamFileNode::AttributeStreamFileNode(BNode* node) AttributeStreamFileNode::AttributeStreamFileNode(BNode* node)
: fNode(node) :
fNode(node)
{ {
ASSERT(fNode); ASSERT(fNode);
} }
@ -291,17 +316,21 @@ off_t
AttributeStreamFileNode::Read(const char* name, const char* foreignName, AttributeStreamFileNode::Read(const char* name, const char* foreignName,
uint32 type, off_t size, void* buffer, void (*swapFunc)(void*)) uint32 type, off_t size, void* buffer, void (*swapFunc)(void*))
{ {
if (name && fNode->ReadAttr(name, type, 0, buffer, (size_t)size) == size) if (name != NULL
return size; && fNode->ReadAttr(name, type, 0, buffer, (size_t)size) == size) {
// didn't find the attribute under the native name, try the foreign name
if (foreignName && fNode->ReadAttr(foreignName, type, 0, buffer,
(size_t)size) == size) {
// foreign attribute, swap the data
if (swapFunc)
(swapFunc)(buffer);
return size; return size;
} }
// didn't find the attribute under the native name, try the foreign name
if (foreignName != NULL && fNode->ReadAttr(foreignName, type, 0, buffer,
(size_t)size) == size) {
// foreign attribute, swap the data
if (swapFunc != NULL)
(swapFunc)(buffer);
return size;
}
return 0; return 0;
} }
@ -310,13 +339,15 @@ off_t
AttributeStreamFileNode::Write(const char* name, const char* foreignName, AttributeStreamFileNode::Write(const char* name, const char* foreignName,
uint32 type, off_t size, const void* buffer) uint32 type, off_t size, const void* buffer)
{ {
ASSERT(fNode); ASSERT(fNode != NULL);
ASSERT(dynamic_cast<BNode*>(fNode)); ASSERT(dynamic_cast<BNode*>(fNode) != NULL);
off_t result = fNode->WriteAttr(name, type, 0, buffer, (size_t)size); off_t result = fNode->WriteAttr(name, type, 0, buffer, (size_t)size);
if (result == size && foreignName) if (result == size && foreignName != NULL) {
// the write operation worked fine, remove the foreign attribute // the write operation worked fine, remove the foreign attribute
// to not let stale data hang around // to not let stale data hang around
fNode->RemoveAttr(foreignName); fNode->RemoveAttr(foreignName);
}
return result; return result;
} }
@ -325,7 +356,7 @@ AttributeStreamFileNode::Write(const char* name, const char* foreignName,
bool bool
AttributeStreamFileNode::Drive() AttributeStreamFileNode::Drive()
{ {
ASSERT(fNode); ASSERT(fNode != NULL);
if (!_inherited::Drive()) if (!_inherited::Drive())
return false; return false;
@ -337,6 +368,7 @@ AttributeStreamFileNode::Drive()
if (result < attr->Size()) if (result < attr->Size())
return true; return true;
} }
return true; return true;
} }
@ -344,8 +376,9 @@ AttributeStreamFileNode::Drive()
const char* const char*
AttributeStreamFileNode::Get() AttributeStreamFileNode::Get()
{ {
ASSERT(fNode); ASSERT(fNode != NULL);
TRESPASS(); TRESPASS();
return NULL; return NULL;
} }
@ -353,7 +386,8 @@ AttributeStreamFileNode::Get()
bool bool
AttributeStreamFileNode::Fill(char* buffer) const AttributeStreamFileNode::Fill(char* buffer) const
{ {
ASSERT(fNode); ASSERT(fNode != NULL);
return fNode->ReadAttr(fCurrentAttr.Name(), fCurrentAttr.Type(), 0, return fNode->ReadAttr(fCurrentAttr.Name(), fCurrentAttr.Type(), 0,
buffer, (size_t)fCurrentAttr.Size()) == (ssize_t)fCurrentAttr.Size(); buffer, (size_t)fCurrentAttr.Size()) == (ssize_t)fCurrentAttr.Size();
} }
@ -362,8 +396,9 @@ AttributeStreamFileNode::Fill(char* buffer) const
const AttributeInfo* const AttributeInfo*
AttributeStreamFileNode::Next() AttributeStreamFileNode::Next()
{ {
ASSERT(fNode); ASSERT(fNode != NULL);
ASSERT(!fReadFrom); ASSERT(fReadFrom == NULL);
char attrName[256]; char attrName[256];
if (fNode->GetNextAttrName(attrName) != B_OK) if (fNode->GetNextAttrName(attrName) != B_OK)
return NULL; return NULL;
@ -373,13 +408,18 @@ AttributeStreamFileNode::Next()
return NULL; return NULL;
fCurrentAttr.SetTo(attrName, info); fCurrentAttr.SetTo(attrName, info);
return &fCurrentAttr; return &fCurrentAttr;
} }
// #pragma mark - AttributeStreamMemoryNode
AttributeStreamMemoryNode::AttributeStreamMemoryNode() AttributeStreamMemoryNode::AttributeStreamMemoryNode()
: fAttributes(5, true), :
fCurrentIndex(-1) fAttributes(5, true),
fCurrentIndex(-1)
{ {
} }
@ -403,10 +443,12 @@ int32
AttributeStreamMemoryNode::Find(const char* name, uint32 type) const AttributeStreamMemoryNode::Find(const char* name, uint32 type) const
{ {
int32 count = fAttributes.CountItems(); int32 count = fAttributes.CountItems();
for (int32 index = 0; index < count; index++) for (int32 index = 0; index < count; index++) {
if (strcmp(fAttributes.ItemAt(index)->fAttr.Name(), name) == 0 if (strcmp(fAttributes.ItemAt(index)->fAttr.Name(), name) == 0
&& fAttributes.ItemAt(index)->fAttr.Type() == type) && fAttributes.ItemAt(index)->fAttr.Type() == type) {
return index; return index;
}
}
return -1; return -1;
} }
@ -416,9 +458,8 @@ off_t
AttributeStreamMemoryNode::Contains(const char* name, uint32 type) AttributeStreamMemoryNode::Contains(const char* name, uint32 type)
{ {
int32 index = Find(name, type); int32 index = Find(name, type);
if (index < 0)
return 0; return index < 0 ? 0 : fAttributes.ItemAt(index)->fAttr.Size();
return fAttributes.ItemAt(index)->fAttr.Size();
} }
@ -434,14 +475,15 @@ AttributeStreamMemoryNode::Read(const char* name,
int32 index = Find(name, type); int32 index = Find(name, type);
if (index < 0) { if (index < 0) {
if (!fReadFrom) if (fReadFrom == NULL)
return 0; return 0;
off_t size = fReadFrom->Contains(name, type); off_t size = fReadFrom->Contains(name, type);
if (!size) if (size == 0)
return 0; return 0;
attrNode = BufferingGet(name, type, size); attrNode = BufferingGet(name, type, size);
if (!attrNode) if (attrNode == NULL)
return 0; return 0;
} else } else
attrNode = fAttributes.ItemAt(index); attrNode = fAttributes.ItemAt(index);
@ -450,6 +492,7 @@ AttributeStreamMemoryNode::Read(const char* name,
return 0; return 0;
memcpy(buffer, attrNode->fData, (size_t)attrNode->fAttr.Size()); memcpy(buffer, attrNode->fData, (size_t)attrNode->fAttr.Size());
return attrNode->fAttr.Size(); return attrNode->fAttr.Size();
} }
@ -463,6 +506,7 @@ AttributeStreamMemoryNode::Write(const char* name, const char*, uint32 type,
AttrNode* attrNode = new AttrNode(name, type, size, newBuffer); AttrNode* attrNode = new AttrNode(name, type, size, newBuffer);
fAttributes.AddItem(attrNode); fAttributes.AddItem(attrNode);
return size; return size;
} }
@ -492,6 +536,7 @@ AttributeStreamMemoryNode::BufferingGet(const char* name, uint32 type,
AttrNode* attrNode = new AttrNode(name, type, size, newBuffer); AttrNode* attrNode = new AttrNode(name, type, size, newBuffer);
fAttributes.AddItem(attrNode); fAttributes.AddItem(attrNode);
return fAttributes.LastItem(); return fAttributes.LastItem();
} }
@ -499,11 +544,11 @@ AttributeStreamMemoryNode::BufferingGet(const char* name, uint32 type,
AttributeStreamMemoryNode::AttrNode* AttributeStreamMemoryNode::AttrNode*
AttributeStreamMemoryNode::BufferingGet() AttributeStreamMemoryNode::BufferingGet()
{ {
if (!fReadFrom) if (fReadFrom == NULL)
return NULL; return NULL;
const AttributeInfo* attr = fReadFrom->Next(); const AttributeInfo* attr = fReadFrom->Next();
if (!attr) if (attr == NULL)
return NULL; return NULL;
return BufferingGet(attr->Name(), attr->Type(), attr->Size()); return BufferingGet(attr->Name(), attr->Type(), attr->Size());
@ -513,10 +558,11 @@ AttributeStreamMemoryNode::BufferingGet()
const AttributeInfo* const AttributeInfo*
AttributeStreamMemoryNode::Next() AttributeStreamMemoryNode::Next()
{ {
if (fReadFrom) if (fReadFrom != NULL) {
// the buffer is in the middle of the stream, get // the buffer is in the middle of the stream, get
// one buffer at a time // one buffer at a time
BufferingGet(); BufferingGet();
}
if (fCurrentIndex + 1 >= fAttributes.CountItems()) if (fCurrentIndex + 1 >= fAttributes.CountItems())
return NULL; return NULL;
@ -529,6 +575,7 @@ const char*
AttributeStreamMemoryNode::Get() AttributeStreamMemoryNode::Get()
{ {
ASSERT(fCurrentIndex < fAttributes.CountItems()); ASSERT(fCurrentIndex < fAttributes.CountItems());
return fAttributes.ItemAt(fCurrentIndex)->fData; return fAttributes.ItemAt(fCurrentIndex)->fData;
} }
@ -544,11 +591,15 @@ AttributeStreamMemoryNode::Fill(char* buffer) const
} }
// #pragma mark - AttributeStreamTemplateNode
AttributeStreamTemplateNode::AttributeStreamTemplateNode( AttributeStreamTemplateNode::AttributeStreamTemplateNode(
const AttributeTemplate* attrTemplates, int32 count) const AttributeTemplate* attrTemplates, int32 count)
: fAttributes(attrTemplates), :
fCurrentIndex(-1), fAttributes(attrTemplates),
fCount(count) fCurrentIndex(-1),
fCount(count)
{ {
} }
@ -591,6 +642,7 @@ const char*
AttributeStreamTemplateNode::Get() AttributeStreamTemplateNode::Get()
{ {
ASSERT(fCurrentIndex < fCount); ASSERT(fCurrentIndex < fCount);
return fAttributes[fCurrentIndex].fBits; return fAttributes[fCurrentIndex].fBits;
} }
@ -620,6 +672,9 @@ AttributeStreamTemplateNode::Find(const char* name, uint32 type) const
} }
// #pragma mark - AttributeStreamFilterNode
bool bool
AttributeStreamFilterNode::Reject(const char*, uint32, off_t) AttributeStreamFilterNode::Reject(const char*, uint32, off_t)
{ {
@ -631,17 +686,18 @@ AttributeStreamFilterNode::Reject(const char*, uint32, off_t)
const AttributeInfo* const AttributeInfo*
AttributeStreamFilterNode::Next() AttributeStreamFilterNode::Next()
{ {
if (!fReadFrom) if (fReadFrom == NULL)
return NULL; return NULL;
for (;;) { for (;;) {
const AttributeInfo* attr = fReadFrom->Next(); const AttributeInfo* attr = fReadFrom->Next();
if (!attr) if (attr == NULL)
break; break;
if (!Reject(attr->Name(), attr->Type(), attr->Size())) if (!Reject(attr->Name(), attr->Type(), attr->Size()))
return attr; return attr;
} }
return NULL; return NULL;
} }
@ -649,7 +705,7 @@ AttributeStreamFilterNode::Next()
off_t off_t
AttributeStreamFilterNode::Contains(const char* name, uint32 type) AttributeStreamFilterNode::Contains(const char* name, uint32 type)
{ {
if (!fReadFrom) if (fReadFrom == NULL)
return 0; return 0;
off_t size = fReadFrom->Contains(name, type); off_t size = fReadFrom->Contains(name, type);
@ -665,7 +721,7 @@ off_t
AttributeStreamFilterNode::Read(const char* name, const char* foreignName, AttributeStreamFilterNode::Read(const char* name, const char* foreignName,
uint32 type, off_t size, void* buffer, void (*swapFunc)(void*)) uint32 type, off_t size, void* buffer, void (*swapFunc)(void*))
{ {
if (!fReadFrom) if (fReadFrom == NULL)
return 0; return 0;
if (!Reject(name, type, size)) { if (!Reject(name, type, size)) {
@ -681,7 +737,7 @@ off_t
AttributeStreamFilterNode::Write(const char* name, const char* foreignName, AttributeStreamFilterNode::Write(const char* name, const char* foreignName,
uint32 type, off_t size, const void* buffer) uint32 type, off_t size, const void* buffer)
{ {
if (!fWriteTo) if (fWriteTo == NULL)
return 0; return 0;
if (!Reject(name, type, size)) if (!Reject(name, type, size))
@ -691,8 +747,12 @@ AttributeStreamFilterNode::Write(const char* name, const char* foreignName,
} }
// #pragma mark - NamesToAcceptAttrFilter
NamesToAcceptAttrFilter::NamesToAcceptAttrFilter(const char** nameList) NamesToAcceptAttrFilter::NamesToAcceptAttrFilter(const char** nameList)
: fNameList(nameList) :
fNameList(nameList)
{ {
} }
@ -700,8 +760,8 @@ NamesToAcceptAttrFilter::NamesToAcceptAttrFilter(const char** nameList)
bool bool
NamesToAcceptAttrFilter::Reject(const char* name, uint32, off_t) NamesToAcceptAttrFilter::Reject(const char* name, uint32, off_t)
{ {
for (int32 index = 0; ;index++) { for (int32 index = 0; ; index++) {
if (!fNameList[index]) if (fNameList[index] == NULL)
break; break;
if (strcmp(name, fNameList[index]) == 0) { if (strcmp(name, fNameList[index]) == 0) {
@ -715,14 +775,18 @@ NamesToAcceptAttrFilter::Reject(const char* name, uint32, off_t)
} }
// #pragma mark - SelectiveAttributeTransformer
SelectiveAttributeTransformer::SelectiveAttributeTransformer( SelectiveAttributeTransformer::SelectiveAttributeTransformer(
const char* attributeName, const char* attributeName,
bool (*transformFunc)(const char* , uint32 , off_t, void*, void*), bool (*transformFunc)(const char* , uint32 , off_t, void*, void*),
void* params) void* params)
: fAttributeNameToTransform(attributeName), :
fTransformFunc(transformFunc), fAttributeNameToTransform(attributeName),
fTransformParams(params), fTransformFunc(transformFunc),
fTransformedBuffers(10, false) fTransformParams(params),
fTransformedBuffers(10, false)
{ {
} }
@ -752,7 +816,7 @@ off_t
SelectiveAttributeTransformer::Read(const char* name, const char* foreignName, SelectiveAttributeTransformer::Read(const char* name, const char* foreignName,
uint32 type, off_t size, void* buffer, void (*swapFunc)(void*)) uint32 type, off_t size, void* buffer, void (*swapFunc)(void*))
{ {
if (!fReadFrom) if (fReadFrom == NULL)
return 0; return 0;
off_t result = fReadFrom->Read(name, foreignName, type, size, buffer, off_t result = fReadFrom->Read(name, foreignName, type, size, buffer,
@ -785,7 +849,8 @@ SelectiveAttributeTransformer::CopyAndApplyTransformer(const char* name,
uint32 type, off_t size, const char* data) uint32 type, off_t size, const char* data)
{ {
char* result = NULL; char* result = NULL;
if (data) {
if (data != NULL) {
result = new char[size]; result = new char[size];
memcpy(result, data, (size_t)size); memcpy(result, data, (size_t)size);
} }
@ -803,7 +868,8 @@ const AttributeInfo*
SelectiveAttributeTransformer::Next() SelectiveAttributeTransformer::Next()
{ {
const AttributeInfo* result = fReadFrom->Next(); const AttributeInfo* result = fReadFrom->Next();
if (!result)
if (result == NULL)
return NULL; return NULL;
fCurrentAttr.SetTo(*result); fCurrentAttr.SetTo(*result);
@ -814,7 +880,7 @@ SelectiveAttributeTransformer::Next()
const char* const char*
SelectiveAttributeTransformer::Get() SelectiveAttributeTransformer::Get()
{ {
if (!fReadFrom) if (fReadFrom == NULL)
return NULL; return NULL;
const char* result = fReadFrom->Get(); const char* result = fReadFrom->Get();
@ -828,7 +894,7 @@ SelectiveAttributeTransformer::Get()
fCurrentAttr.Type(), fCurrentAttr.Size(), result); fCurrentAttr.Type(), fCurrentAttr.Size(), result);
// enlist for proper disposal when our job is done // enlist for proper disposal when our job is done
if (transformedData) { if (transformedData != NULL) {
fTransformedBuffers.AddItem(transformedData); fTransformedBuffers.AddItem(transformedData);
return transformedData; return transformedData;
} }

View File

@ -46,10 +46,11 @@ All rights reserved.
// //
// In addition to the whacky (but usefull) << syntax, calls like Read, Write // In addition to the whacky (but usefull) << syntax, calls like Read, Write
// are also available // are also available
#ifndef __ATTRIBUTE_STREAM__ #ifndef _ATTRIBUTE_STREAM_H
#define __ATTRIBUTE_STREAM__ #define _ATTRIBUTE_STREAM_H
#include <ObjectList.h>
#include <Node.h> #include <Node.h>
#include <Rect.h> #include <Rect.h>
#include <String.h> #include <String.h>
@ -57,8 +58,6 @@ All rights reserved.
#include <fs_attr.h> #include <fs_attr.h>
#include "ObjectList.h"
namespace BPrivate { namespace BPrivate {
@ -370,9 +369,10 @@ private:
template<class Type> template<class Type>
AttributeStreamConstValue<Type>::AttributeStreamConstValue(const char* name, AttributeStreamConstValue<Type>::AttributeStreamConstValue(const char* name,
uint32 attributeType, Type value) uint32 attributeType, Type value)
: fAttr(name, attributeType, sizeof(Type)), :
fValue(value), fAttr(name, attributeType, sizeof(Type)),
fRewound(true) fValue(value),
fRewound(true)
{ {
} }
@ -420,44 +420,55 @@ AttributeStreamConstValue<Type>::Find(const char* name, uint32 type) const
class AttributeStreamBoolValue : public AttributeStreamConstValue<bool> { class AttributeStreamBoolValue : public AttributeStreamConstValue<bool> {
public: public:
AttributeStreamBoolValue(const char* name, bool value) AttributeStreamBoolValue(const char* name, bool value)
: AttributeStreamConstValue<bool>(name, B_BOOL_TYPE, value) :
{} AttributeStreamConstValue<bool>(name, B_BOOL_TYPE, value)
{
}
}; };
class AttributeStreamInt32Value : public AttributeStreamConstValue<int32> { class AttributeStreamInt32Value : public AttributeStreamConstValue<int32> {
public: public:
AttributeStreamInt32Value(const char* name, int32 value) AttributeStreamInt32Value(const char* name, int32 value)
: AttributeStreamConstValue<int32>(name, B_INT32_TYPE, value) :
{} AttributeStreamConstValue<int32>(name, B_INT32_TYPE, value)
{
}
}; };
class AttributeStreamInt64Value : public AttributeStreamConstValue<int64> { class AttributeStreamInt64Value : public AttributeStreamConstValue<int64> {
public: public:
AttributeStreamInt64Value(const char* name, int64 value) AttributeStreamInt64Value(const char* name, int64 value)
: AttributeStreamConstValue<int64>(name, B_INT64_TYPE, value) :
{} AttributeStreamConstValue<int64>(name, B_INT64_TYPE, value)
{
}
}; };
class AttributeStreamRectValue : public AttributeStreamConstValue<BRect> { class AttributeStreamRectValue : public AttributeStreamConstValue<BRect> {
public: public:
AttributeStreamRectValue(const char* name, BRect value) AttributeStreamRectValue(const char* name, BRect value)
: AttributeStreamConstValue<BRect>(name, B_RECT_TYPE, value) :
{} AttributeStreamConstValue<BRect>(name, B_RECT_TYPE, value)
{
}
}; };
class AttributeStreamFloatValue : public AttributeStreamConstValue<float> { class AttributeStreamFloatValue : public AttributeStreamConstValue<float> {
public: public:
AttributeStreamFloatValue(const char* name, float value) AttributeStreamFloatValue(const char* name, float value)
: AttributeStreamConstValue<float>(name, B_FLOAT_TYPE, value) :
{} AttributeStreamConstValue<float>(name, B_FLOAT_TYPE, value)
{
}
}; };
} // namespace BPrivate } // namespace BPrivate
using namespace BPrivate; using namespace BPrivate;
#endif
#endif // _ATTRIBUTE_STREAM_H