+ xo-printable2 + build fixes for cmake config
This commit is contained in:
parent
fcde0a4eb3
commit
d459fa5a39
2 changed files with 47 additions and 26 deletions
|
|
@ -1,17 +1,17 @@
|
|||
/* ppdetail_atomic.hpp
|
||||
/** @file ppdetail_atomic.hpp
|
||||
*
|
||||
* author: Roland Conybeare, Jul 2025
|
||||
*/
|
||||
* @author Roland Conybeare, Jul 2025
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ppindentinfo.hpp"
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
|
||||
namespace xo {
|
||||
namespace print {
|
||||
struct ppstate; // see pretty.hpp
|
||||
struct ppindentinfo;
|
||||
|
||||
// Defining this means ppdetail_atomic -> ppdetail.
|
||||
// For debugging suppress the #define; causes specialization of ppdetail_atomic to be required for every T
|
||||
|
|
@ -22,28 +22,6 @@ namespace xo {
|
|||
//
|
||||
#define ppdetail_atomic ppdetail
|
||||
|
||||
struct ppindentinfo {
|
||||
ppindentinfo(ppstate * pps, std::uint32_t ci0, std::uint32_t indent_width, bool upto)
|
||||
: pps_{pps}, ci0_{ci0}, ci1_{ci0 + indent_width}, upto_{upto} {}
|
||||
|
||||
ppstate * pps() const { return pps_; }
|
||||
std::uint32_t ci0_unused() const { return ci0_; }
|
||||
std::uint32_t ci1() const { return ci1_; }
|
||||
bool upto() const { return upto_; }
|
||||
|
||||
private:
|
||||
ppstate * pps_ = nullptr;
|
||||
/** current indent **/
|
||||
std::uint32_t ci0_ = 0;
|
||||
/** ci0 +1 indent level **/
|
||||
std::uint32_t ci1_ = 0;
|
||||
/**
|
||||
* true -> print on remainder of current line, unless past right margin
|
||||
* false -> pretty across across multiple lines
|
||||
**/
|
||||
bool upto_;
|
||||
};
|
||||
|
||||
/** @class ppdetail
|
||||
* @brief template for opt-in to pretty-printer
|
||||
*
|
||||
|
|
|
|||
43
include/xo/indentlog/print/ppindentinfo.hpp
Normal file
43
include/xo/indentlog/print/ppindentinfo.hpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/** @file ppindentinfo.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jul 2025
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace xo {
|
||||
namespace print {
|
||||
struct ppstate;
|
||||
|
||||
/** @class ppindentinfo
|
||||
* @brief pretty-printing state passed down the stack while traversing object graph
|
||||
**/
|
||||
struct ppindentinfo {
|
||||
ppindentinfo(ppstate * pps, std::uint32_t ci0, std::uint32_t indent_width, bool upto)
|
||||
: pps_{pps}, ci0_{ci0}, ci1_{ci0 + indent_width}, upto_{upto} {}
|
||||
|
||||
ppstate * pps() const { return pps_; }
|
||||
std::uint32_t ci0_unused() const { return ci0_; }
|
||||
std::uint32_t ci1() const { return ci1_; }
|
||||
bool upto() const { return upto_; }
|
||||
|
||||
private:
|
||||
/** pretty-printing state. flyweight. See [xo/indentlog/print/pretty.hpp] **/
|
||||
ppstate * pps_ = nullptr;
|
||||
/** current indent **/
|
||||
std::uint32_t ci0_ = 0;
|
||||
/** ci0 +1 indent level **/
|
||||
std::uint32_t ci1_ = 0;
|
||||
/**
|
||||
* true -> print on remainder of current line, unless past right margin
|
||||
* false -> pretty across across multiple lines
|
||||
**/
|
||||
bool upto_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* end ppindentinfo.hpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue