flags.cpp 807 B

1234567891011121314151617181920212223242526272829
  1. #include "flags.h"
  2. #include <util/stream/format.h>
  3. #include <util/system/yassert.h>
  4. void ::NPrivate::PrintFlags(IOutputStream& stream, ui64 value, size_t size) {
  5. /* Note that this function is in cpp because we need to break circular
  6. * dependency between TFlags and ENumberFormat. */
  7. stream << "TFlags(";
  8. switch (size) {
  9. case 1:
  10. stream << Bin(static_cast<ui8>(value), HF_FULL);
  11. break;
  12. case 2:
  13. stream << Bin(static_cast<ui16>(value), HF_FULL);
  14. break;
  15. case 4:
  16. stream << Bin(static_cast<ui32>(value), HF_FULL);
  17. break;
  18. case 8:
  19. stream << Bin(static_cast<ui64>(value), HF_FULL);
  20. break;
  21. default:
  22. Y_ABORT_UNLESS(false);
  23. }
  24. stream << ")";
  25. }