CIRCT  19.0.0git
Public Member Functions | Private Types | Private Attributes | List of all members
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 >:
Inheritance graph
[legend]
Collaboration diagram for circt::pretty::TokenStreamWithCallback< CallableType, DataType, PPTy >:
Collaboration graph
[legend]

Public Member Functions

 TokenStreamWithCallback (PPTy &pp, PrintEventAndStorageListener< CallableType, DataType > &saver, bool enableCallback)
 
void addCallback (DataType d)
 Add a Callback token. More...
 
- Public Member Functions inherited from circt::pretty::TokenStream< PrettyPrinter >
 TokenStream (PrettyPrinter &pp, TokenStringSaver &saver)
 Create a TokenStream using the specified PrettyPrinter and StringSaver storage. More...
 
TokenStreamoperator<< (const char *s)
 Add a string literal (external storage). More...
 
TokenStreamoperator<< (StringRef s)
 Add a string token (saved to storage). More...
 
TokenStreamoperator<< (const PPExtString &str)
 String has external storage. More...
 
TokenStreamoperator<< (const PPSaveString &str)
 String must be saved. More...
 
TokenStreamoperator<< (PP s)
 Convenience for inline streaming of builder methods. More...
 
TokenStreamoperator<< (Token t)
 Stream support for user-created Token's. More...
 
TokenStreamaddAsString (T &&t)
 General-purpose "format this" helper, for types not supported by operator<< yet. More...
 
auto invokeWithStringOS (Callable &&c)
 Helper to invoke code with a llvm::raw_ostream argument for compatibility. More...
 
TokenStreamwriteEscaped (StringRef str, bool useHexEscapes=false)
 Write escaped versions of the string, saved in storage. More...
 
TokenStreamwriteQuotedEscaped (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. More...
 
- 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. More...
 
void addToken (Token t)
 
void eof ()
 End of a stream. More...
 
void literal (StringRef str)
 Add a literal (with external storage). More...
 
void nbsp ()
 Add a non-breaking space. More...
 
void nbsp (unsigned n)
 Add multiple non-breaking spaces as a single token. More...
 
void neverbreak ()
 Add a 'neverbreak' break. Always 'fits'. More...
 
void newline ()
 Add a newline (break too wide to fit, always breaks). More...
 
void spaces (uint32_t n)
 Add breakable spaces. More...
 
void space ()
 Add a breakable space. More...
 
void zerobreak ()
 Add a break that is zero-wide if not broken. More...
 
void bbox (int32_t offset=0, Breaks breaks=Breaks::Consistent)
 Start a IndentStyle::Block group with specified offset. More...
 
void cbox (int32_t offset=0, IndentStyle style=IndentStyle::Visual)
 Start a consistent group with specified offset. More...
 
void ibox (int32_t offset=0, IndentStyle style=IndentStyle::Visual)
 Start an inconsistent group with specified offset. More...
 
void neverbox ()
 Start a group that cannot break, including nested groups. More...
 
void end ()
 End a group. More...
 

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 >
TokenStringSaversaver
 

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

Definition at line 385 of file PrettyPrinterHelpers.h.

Member Function Documentation

◆ addCallback()

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

Member Data Documentation

◆ enableCallback

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

◆ saver

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

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