1 //===-- IOStreamMacros.h ----------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef liblldb_IOStreamMacros_h_ 11 #define liblldb_IOStreamMacros_h_ 12 #if defined(__cplusplus) 13 14 #include <iomanip> 15 16 #define RAW_HEXBASE std::setfill('0') << std::hex << std::right 17 #define HEXBASE '0' << 'x' << RAW_HEXBASE 18 #define RAWHEX8(x) RAW_HEXBASE << std::setw(2) << ((uint32_t)(x)) 19 #define RAWHEX16 RAW_HEXBASE << std::setw(4) 20 #define RAWHEX32 RAW_HEXBASE << std::setw(8) 21 #define RAWHEX64 RAW_HEXBASE << std::setw(16) 22 #define HEX8(x) HEXBASE << std::setw(2) << ((uint32_t)(x)) 23 #define HEX16 HEXBASE << std::setw(4) 24 #define HEX32 HEXBASE << std::setw(8) 25 #define HEX64 HEXBASE << std::setw(16) 26 #define RAW_HEX(x) RAW_HEXBASE << std::setw(sizeof(x)*2) << (x) 27 #define HEX(x) HEXBASE << std::setw(sizeof(x)*2) << (x) 28 #define HEX_SIZE(x, sz) HEXBASE << std::setw((sz)) << (x) 29 #define STRING_WIDTH(w) std::setfill(' ') << std::setw(w) 30 #define LEFT_STRING_WIDTH(s, w) std::left << std::setfill(' ') << std::setw(w) << (s) << std::right 31 #define DECIMAL std::dec << std::setfill(' ') 32 #define DECIMAL_WIDTH(w) DECIMAL << std::setw(w) 33 //#define FLOAT(n, d) std::setfill(' ') << std::setw((n)+(d)+1) << std::setprecision(d) << std::showpoint << std::fixed 34 #define INDENT_WITH_SPACES(iword_idx) std::setfill(' ') << std::setw((iword_idx)) << "" 35 #define INDENT_WITH_TABS(iword_idx) std::setfill('\t') << std::setw((iword_idx)) << "" 36 37 #endif // #if defined(__cplusplus) 38 #endif // liblldb_IOStreamMacros_h_ 39