本文整理汇总了C++中OUTPUTFORMATTER类的典型用法代码示例。如果您正苦于以下问题:C++ OUTPUTFORMATTER类的具体用法?C++ OUTPUTFORMATTER怎么用?C++ OUTPUTFORMATTER使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OUTPUTFORMATTER类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Save
bool LIB_FIELD::Save( OUTPUTFORMATTER& aFormatter )
{
int hjustify, vjustify;
wxString text = m_Text;
hjustify = 'C';
if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
hjustify = 'L';
else if( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
hjustify = 'R';
vjustify = 'C';
if( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
vjustify = 'B';
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
vjustify = 'T';
/* Dick 24-May-2013:
What the hell is this?. There was no comment here.
Hell no. You don't want this in the *.lib files, it is crap. Fields get read
back in and they have a tilda in them.
if( text.IsEmpty() )
text = wxT( "~" );
*/
aFormatter.Print( 0, "F%d %s %d %d %d %c %c %c %c%c%c",
m_id,
EscapedUTF8( text ).c_str(), // wraps in quotes
m_Pos.x, m_Pos.y, m_Size.x,
m_Orient == 0 ? 'H' : 'V',
(m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V',
hjustify, vjustify,
m_Italic ? 'I' : 'N',
m_Bold ? 'B' : 'N' );
/* Save field name, if necessary
* Field name is saved only if it is not the default name.
* Just because default name depends on the language and can change from
* a country to an other
*/
wxString defName = TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id );
if( m_id >= FIELD1 && !m_name.IsEmpty() && m_name != defName )
aFormatter.Print( 0, " %s", EscapedUTF8( m_name ).c_str() );
aFormatter.Print( 0, "\n" );
return true;
}
示例2: Save
bool LIB_POLYLINE::Save( OUTPUTFORMATTER& aFormatter )
{
int ccount = GetCornerCount();
aFormatter.Print( 0, "P %d %d %d %d", ccount, m_Unit, m_Convert, m_Width );
for( unsigned i = 0; i < GetCornerCount(); i++ )
{
aFormatter.Print( 0, " %d %d", m_PolyPoints[i].x, m_PolyPoints[i].y );
}
aFormatter.Print( 0, " %c\n", fill_tab[m_Fill] );
return true;
}
示例3: Save
bool LIB_RECTANGLE::Save( OUTPUTFORMATTER& aFormatter )
{
aFormatter.Print( 0, "S %d %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y,
m_End.x, m_End.y, m_Unit, m_Convert, m_Width, fill_tab[m_Fill] );
return true;
}
示例4: Save
bool LIB_CIRCLE::Save( OUTPUTFORMATTER& aFormatter )
{
aFormatter.Print( 0, "C %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y,
m_Radius, m_Unit, m_Convert, m_Width, fill_tab[m_Fill] );
return true;
}
示例5: Save
bool LIB_FIELD::Save( OUTPUTFORMATTER& aFormatter )
{
int hjustify, vjustify;
wxString text = m_Text;
hjustify = 'C';
if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
hjustify = 'L';
else if( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
hjustify = 'R';
vjustify = 'C';
if( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
vjustify = 'B';
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
vjustify = 'T';
aFormatter.Print( 0, "F%d %s %d %d %d %c %c %c %c%c%c",
m_id,
EscapedUTF8( text ).c_str(), // wraps in quotes
m_Pos.x, m_Pos.y, m_Size.x,
m_Orient == 0 ? 'H' : 'V',
(m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V',
hjustify, vjustify,
m_Italic ? 'I' : 'N',
m_Bold ? 'B' : 'N' );
/* Save field name, if necessary
* Field name is saved only if it is not the default name.
* Just because default name depends on the language and can change from
* a country to an other
*/
wxString defName = TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id );
if( m_id >= FIELD1 && !m_name.IsEmpty() && m_name != defName )
aFormatter.Print( 0, " %s", EscapedUTF8( m_name ).c_str() );
aFormatter.Print( 0, "\n" );
return true;
}
示例6: printToolSummary
unsigned GENDRILL_WRITER_BASE::printToolSummary( OUTPUTFORMATTER& out, bool aSummaryNPTH ) const
{
unsigned totalHoleCount = 0;
for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ )
{
const DRILL_TOOL& tool = m_toolListBuffer[ii];
if( aSummaryNPTH && !tool.m_Hole_NotPlated )
continue;
if( !aSummaryNPTH && tool.m_Hole_NotPlated )
continue;
// List the tool number assigned to each drill,
// in mm then in inches.
int tool_number = ii+1;
out.Print( 0, " T%d %2.2fmm %2.3f\" ", tool_number,
diameter_in_mm( tool.m_Diameter ),
diameter_in_inches( tool.m_Diameter ) );
// Now list how many holes and ovals are associated with each drill.
if( ( tool.m_TotalCount == 1 ) && ( tool.m_OvalCount == 0 ) )
out.Print( 0, "(1 hole)\n" );
else if( tool.m_TotalCount == 1 )
out.Print( 0, "(1 hole) (with 1 slot)\n" );
else if( tool.m_OvalCount == 0 )
out.Print( 0, "(%d holes)\n", tool.m_TotalCount );
else if( tool.m_OvalCount == 1 )
out.Print( 0, "(%d holes) (with 1 slot)\n", tool.m_TotalCount );
else // tool.m_OvalCount > 1
out.Print( 0, "(%d holes) (with %d slots)\n",
tool.m_TotalCount, tool.m_OvalCount );
totalHoleCount += tool.m_TotalCount;
}
out.Print( 0, "\n" );
return totalHoleCount;
}
示例7: formatCoordinate
void WORKSHEET_LAYOUT_IO::formatCoordinate( const char * aToken,
POINT_COORD & aCoord ) const
throw( IO_ERROR )
{
m_out->Print( 0, " (%s %s %s", aToken,
double2Str( aCoord.m_Pos.x ).c_str(),
double2Str( aCoord.m_Pos.y ).c_str() );
switch( aCoord.m_Anchor )
{
case RB_CORNER:
break;
case LT_CORNER:
m_out->Print( 0, " %s", getTokenName(T_ltcorner ) );
break;
case LB_CORNER:
m_out->Print( 0, " %s", getTokenName(T_lbcorner ) );
break;
case RT_CORNER:
m_out->Print( 0, " %s", getTokenName(T_rtcorner ) );
break;
}
m_out->Print( 0, ")" );
}
示例8: format
void WORKSHEET_LAYOUT_IO::format( WORKSHEET_DATAITEM_BITMAP* aItem, int aNestLevel ) const
throw( IO_ERROR )
{
m_out->Print( aNestLevel, "( %s", getTokenName( T_bitmap ) );
m_out->Print( 0, " (%s %s)", getTokenName( T_name ),
m_out->Quotew( aItem->m_Name ).c_str() );
formatCoordinate( getTokenName( T_pos ), aItem->m_Pos );
formatOptions( aItem );
m_out->Print( 0, " (%s %s)", getTokenName( T_scale ),
double2Str(aItem->m_ImageBitmap->m_Scale ).c_str() );
formatRepeatParameters( aItem );
m_out->Print( 0,"\n");
// Write image in png readable format
m_out->Print( aNestLevel, "( %s\n", getTokenName( T_pngdata ) );
wxArrayString pngStrings;
aItem->m_ImageBitmap->SaveData( pngStrings );
for( unsigned ii = 0; ii < pngStrings.GetCount(); ii++ )
m_out->Print( aNestLevel+1, "(data \"%s\")\n", TO_UTF8(pngStrings[ii]) );
m_out->Print( aNestLevel+1, ")\n" );
m_out->Print( aNestLevel, ")\n" );
}
示例9: formatRepeatParameters
void WORKSHEET_LAYOUT_IO::formatRepeatParameters( WORKSHEET_DATAITEM* aItem ) const
throw( IO_ERROR )
{
if( aItem->m_RepeatCount <= 1 )
return;
m_out->Print( 0, " (repeat %d)", aItem->m_RepeatCount );
if( aItem->m_IncrementVector.x )
m_out->Print( 0, " (incrx %s)", double2Str(aItem-> m_IncrementVector.x ).c_str() );
if( aItem->m_IncrementVector.y )
m_out->Print( 0, " (incry %s)", double2Str( aItem->m_IncrementVector.y ).c_str() );
if( aItem->m_IncrementLabel != 1 &&
aItem->GetType() == WORKSHEET_DATAITEM::WS_TEXT )
m_out->Print( 0, " (incrlabel %d)", aItem->m_IncrementLabel );
}
示例10: formatOptions
void WORKSHEET_LAYOUT_IO::formatOptions( WORKSHEET_DATAITEM* aItem ) const
throw( IO_ERROR )
{
switch( aItem->GetPage1Option() )
{
default:
case 0:
break;
case 1:
m_out->Print( 0, " (%s %s)", getTokenName(T_option ),
getTokenName(T_page1only ) );
break;
case -1:
m_out->Print( 0, " (%s %s)", getTokenName(T_option ),
getTokenName(T_notonpage1 ) );
break;
}
}
示例11: Format
void WORKSHEET_LAYOUT_IO::Format( WORKSHEET_LAYOUT* aPageLayout ) const
throw( IO_ERROR )
{
LOCALE_IO toggle; // switch on/off the locale "C" notation
m_out->Print( 0, "( page_layout\n" );
// Setup
int nestLevel = 1;
// Write default values:
m_out->Print( nestLevel, "(%s", getTokenName( T_setup ) );
m_out->Print( 0, "(textsize %s %s)",
double2Str( WORKSHEET_DATAITEM::m_DefaultTextSize.x ).c_str(),
double2Str( WORKSHEET_DATAITEM::m_DefaultTextSize.y ).c_str() );
m_out->Print( 0, "(linewidth %s)", double2Str( WORKSHEET_DATAITEM::m_DefaultLineWidth ).c_str() );
m_out->Print( 0, "(textlinewidth %s)", double2Str( WORKSHEET_DATAITEM::m_DefaultTextThickness ).c_str() );
m_out->Print( 0, "\n" );
// Write margin values
m_out->Print( nestLevel, "(%s %s)", getTokenName( T_left_margin ),
double2Str( aPageLayout->GetLeftMargin() ).c_str() );
m_out->Print( 0, "(%s %s)", getTokenName( T_right_margin ),
double2Str( aPageLayout->GetRightMargin() ).c_str() );
m_out->Print( 0, "(%s %s)", getTokenName( T_top_margin ),
double2Str( aPageLayout->GetTopMargin() ).c_str() );
m_out->Print( 0, "(%s %s)", getTokenName( T_bottom_margin ),
double2Str( aPageLayout->GetBottomMargin() ).c_str() );
m_out->Print( 0, ")\n" );
// Save the graphical items on the page layout
for( unsigned ii = 0; ii < aPageLayout->GetCount(); ii++ )
{
WORKSHEET_DATAITEM* item = aPageLayout->GetItem( ii );
Format( item, nestLevel );
}
m_out->Print( 0, ")\n" );
}