vfs: check userland buffers before reading them.
[haiku.git] / src / apps / haikudepot / textview / BulletData.cpp
blob92e2f1c5cb35f838a48a3d807180b4ca3184c7bb
1 /*
2 * Copyright 2013, Stephan Aßmus <superstippi@gmx.de>.
3 * All rights reserved. Distributed under the terms of the MIT License.
4 */
6 #include "BulletData.h"
8 #include <new>
11 BulletData::BulletData()
13 fString(""),
14 fSpacing(0.0f)
19 BulletData::BulletData(const BString& string, float spacing)
21 fString(string),
22 fSpacing(spacing)
27 BulletData::BulletData(const BulletData& other)
29 fString(other.fString),
30 fSpacing(other.fSpacing)
35 bool
36 BulletData::operator==(const BulletData& other) const
38 if (this == &other)
39 return true;
41 return fString == other.fString
42 && fSpacing == other.fSpacing;
46 bool
47 BulletData::operator!=(const BulletData& other) const
49 return !(*this == other);
53 BulletDataRef
54 BulletData::SetString(const BString& string)
56 if (fString == string)
57 return BulletDataRef(this);
59 BulletData* ret = new(std::nothrow) BulletData(*this);
60 if (ret == NULL)
61 return BulletDataRef(this);
63 ret->fString = string;
64 return BulletDataRef(ret, true);
68 BulletDataRef
69 BulletData::SetSpacing(float spacing)
71 if (fSpacing == spacing)
72 return BulletDataRef(this);
74 BulletData* ret = new(std::nothrow) BulletData(*this);
75 if (ret == NULL)
76 return BulletDataRef(this);
78 ret->fSpacing = spacing;
79 return BulletDataRef(ret, true);
83 // #pragma mark - private
86 BulletData&
87 BulletData::operator=(const BulletData& other)
89 return *this;