本文整理汇总了C++中LINE_READER::LineNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ LINE_READER::LineNumber方法的具体用法?C++ LINE_READER::LineNumber怎么用?C++ LINE_READER::LineNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LINE_READER
的用法示例。
在下文中一共展示了LINE_READER::LineNumber方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
bool SCH_LABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
char Name1[256];
char Name2[256];
char Name3[256];
int thickness = 0, size = 0, orient = 0;
Name1[0] = 0; Name2[0] = 0; Name3[0] = 0;
char* sline = (char*) aLine;
while( ( *sline != ' ' ) && *sline )
sline++;
// sline points the start of parameters
int ii = sscanf( sline, "%s %d %d %d %d %s %s %d", Name1, &m_Pos.x, &m_Pos.y,
&orient, &size, Name2, Name3, &thickness );
if( ii < 4 )
{
aErrorMsg.Printf( wxT( "Eeschema file label load error at line %d" ),
aLine.LineNumber() );
return false;
}
if( !aLine.ReadLine() )
{
aErrorMsg.Printf( wxT( "Eeschema file label load error atline %d" ),
aLine.LineNumber() );
return false;
}
if( size == 0 )
size = DEFAULT_SIZE_TEXT;
char* text = strtok( (char*) aLine, "\n\r" );
if( text == NULL )
{
aErrorMsg.Printf( wxT( "Eeschema file label load error at line %d" ),
aLine.LineNumber() );
return false;
}
m_Text = FROM_UTF8( text );
m_Size.x = m_Size.y = size;
SetOrientation( orient );
if( isdigit( Name3[0] ) )
{
thickness = atol( Name3 );
m_Bold = ( thickness != 0 );
m_Thickness = m_Bold ? GetPenSizeForBold( size ) : 0;
}
if( stricmp( Name2, "Italic" ) == 0 )
m_Italic = 1;
return true;
}
示例2: Load
bool SCH_BUS_ENTRY_BASE::Load( LINE_READER& aLine, wxString& aErrorMsg,
SCH_ITEM **out )
{
char Name1[256];
char Name2[256];
char* line = (char*) aLine;
*out = NULL;
while( (*line != ' ' ) && *line )
line++;
if( sscanf( line, "%255s %255s", Name1, Name2 ) != 2 )
{
aErrorMsg.Printf( wxT( "Eeschema file bus entry load error at line %d" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false;
}
SCH_BUS_ENTRY_BASE *this_new;
if( Name1[0] == 'B' )
this_new = new SCH_BUS_BUS_ENTRY;
else
this_new = new SCH_BUS_WIRE_ENTRY;
*out = this_new;
if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ",
&this_new->m_pos.x, &this_new->m_pos.y,
&this_new->m_size.x, &this_new->m_size.y ) != 4 )
{
aErrorMsg.Printf( wxT( "Eeschema file bus entry load error at line %d" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false;
}
this_new->m_size.x -= this_new->m_pos.x;
this_new->m_size.y -= this_new->m_pos.y;
return true;
}
示例3: Load
bool SCH_BUS_ENTRY::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
char Name1[256];
char Name2[256];
char* line = (char*) aLine;
while( (*line != ' ' ) && *line )
line++;
if( sscanf( line, "%s %s", Name1, Name2 ) != 2 )
{
aErrorMsg.Printf( wxT( "Eeschema file bus entry load error at line %d" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false;
}
m_Layer = LAYER_WIRE;
if( Name1[0] == 'B' )
m_Layer = LAYER_BUS;
if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ", &m_pos.x, &m_pos.y,
&m_size.x, &m_size.y ) != 4 )
{
aErrorMsg.Printf( wxT( "Eeschema file bus entry load error at line %d" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false;
}
m_size.x -= m_pos.x;
m_size.y -= m_pos.y;
return true;
}
示例4: Load
bool SCH_BITMAP::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
char* line = aLine.Line();
if( strncasecmp( line, "$Bitmap", 7 ) != 0 )
{
aErrorMsg.Printf( wxT( "Eeschema file bitmap image load error at line %d, aborted" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false;
}
for( ; ; )
{
if( !aLine.ReadLine() )
return false;
line = aLine.Line();
if( strncasecmp( line, "Pos", 3 ) == 0 )
{
sscanf( line + 3, "%d %d", &m_pos.x, &m_pos.y );
continue;
}
if( strncasecmp( line, "Scale", 5 ) == 0 )
{
double scale = 1.0;
sscanf( line + 5, "%lf", &scale );
m_image->SetScale( scale );
continue;
}
if( strncasecmp( line, "Data", 4 ) == 0 )
{
m_image->LoadData( aLine, aErrorMsg );
}
if( strncasecmp( line, "$EndBitmap", 4 ) == 0 )
break;
}
return true;
}
示例5: Load
bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
int fieldNdx, size;
SCH_SHEET_PIN* sheetPin;
char* ptcar;
SetTimeStamp( GetNewTimeStamp() );
// sheets are added to the GetDrawItems() like other schematic components.
// however, in order to preserve the hierarchy (through m_Parent pointers),
// a duplicate of the sheet is added to m_SubSheet array.
// must be a duplicate, references just work for a two-layer structure.
// this is accomplished through the Sync() function.
if( ((char*)aLine)[0] == '$' ) // line should be "$Sheet"
{
if( !aLine.ReadLine() )
{
aErrorMsg.Printf( wxT( "Read File Error" ) );
return false;
}
}
/* Next line: must be "S xx yy nn mm" with xx, yy = sheet position
* ( upper left corner ) et nn,mm = sheet size */
if( ( sscanf( &((char*)aLine)[1], "%d %d %d %d",
&m_pos.x, &m_pos.y, &m_size.x, &m_size.y ) != 4 )
|| ( ((char*)aLine)[0] != 'S' ) )
{
aErrorMsg.Printf( wxT( " ** Eeschema file sheet struct error at line %d, aborted\n" ),
aLine.LineNumber() );
aErrorMsg << FROM_UTF8( ((char*)aLine) );
return false;
}
/* Read fields */
for( ; ; ) /* Analysis of lines "Fn" text. */
{
if( !aLine.ReadLine() )
return false;
if( ((char*)aLine)[0] == 'U' )
{
sscanf( ((char*)aLine) + 1, "%lX", &m_TimeStamp );
if( m_TimeStamp == 0 ) // zero is not unique!
SetTimeStamp( GetNewTimeStamp() );
continue;
}
if( ((char*)aLine)[0] != 'F' )
break;
sscanf( ((char*)aLine) + 1, "%d", &fieldNdx );
/* Read the field:
* If fieldNdx> = 2: Fn "text" t s posx posy
* If F0 "text" for SheetName
* F1 and "text" for filename
*/
ptcar = ((char*)aLine);
while( *ptcar && ( *ptcar != '"' ) )
ptcar++;
if( *ptcar != '"' )
{
aErrorMsg.Printf( wxT( "Eeschema file sheet label F%d at line %d, aborted\n" ),
fieldNdx, aLine.LineNumber() );
aErrorMsg << FROM_UTF8( (char*) aLine );
return false;
}
wxString sheetName;
ptcar += ReadDelimitedText( &sheetName, ptcar );
if( *ptcar == 0 )
{
aErrorMsg.Printf( wxT( "Eeschema file sheet field F at line %d, aborted\n" ),
aLine.LineNumber() );
aErrorMsg << FROM_UTF8( (char*) aLine );
return false;
}
if( ( fieldNdx == 0 ) || ( fieldNdx == 1 ) )
{
if( sscanf( ptcar, "%d", &size ) != 1 )
{
aErrorMsg.Printf( wxT( "Eeschema file sheet Label error line %d, aborted\n" ),
aLine.LineNumber() );
aErrorMsg << FROM_UTF8( (char*) aLine );
}
if( size == 0 )
size = DEFAULT_SIZE_TEXT;
if( fieldNdx == 0 )
{
m_name = sheetName;
//.........这里部分代码省略.........
示例6: Load
bool SCH_SHEET_PIN::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
int size;
char number[256];
char name[256];
char connectType[256];
char sheetSide[256];
char* line = aLine.Line();
char* cp;
static const char delims[] = " \t";
// Read coordinates.
// D( printf( "line: \"%s\"\n", line );)
cp = strtok( line, delims );
strncpy( number, cp, sizeof(number) );
number[sizeof(number)-1] = 0;
cp += strlen( number ) + 1;
cp += ReadDelimitedText( name, cp, sizeof(name) );
cp = strtok( cp, delims );
strncpy( connectType, cp, sizeof(connectType) );
connectType[sizeof(connectType)-1] = 0;
cp = strtok( NULL, delims );
strncpy( sheetSide, cp, sizeof(sheetSide) );
sheetSide[sizeof(sheetSide)-1] = 0;
cp += strlen( sheetSide ) + 1;
int r = sscanf( cp, "%d %d %d", &m_Pos.x, &m_Pos.y, &size );
if( r != 3 )
{
aErrorMsg.Printf( wxT( "Eeschema file sheet hierarchical label error at line %d.\n" ),
aLine.LineNumber() );
aErrorMsg << FROM_UTF8( line );
return false;
}
m_Text = FROM_UTF8( name );
if( size == 0 )
size = GetDefaultTextSize();
m_Size.x = m_Size.y = size;
switch( connectType[0] )
{
case 'I':
m_shape = NET_INPUT;
break;
case 'O':
m_shape = NET_OUTPUT;
break;
case 'B':
m_shape = NET_BIDI;
break;
case 'T':
m_shape = NET_TRISTATE;
break;
case 'U':
m_shape = NET_UNSPECIFIED;
break;
}
switch( sheetSide[0] )
{
case 'R' : /* pin on right side */
SetEdge( 1 );
break;
case 'T' : /* pin on top side */
SetEdge( 2 );
break;
case 'B' : /* pin on bottom side */
SetEdge( 3 );
break;
case 'L' : /* pin on left side */
default :
SetEdge( 0 );
break;
}
return true;
}
示例7: Load
bool SCH_TEXT::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
char Name1[256];
char Name2[256];
char Name3[256];
int thickness = 0, size = 0, orient = 0;
Name1[0] = 0; Name2[0] = 0; Name3[0] = 0;
char* sline = (char*) aLine;
while( ( *sline != ' ' ) && *sline )
sline++;
// sline points the start of parameters
int ii = sscanf( sline, "%255s %d %d %d %d %255s %255s %d", Name1, &m_Pos.x, &m_Pos.y,
&orient, &size, Name2, Name3, &thickness );
if( ii < 4 )
{
aErrorMsg.Printf( wxT( "Eeschema file text load error at line %d" ),
aLine.LineNumber() );
return false;
}
if( !aLine.ReadLine() )
{
aErrorMsg.Printf( wxT( "Eeschema file text load error at line %d" ),
aLine.LineNumber() );
return false;
}
if( size == 0 )
size = GetDefaultTextSize();
char* text = strtok( (char*) aLine, "\n\r" );
if( text == NULL )
{
aErrorMsg.Printf( wxT( "Eeschema file text load error at line %d" ),
aLine.LineNumber() );
return false;
}
wxString val = FROM_UTF8( text );
for( ; ; )
{
int i = val.find( wxT( "\\n" ) );
if( i == wxNOT_FOUND )
break;
val.erase( i, 2 );
val.insert( i, wxT( "\n" ) );
}
m_Text = val;
m_Size.x = m_Size.y = size;
SetOrientation( orient );
if( isdigit( Name3[0] ) )
{
thickness = atol( Name3 );
m_Bold = ( thickness != 0 );
m_Thickness = m_Bold ? GetPenSizeForBold( size ) : 0;
}
if( strnicmp( Name2, "Italic", 6 ) == 0 )
m_Italic = 1;
return true;
}