Public Member Functions | Private Member Functions | Private Attributes | List of all members
spdlog::details::scoped_pad Class Reference

#include <pattern_formatter.h>

Public Member Functions

 scoped_pad (size_t wrapped_size, padding_info &padinfo, fmt::memory_buffer &dest)
 
 scoped_pad (spdlog::string_view_t txt, padding_info &padinfo, fmt::memory_buffer &dest)
 
 ~scoped_pad ()
 

Private Member Functions

void pad_it (size_t count)
 

Private Attributes

const padding_infopadinfo_
 
fmt::memory_bufferdest_
 
size_t total_pad_
 
string_view_t spaces_
 

Detailed Description

Definition at line 53 of file pattern_formatter.h.

Constructor & Destructor Documentation

spdlog::details::scoped_pad::scoped_pad ( size_t  wrapped_size,
padding_info padinfo,
fmt::memory_buffer dest 
)
inline

Definition at line 56 of file pattern_formatter.h.

57  : padinfo_(padinfo)
58  , dest_(dest)
59  {
60 
61  if (padinfo_.width_ <= wrapped_size)
62  {
63  total_pad_ = 0;
64  return;
65  }
66 
67  total_pad_ = padinfo.width_ - wrapped_size;
69  {
71  total_pad_ = 0;
72  }
74  {
75  auto half_pad = total_pad_ / 2;
76  auto reminder = total_pad_ & 1;
77  pad_it(half_pad);
78  total_pad_ = half_pad + reminder; // for the right side
79  }
80  }
const padding_info & padinfo_
fmt::memory_buffer & dest_
spdlog::details::scoped_pad::scoped_pad ( spdlog::string_view_t  txt,
padding_info padinfo,
fmt::memory_buffer dest 
)
inline

Definition at line 82 of file pattern_formatter.h.

83  : scoped_pad(txt.size(), padinfo, dest)
84  {
85  }
scoped_pad(size_t wrapped_size, padding_info &padinfo, fmt::memory_buffer &dest)
spdlog::details::scoped_pad::~scoped_pad ( )
inline

Definition at line 87 of file pattern_formatter.h.

88  {
89  if (total_pad_)
90  {
92  }
93  }

Member Function Documentation

void spdlog::details::scoped_pad::pad_it ( size_t  count)
inlineprivate

Definition at line 96 of file pattern_formatter.h.

97  {
98  // count = std::min(count, spaces_.size());
99  assert(count <= spaces_.size());
101  }
void append_string_view(spdlog::string_view_t view, fmt::basic_memory_buffer< char, Buffer_Size > &dest)
Definition: fmt_helper.h:30
fmt::memory_buffer & dest_
fmt::string_view string_view_t
Definition: common.h:88

Member Data Documentation

fmt::memory_buffer& spdlog::details::scoped_pad::dest_
private

Definition at line 104 of file pattern_formatter.h.

const padding_info& spdlog::details::scoped_pad::padinfo_
private

Definition at line 103 of file pattern_formatter.h.

string_view_t spdlog::details::scoped_pad::spaces_
private
Initial value:
{" "
" ",
128}

Definition at line 106 of file pattern_formatter.h.

size_t spdlog::details::scoped_pad::total_pad_
private

Definition at line 105 of file pattern_formatter.h.


The documentation for this class was generated from the following file: