本文整理汇总了C++中PrintContext类的典型用法代码示例。如果您正苦于以下问题:C++ PrintContext类的具体用法?C++ PrintContext怎么用?C++ PrintContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PrintContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doPrint
void MemberAccessOperator::doPrint(PrintContext &context) const {
bool braces = compound()->is<UnaryOperator>() ||
compound()->is<BinaryOperator>() ||
compound()->is<Typecast>();
if (braces) {
context.out() << "(";
}
compound_->print(context);
if (braces) {
context.out() << ")";
}
switch (accessKind()) {
case ARROW:
context.out() << "->";
break;
case DOT:
context.out() << '.';
break;
default:
unreachable();
break;
}
context.out() << member_->identifier();
}
示例2: draw_page
static void draw_page(GtkPrintOperation* op, GtkPrintContext* context, gint page_nr, gpointer user_data)
{
PrintContext* printContext = reinterpret_cast<PrintContext*>(user_data);
cairo_t* cr = gtk_print_context_get_cairo_context(context);
GraphicsContext ctx(cr);
float width = gtk_print_context_get_width(context);
printContext->spoolPage(ctx, page_nr, width);
}
示例3: doPrint
void IntegerConstant::doPrint(PrintContext &context) const {
SignedConstantValue val = value().size() > 1 ? value().signedValue() : value().value();
if ((0 <= val && val <= 100) || (-100 <= val && val < 0 && !type()->isUnsigned())) {
context.out() << val;
} else {
context.out() << hex << "0x" << value().value() << dec;
}
}
示例4: doPrint
void Typecast::doPrint(PrintContext &context) const {
context.out() << '(' << *type() << ')';
bool braces = operand()->is<BinaryOperator>();
if (braces) {
context.out() << '(';
}
operand()->print(context);
if (braces) {
context.out() << ')';
}
}
示例5: doPrint
void UnaryOperator::doPrint(PrintContext &context) const {
switch (operatorKind()) {
case DEREFERENCE:
context.out() << '*';
break;
case REFERENCE:
context.out() << '&';
break;
case BITWISE_NOT:
context.out() << '~';
break;
case LOGICAL_NOT:
context.out() << '!';
break;
case NEGATION:
context.out() << '-';
break;
case PREFIX_INCREMENT:
context.out() << "++";
break;
case PREFIX_DECREMENT:
context.out() << "--";
break;
default:
unreachable();
break;
}
int precedence = this->precedence();
int operandPrecedence = operand()->precedence();
int absPrecedence = abs(precedence);
int absOperandPrecedence = abs(operandPrecedence);
bool operandInBraces = absOperandPrecedence > absPrecedence;
/* Avoid too many minuses in a row. */
if (operatorKind() == NEGATION || operatorKind() == PREFIX_DECREMENT) {
if (auto unary = operand()->as<UnaryOperator>()) {
if (unary->operatorKind() == NEGATION || unary->operatorKind() == PREFIX_DECREMENT) {
operandInBraces = true;
}
}
}
if (operandInBraces) {
context.out() << '(';
}
operand()->print(context);
if (operandInBraces) {
context.out() << ')';
}
}
示例6: begin_print_callback
static void begin_print_callback(GtkPrintOperation* op, GtkPrintContext* context, gpointer user_data)
{
PrintContext* printContext = reinterpret_cast<PrintContext*>(user_data);
float width = gtk_print_context_get_width(context);
float height = gtk_print_context_get_height(context);
FloatRect printRect = FloatRect(0, 0, width, height);
printContext->begin(width);
// TODO: Margin adjustments and header/footer support
float headerHeight = 0;
float footerHeight = 0;
float pageHeight; // height of the page adjusted by margins
printContext->computePageRects(printRect, headerHeight, footerHeight, 1.0, pageHeight);
gtk_print_operation_set_n_pages(op, printContext->pageCount());
}
示例7: printSignature
void FunctionDeclaration::printSignature(PrintContext &context) const {
context.out() << *type()->returnType() << ' ';
functionIdentifier()->print(context);
context.out() << '(';
bool comma = false;
foreach (const auto &argument, arguments_) {
if (comma) {
context.out() << ", ";
} else {
comma = true;
}
argument->print(context);
}
if (type()->variadic()) {
if (comma) {
context.out() << ", ";
}
context.out() << "...";
}
context.out() << ')';
}
示例8: doPrint
void ExpressionStatement::doPrint(PrintContext &context) const {
expression_->print(context);
context.out() << ';';
}
示例9: GrindOutPrintJob
int CLabelView::GrindOutPrintJob(PrintContext& pc)
{
/*
// Print our document(s).
*/
CLabelPrintDialog* pDialog = (CLabelPrintDialog*)pc.m_pPD;
CPmwDoc* pDoc = GetDocument();
pDialog->ComputeTotals();
/* Extract the name list. */
CStdMacroServer* pMacroServer = pDoc->GetMacroServer();
NameListRecord* pNameList = pMacroServer->GetNameList();
BOOL fMergePrint = FALSE;
int nNames = pNameList->Names();
int nTotalPages = pDialog->m_nTotalPages;
int nError = FALSE;
BOOL fOldShow = pMacroServer->ShowMacroValues();
StorageFile* pDatabaseFile = NULL;
CFlatFileDatabase* pDatabase = NULL;
CFlatFileDatabaseCursor* pCursor = NULL;
if (GetConfiguration()->SupportsAddressBook(FALSE))
{
// get sender values for address book.
pMacroServer->BindSender();
}
if (!fOldShow)
{
pMacroServer->ShowMacroValues(TRUE);
pDoc->ReflowMacros();
}
pc.m_pCursor = NULL;
PPNT dims = pDoc->get_dimensions();
pc.m_source.x0 = 0;
pc.m_source.y0 = 0;
pc.m_source.x1 = dims.x;
pc.m_source.y1 = dims.y;
/*
// Set the printing conditions.
*/
pc.m_nBoundName = -1;
pc.m_nCurrentName = (nNames == 0) ? -1 : 0;
pc.m_nCurrentCopy = 0;
CString csFullName;
TRY
{
csFullName = pDoc->GetPathManager()->LocatePath(pNameList->AddressBookName());
TRACE("Open database %s for data!\r\n", (LPCSTR)csFullName);
if (nNames != 0)
{
ERRORCODE Error = CAddressBook::OpenAddressBookDatabase(csFullName, pDatabaseFile, pDatabase, FALSE);
if (Error != ERRORCODE_None)
{
ThrowErrorcodeException(Error);
}
// Create a cursor on the database.
pCursor = new CFlatFileDatabaseCursor;
pCursor->Attach(pDatabase);
pc.m_pCursor = pCursor;
}
int nFromPage = pc.m_pInfo->GetFromPage();
int nToPage = pc.m_pInfo->GetToPage();
int nError = 0;
pc.SaveStartOfBand();
for (;;)
{
if (pc.m_fDoubleSided && (nFromPage != nToPage))
{
//
// 1. Put up the dialog telling the user we are about to begin.
//
CPmwDialog BeginDialog(IDD_DOUBLE_SIDED_BEGIN);
if (BeginDialog.DoModal() != IDOK)
{
nError = -1;
break;
}
//.........这里部分代码省略.........
示例10: doPrint
void While::doPrint(PrintContext &context) const {
context.out() << "while (";
condition()->print(context);
context.out() << ") ";
printNestedStatement(body(), context);
}
示例11: doPrint
void LabelIdentifier::doPrint(PrintContext &context) const {
context.out() << declaration_->identifier();
}
示例12: doPrint
void FunctionDeclaration::doPrint(PrintContext &context) const {
printComment(context);
printSignature(context);
context.out() << ';';
}
示例13: doPrint
void InlineAssembly::doPrint(PrintContext &context) const {
context.out() << "__asm__(\"" << code() << "\")";
}
示例14: doPrint
void Goto::doPrint(PrintContext &context) const {
context.out() << "goto ";
destination_->print(context);
context.out() << ';';
}
示例15: probe_object_header
static void probe_object_header(const char *name)
{
if (octx.print_object_header)
octx.print_object_header(name);
probe_group_enter(name, OBJECT);
}