8#ifndef INCLUDED_BDLD_DATUMBINARYREF
9#define INCLUDED_BDLD_DATUMBINARYREF
131#include <bdlscm_version.h>
142#include <bsl_algorithm.h>
143#include <bsl_cstring.h>
144#include <bsl_iosfwd.h>
168 const void *d_data_p;
197 const void *
data()
const;
215 bsl::ostream&
print(bsl::ostream& stream,
217 int spacesPerLevel = 4)
const;
307 return (lhs.size() == rhs.size()) &&
308 (lhs.size() == 0 || !bsl::memcmp(lhs.data(), rhs.data(), rhs.size()));
315 return !(lhs == rhs);
319bool bdld::operator<(
const DatumBinaryRef& lhs,
const DatumBinaryRef& rhs)
321 const size_t minSize = bsl::min(lhs.size(), rhs.size());
322 const int cmp = minSize
323 ? bsl::memcmp(lhs.data(), rhs.data(), minSize)
326 return cmp == 0 ? lhs.size() < rhs.size() : cmp < 0;
330bool bdld::operator>(
const DatumBinaryRef& lhs,
const DatumBinaryRef& rhs)
332 const size_t minSize = bsl::min(lhs.size(), rhs.size());
333 const int cmp = minSize
334 ? bsl::memcmp(lhs.data(), rhs.data(), minSize)
337 return cmp == 0 ? lhs.size() > rhs.size() : cmp > 0;
353bsl::ostream&
bdld::operator<<(bsl::ostream& stream,
const DatumBinaryRef& rhs)
355 return rhs.print(stream, 0 , -1);
Definition bdld_datumbinaryref.h:157
bsls::Types::size_type SizeType
Definition bdld_datumbinaryref.h:164
const void * data() const
Return the pointer to the non-modifiable binary data.
Definition bdld_datumbinaryref.h:290
BSLMF_NESTED_TRAIT_DECLARATION(DatumBinaryRef, bdlb::HasPrintMethod)
~DatumBinaryRef()=default
DatumBinaryRef(const DatumBinaryRef &origin)=default
DatumBinaryRef & operator=(const DatumBinaryRef &rhs)=default
DatumBinaryRef()
Create a DatumBinaryRef object having zero data pointer and size.
Definition bdld_datumbinaryref.h:274
SizeType size() const
Return the size of the binary data.
Definition bdld_datumbinaryref.h:296
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
BSLMF_NESTED_TRAIT_DECLARATION(DatumBinaryRef, bsl::is_trivially_copyable)
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdld_datum.h:730
bsl::ostream & operator<<(bsl::ostream &stream, const Datum &rhs)
bool operator<=(const DatumBinaryRef &lhs, const DatumBinaryRef &rhs)
bool operator<(const DatumBinaryRef &lhs, const DatumBinaryRef &rhs)
bool operator>=(const DatumBinaryRef &lhs, const DatumBinaryRef &rhs)
bool operator==(const Datum &lhs, const Datum &rhs)
bool operator>(const DatumBinaryRef &lhs, const DatumBinaryRef &rhs)
bool operator!=(const Datum &lhs, const Datum &rhs)
Definition bdlb_printmethods.h:306
Definition bslmf_istriviallycopyable.h:329
std::size_t size_type
Definition bsls_types.h:124