LLDB mainline
IOStreamMacros.h
Go to the documentation of this file.
1//===-- IOStreamMacros.h ----------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef liblldb_IOStreamMacros_h_
10#define liblldb_IOStreamMacros_h_
11#if defined(__cplusplus)
12
13#include <iomanip>
14
15#define RAW_HEXBASE std::setfill('0') << std::hex << std::right
16#define HEXBASE '0' << 'x' << RAW_HEXBASE
17#define RAWHEX8(x) RAW_HEXBASE << std::setw(2) << ((uint32_t)(x))
18#define RAWHEX16 RAW_HEXBASE << std::setw(4)
19#define RAWHEX32 RAW_HEXBASE << std::setw(8)
20#define RAWHEX64 RAW_HEXBASE << std::setw(16)
21#define HEX8(x) HEXBASE << std::setw(2) << ((uint32_t)(x))
22#define HEX16 HEXBASE << std::setw(4)
23#define HEX32 HEXBASE << std::setw(8)
24#define HEX64 HEXBASE << std::setw(16)
25#define RAW_HEX(x) RAW_HEXBASE << std::setw(sizeof(x) * 2) << (x)
26#define HEX(x) HEXBASE << std::setw(sizeof(x) * 2) << (x)
27#define HEX_SIZE(x, sz) HEXBASE << std::setw((sz)) << (x)
28#define STRING_WIDTH(w) std::setfill(' ') << std::setw(w)
29#define LEFT_STRING_WIDTH(s, w) \
30 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) <<
34//std::setprecision(d) << std::showpoint << std::fixed
35#define INDENT_WITH_SPACES(iword_idx) \
36 std::setfill(' ') << std::setw((iword_idx)) << ""
37#define INDENT_WITH_TABS(iword_idx) \
38 std::setfill('\t') << std::setw((iword_idx)) << ""
39
40#endif // #if defined(__cplusplus)
41#endif // liblldb_IOStreamMacros_h_