xo-umbrella2/xo-indentlog/include/xo/indentlog/print/ppconfig.hpp
Roland Conybeare 966c3903e1 git subrepo clone git@github.com:Rconybea/xo-indentlog.git xo-indentlog
subrepo:
  subdir:   "xo-indentlog"
  merged:   "0834c6ad"
upstream:
  origin:   "git@github.com:Rconybea/xo-indentlog.git"
  branch:   "main"
  commit:   "0834c6ad"
git-subrepo:
  version:  "0.4.9"
  origin:   "???"
  commit:   "???"
2026-06-06 21:30:17 -04:00

52 lines
1.5 KiB
C++

/* @file ppconfig.hpp
*
* author: Roland Conybeare, Jul 2025
*/
#pragma once
#include <cstdint>
namespace xo {
namespace print {
/** @class ppconfig
* @brief hold pretty-printer control parameters
*
* Need one read-only instance of this to invoke pretty printer
**/
struct ppconfig {
/** @defgroup ppconfig-ctors ppconfig constructors **/
///@{
/** config to use pretty printer in degenerate form:
* In this form right margin is absurdly far away,
* so should not be forced to use multiple lines.
*
* Note this won't prevent a printer from returning -1
**/
static inline ppconfig ugly() {
return ppconfig { .right_margin_ = 99999999, .indent_width_ = 0, .assert_indent_threshold = 10 };
}
///@}
/** @defgroup ppconfig-instance-vars ppconfig instance variables **/
///@{
/** max line length.
* Pretty-printer will introduce newlines if needed
* to stay to the left of this margin
**/
std::uint32_t right_margin_ = 80;
/** amount of additional indent per nesting level **/
std::uint32_t indent_width_ = 2;
/** assert if attempting this much indent **/
std::uint32_t assert_indent_threshold = 10000;
///@}
};
} /*namespace print*/
} /*namespace xo*/