Lines Matching refs:flags

26  * the flag if the wrapped type T is already flagged and we can combine the outer and inner flags.
28 * Flags can be queried/manipulated via flags() an setFlags(Flags). The wrapped value can be
32 * Users must specify the used bits (MASK) in the flags. Flag getters and setters will enforce this
48 * EXPECT_EQ(a.flags(), kSafe);
53 * provided automatically (flags are automatically shared if possible, e.g. mask is shifted
54 * automatically to not overlap with used bits of the wrapped type's flags, and fall back to
73 * EXPECT_EQ(b.flags(), kConst);
74 * EXPECT_EQ(b.get().flags(), kSafe);
91 * EXPECT_EQ(v.flags(), kUnsafeV);
92 * EXPECT_EQ(v.get().flags(), kUnsafe); // !kUnsafeV overrides kSafe
95 * EXPECT_EQ(v.flags(), kValidated);
96 * EXPECT_EQ(v.get().flags(), kSafe);
98 * EXPECT_EQ(v.flags(), 2); // NOTE: sharing masks with enums allows strange situations to occur
134 "this method only makes sense for unsigned flags");
272 static constexpr int shift = 0; ///<left shift of flags in a potentially flagged class
281 * incorrect sharing or the flags not having enough bits, the minimum is -1.
296 * Type support utility that calculates whether the flags of T can be combined with MASK.
328 * Main Flagged template that adds flags to an object of another type (in essence, creates a pair)
355 static constexpr int sFlagShift = SHIFT > 0 ? SHIFT : 0; ///< the left shift applied to flags
364 IntFlag mFlags; ///< flags
367 /// The effective combined mask used by this class and any wrapped classes if the flags are
372 * Helper method used by subsequent flagged wrappers to query flags. Returns the
373 * flags for a particular mask and left shift.
378 * \return the requested flags
385 * Helper method used by subsequent flagged wrappers to apply combined flags. Sets the flags
390 * \param flags flags to update (any flags within the bitmask are updated to their value in this
393 inline void setFlagsHelper(IntFlag mask, int shift, IntFlag flags) {
394 mFlags = Flag((mFlags & ~(mask << shift)) | ((flags & mask) << shift));
399 * Wrapper around base class constructor. These take the flags as their first
402 * \param flags initial flags
405 constexpr Flagged(Flag flags, Args... args)
407 mFlags(Flag(_Flagged_helper::lshift(flags & sFlagMask, sFlagShift))) { }
415 /** Gets the flags. */
416 constexpr Flag flags() const {
420 /** Sets the flags. */
421 void setFlags(Flag flags) {
422 setFlagsHelper(sFlagMask, sFlagShift, flags);
448 * Specialization for the case when T is derived from Flagged<U, Flag> and flags can be combined.
463 static constexpr int sFlagShift = SHIFT; ///< the left shift applied to the flags
471 /// The effective combined mask used by this class and any wrapped classes if the flags are
478 * Wrapper around base class constructor. These take the flags as their first
481 * \param flags initial flags
484 constexpr Flagged(Flag flags, Args... args)
486 // we construct the base class first and apply the flags afterwards as
487 // base class may not have a constructor that takes flags even if it is derived from
489 setFlags(flags);
498 /** Gets the flags. */
499 Flag constexpr flags() const {
503 /** Sets the flags. */
504 void setFlags(Flag flags) {
505 this->setFlagsHelper(sFlagMask, sFlagShift, flags);