text
stringlengths
0
2.2M
bsl::ostream& print(bsl::ostream& stream,
int level = 0,
int spacesPerLevel = 4) const;
// Format this object to the specified output 'stream' at the
// optionally specified indentation 'level' and return a reference to
// the modifiable 'stream'. If 'level' is specified, optionally
// specify 'spacesPerLevel', the number of spaces per indentation level
// for this and all of its nested objects. Each line is indented by
// the absolute value of 'level * spacesPerLevel'. If 'level' is
// negative, suppress indentation of the first line. If
// 'spacesPerLevel' is negative, suppress line breaks and format the
// entire output on one line. If 'stream' is initially invalid, this
// operation has no effect. Note that a trailing newline is provided
// in multiline mode only.
const int& toInt() const;
// Convert this value to 'int'.
};
// FREE OPERATORS
inline
bool operator==(const CustomizedInt& lhs, const CustomizedInt& rhs);
// Return 'true' if the specified 'lhs' and 'rhs' attribute objects have
// the same value, and 'false' otherwise. Two attribute objects have the
// same value if each respective attribute has the same value.
inline
bool operator!=(const CustomizedInt& lhs, const CustomizedInt& rhs);
// Return 'true' if the specified 'lhs' and 'rhs' attribute objects do not
// have the same value, and 'false' otherwise. Two attribute objects do
// not have the same value if one or more respective attributes differ in
// values.
inline
bsl::ostream& operator<<(bsl::ostream& stream, const CustomizedInt& rhs);
// Format the specified 'rhs' to the specified output 'stream' and return a
// reference to the modifiable 'stream'.
// ============================================================================
// INLINE FUNCTION DEFINITIONS
// ============================================================================
// CREATORS
inline
CustomizedInt::CustomizedInt()
{
}
inline
CustomizedInt::CustomizedInt(const CustomizedInt& original)
: d_value(original.d_value)
{
}
inline
CustomizedInt::CustomizedInt(int value)
: d_value(value)
{
}
inline
CustomizedInt::~CustomizedInt()
{
}
// MANIPULATORS
inline
CustomizedInt& CustomizedInt::operator=(const CustomizedInt& rhs)
{
d_value = rhs.d_value;
return *this;
}
inline
void CustomizedInt::reset()
{
bdlat_ValueTypeFunctions::reset(&d_value);
}
inline
int CustomizedInt::fromInt(int value)
{
enum { SUCCESS = 0, FAILURE = -1 };
if (5 < value) {
return FAILURE; // RETURN
}
d_value = value;
return SUCCESS;
}
// ACCESSORS
inline
bsl::ostream& CustomizedInt::print(bsl::ostream& stream,
int level,