8#ifndef INCLUDED_BDLT_DAYOFWEEKSET
9#define INCLUDED_BDLT_DAYOFWEEKSET
255#include <bdlscm_version.h>
270#include <bsl_cstddef.h>
271#include <bsl_iosfwd.h>
272#include <bsl_iterator.h>
285#if defined(BSLS_LIBRARYFEATURES_STDCPP_LIBCSTD)
290 :
public bsl::iterator<bsl::bidirectional_iterator_tag,
291 const DayOfWeek::Enum>
401 unsigned char d_days;
408 template <
class HASHALG>
505 template <
class STREAM>
550 template <
class STREAM>
562 bsl::ostream&
print(bsl::ostream& stream,
564 int spacesPerLevel = 4)
const;
566#ifndef BDE_OPENSOURCE_PUBLICATION
625template <
class HASHALG>
646: d_data(original.d_data)
647, d_index(original.d_index)
700 const DayOfWeekSet_Iter& rhs)
707 return lhs.d_index == rhs.d_index;
712 const DayOfWeekSet_Iter& rhs)
714 return !(lhs == rhs);
742: d_days(original.d_days)
763 d_days =
static_cast<unsigned char>(d_days | rhs.d_days);
770 d_days =
static_cast<unsigned char>(d_days & rhs.d_days);
777 d_days =
static_cast<unsigned char>(d_days ^ rhs.d_days);
784 const int mask = d_days & rhs.d_days;
785 d_days =
static_cast<unsigned char>(d_days - mask);
792 d_days =
static_cast<unsigned char>(d_days | (1 << value));
798 const int mask = 1 << value;
799 const bool rv = d_days & mask;
800 d_days &=
static_cast<unsigned char>(~mask);
812template <
class STREAM>
819 stream.getUint8(tmp);
821 if (stream && 0 == (tmp & 1)) {
840 return set.d_days == (d_days & set.d_days);
864 const int mask = 1 << value;
865 return mask == (d_days & mask);
888template <
class STREAM>
894 stream.putUint8(d_days);
904#ifndef BDE_OPENSOURCE_PUBLICATION
920 DayOfWeekSet tmp(set);
921 tmp.d_days =
static_cast<unsigned char>(~tmp.d_days & 0xfe);
928 return lhs.d_days == rhs.d_days;
934 return lhs.d_days != rhs.d_days;
939 const DayOfWeekSet& rhs)
941 return DayOfWeekSet(lhs) |= rhs;
946 const DayOfWeekSet& rhs)
948 return DayOfWeekSet(lhs) &= rhs;
953 const DayOfWeekSet& rhs)
955 return DayOfWeekSet(lhs) ^= rhs;
960 const DayOfWeekSet& rhs)
962 return DayOfWeekSet(lhs) -= rhs;
966bsl::ostream&
bdlt::operator<<(bsl::ostream& stream,
const DayOfWeekSet& rhs)
968 return rhs.
print(stream, 0, -1);
972template <
class HASHALG>
976 using ::BloombergLP::bslh::hashAppend;
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
Definition bdlt_dayofweekset.h:293
DayOfWeekSet_Iter & operator--()
bsl::bidirectional_iterator_tag iterator_category
Definition bdlt_dayofweekset.h:297
const DayOfWeek::Enum & reference
Definition bdlt_dayofweekset.h:301
DayOfWeekSet_Iter()
Create a default (invalid) iterator.
Definition bdlt_dayofweekset.h:638
bsl::ptrdiff_t difference_type
Definition bdlt_dayofweekset.h:299
DayOfWeekSet_Iter & operator++()
friend bool operator==(const DayOfWeekSet_Iter &, const DayOfWeekSet_Iter &)
static const DayOfWeek::Enum s_dayOfWeekArray[9]
Definition bdlt_dayofweekset.h:304
DayOfWeek::Enum value_type
Definition bdlt_dayofweekset.h:298
DayOfWeekSet_Iter & operator=(const DayOfWeekSet_Iter &rhs)
Definition bdlt_dayofweekset.h:662
~DayOfWeekSet_Iter()
Destroy this iterator.
Definition bdlt_dayofweekset.h:652
unsigned char d_data
Definition bdlt_dayofweekset.h:307
const DayOfWeek::Enum * pointer
Definition bdlt_dayofweekset.h:300
signed char d_index
Definition bdlt_dayofweekset.h:309
DayOfWeekSet_Iter(int data, int index)
const DayOfWeek::Enum & operator*() const
Definition bdlt_dayofweekset.h:687
Definition bdlt_dayofweekset.h:398
DayOfWeekSet_Iter iterator
Standard nested alias for set container's iterator.
Definition bdlt_dayofweekset.h:415
bool isEmpty() const
Definition bdlt_dayofweekset.h:856
bool remove(DayOfWeek::Enum value)
Definition bdlt_dayofweekset.h:796
friend bool operator==(const DayOfWeekSet &, const DayOfWeekSet &)
static int maxSupportedBdexVersion()
Definition bdlt_dayofweekset.h:907
DayOfWeekSet & operator&=(const DayOfWeekSet &rhs)
Definition bdlt_dayofweekset.h:768
DayOfWeekSet()
Create an empty set.
Definition bdlt_dayofweekset.h:735
friend DayOfWeekSet operator~(const DayOfWeekSet &)
STREAM & bdexStreamIn(STREAM &stream, int version)
Definition bdlt_dayofweekset.h:813
iterator end() const
Definition bdlt_dayofweekset.h:850
bool areMembers(const DayOfWeekSet &set) const
Definition bdlt_dayofweekset.h:838
int length() const
Return the number of elements in this set.
Definition bdlt_dayofweekset.h:869
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
bsl::reverse_iterator< iterator > reverse_iterator
Standard nested alias for set container's reverse iterator.
Definition bdlt_dayofweekset.h:421
reverse_iterator rbegin() const
Definition bdlt_dayofweekset.h:875
reverse_iterator const_reverse_iterator
Standard nested alias for set container's constant reverse iterator.
Definition bdlt_dayofweekset.h:424
friend bool operator!=(const DayOfWeekSet &, const DayOfWeekSet &)
iterator begin() const
Return an iterator referencing the first valid element in this set.
Definition bdlt_dayofweekset.h:844
~DayOfWeekSet()
Destroy this object.
Definition bdlt_dayofweekset.h:747
iterator const_iterator
Standard nested alias for set container's constant iterator.
Definition bdlt_dayofweekset.h:418
bool isMember(DayOfWeek::Enum value) const
Definition bdlt_dayofweekset.h:862
STREAM & bdexStreamOut(STREAM &stream, int version) const
Definition bdlt_dayofweekset.h:889
reverse_iterator rend() const
Definition bdlt_dayofweekset.h:881
friend void hashAppend(HASHALG &hashAlg, const DayOfWeekSet &)
void add(DayOfWeek::Enum value)
Add the specified value to this set.
Definition bdlt_dayofweekset.h:790
DayOfWeekSet & operator-=(const DayOfWeekSet &rhs)
Definition bdlt_dayofweekset.h:782
void removeAll()
Remove all members of this set.
Definition bdlt_dayofweekset.h:805
DayOfWeekSet & operator|=(const DayOfWeekSet &rhs)
Definition bdlt_dayofweekset.h:761
DayOfWeekSet & operator^=(const DayOfWeekSet &rhs)
Definition bdlt_dayofweekset.h:775
DayOfWeekSet & operator=(const DayOfWeekSet &rhs)
Definition bdlt_dayofweekset.h:754
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
void hashAppend(HASH_ALGORITHM &hashAlg, const baljsn::EncoderTestAddress &object)
Definition baljsn_encoder_testtypes.h:9236
Definition bbldc_basicisma30360.h:112
bool operator==(const Calendar &lhs, const Calendar &rhs)
Date operator-(const Date &date, int numDays)
DayOfWeekSet operator&(const DayOfWeekSet &lhs, const DayOfWeekSet &rhs)
DayOfWeekSet operator|(const DayOfWeekSet &lhs, const DayOfWeekSet &rhs)
bsl::ostream & operator<<(bsl::ostream &stream, const Calendar &calendar)
DayOfWeekSet operator^(const DayOfWeekSet &lhs, const DayOfWeekSet &rhs)
void hashAppend(HASHALG &hashAlg, const Calendar &object)
bool operator!=(const Calendar &lhs, const Calendar &rhs)
DayOfWeekSet operator~(const DayOfWeekSet &set)
Definition bdlbb_blob.h:576
static int numBitsSet(unsigned int value)
Definition bdlb_bitutil.h:360
Enum
Enumerated day-of-week values.
Definition bdlt_dayofweek.h:123
Definition bslmf_isbitwisecopyable.h:298