CIRCT 24.0.0git
Loading...
Searching...
No Matches
circt::pretty::TokenStreamWithCallback< CallableType, DataType, PPTy > Class Template Reference

Wrap the TokenStream with a helper for CallbackTokens, to record the print events on the stream. More...

#include <PrettyPrinterHelpers.h>

Inheritance diagram for circt::pretty::TokenStreamWithCallback< CallableType, DataType, PPTy >:
Collaboration diagram for circt::pretty::TokenStreamWithCallback< CallableType, DataType, PPTy >:

Public Member Functions

 TokenStreamWithCallback (PPTy &pp, PrintEventAndStorageListener< CallableType, DataType > &saver, bool enableCallback)
void addCallback (DataType d)
 Add a Callback token.
Public Member Functions inherited from circt::pretty::TokenStream< PrettyPrinter >
 TokenStream (PrettyPrinter &pp, TokenStringSaver &saver)
 Create a TokenStream using the specified PrettyPrinter and StringSaver storage.
TokenStream & operator<< (const char *s)
 Add a string literal (external storage).
TokenStream & addAsString (T &&t)
 General-purpose "format this" helper, for types not supported by operator<< yet.
auto invokeWithStringOS (Callable &&c)
 Helper to invoke code with a llvm::raw_ostream argument for compatibility.
TokenStream & writeEscaped (StringRef str, bool useHexEscapes=false)
 Write escaped versions of the string, saved in storage.
TokenStream & writeQuotedEscaped (StringRef str, bool useHexEscapes=false, StringRef left="\"", StringRef right="\"")
auto scopedBox (T &&t, Callable &&c, Token close=EndToken())
 Open a box, invoke the lambda, and close it after.
Public Member Functions inherited from circt::pretty::TokenBuilder< PrettyPrinter >
 TokenBuilder (PrettyPrinter &pp)
std::enable_if_t< std::is_base_of_v< Token, T > > add (Args &&...args)
 Add new token.
void addToken (Token t)
void eof ()
 End of a stream.
void literal (StringRef str)
 Add a literal (with external storage).
void nbsp ()
 Add a non-breaking space.
void neverbreak ()
 Add a 'neverbreak' break. Always 'fits'.
void newline ()
 Add a newline (break too wide to fit, always breaks).
void spaces (uint32_t n)
 Add breakable spaces.
void space ()
 Add a breakable space.
void zerobreak ()
 Add a break that is zero-wide if not broken.
void bbox (int32_t offset=0, Breaks breaks=Breaks::Consistent)
 Start a IndentStyle::Block group with specified offset.
void cbox (int32_t offset=0, IndentStyle style=IndentStyle::Visual)
 Start a consistent group with specified offset.
void ibox (int32_t offset=0, IndentStyle style=IndentStyle::Visual)
 Start an inconsistent group with specified offset.
void neverbox ()
 Start a group that cannot break, including nested groups.
void end ()
 End a group.

Private Types

using Base = TokenStream<PPTy>

Private Attributes

PrintEventAndStorageListener< CallableType, DataType > & saver
const bool enableCallback

Additional Inherited Members

Protected Attributes inherited from circt::pretty::TokenStream< PrettyPrinter >
TokenStringSaver & saver

Detailed Description

template<typename CallableType, typename DataType, typename PPTy = PrettyPrinter>
class circt::pretty::TokenStreamWithCallback< CallableType, DataType, PPTy >

Wrap the TokenStream with a helper for CallbackTokens, to record the print events on the stream.

Definition at line 378 of file PrettyPrinterHelpers.h.

Member Typedef Documentation

◆ Base

template<typename CallableType, typename DataType, typename PPTy = PrettyPrinter>
using circt::pretty::TokenStreamWithCallback< CallableType, DataType, PPTy >::Base = TokenStream<PPTy>
private

Definition at line 379 of file PrettyPrinterHelpers.h.

Constructor & Destructor Documentation

◆ TokenStreamWithCallback()

template<typename CallableType, typename DataType, typename PPTy = PrettyPrinter>
circt::pretty::TokenStreamWithCallback< CallableType, DataType, PPTy >::TokenStreamWithCallback ( PPTy & pp,
PrintEventAndStorageListener< CallableType, DataType > & saver,
bool enableCallback )
inline

Member Function Documentation

◆ addCallback()

template<typename CallableType, typename DataType, typename PPTy = PrettyPrinter>
void circt::pretty::TokenStreamWithCallback< CallableType, DataType, PPTy >::addCallback ( DataType d)
inline

Add a Callback token.

Definition at line 391 of file PrettyPrinterHelpers.h.

References circt::pretty::TokenBuilder< PPTy >::addToken(), enableCallback, and saver.

Member Data Documentation

◆ enableCallback

template<typename CallableType, typename DataType, typename PPTy = PrettyPrinter>
const bool circt::pretty::TokenStreamWithCallback< CallableType, DataType, PPTy >::enableCallback
private

Definition at line 382 of file PrettyPrinterHelpers.h.

Referenced by addCallback(), and TokenStreamWithCallback().

◆ saver

template<typename CallableType, typename DataType, typename PPTy = PrettyPrinter>
PrintEventAndStorageListener<CallableType, DataType>& circt::pretty::TokenStreamWithCallback< CallableType, DataType, PPTy >::saver
private

Definition at line 380 of file PrettyPrinterHelpers.h.

Referenced by addCallback(), and TokenStreamWithCallback().


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