本文整理汇总了C++中LINE_READER::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ LINE_READER::Length方法的具体用法?C++ LINE_READER::Length怎么用?C++ LINE_READER::Length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LINE_READER
的用法示例。
在下文中一共展示了LINE_READER::Length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
bool LIB_FIELD::Load( LINE_READER& aLineReader, wxString& errorMsg )
{
int cnt;
char textOrient;
char textVisible;
char textHJustify;
char textVJustify[256];
char* line = (char*) aLineReader;
char* limit = line + aLineReader.Length();
if( sscanf( line + 1, "%d", &m_id ) != 1 || m_id < 0 )
{
errorMsg = wxT( "invalid field header" );
return false;
}
// Caller did a strtok(), which inserts a nul, so next few bytes are ugly:
// digit(s), a nul, some whitespace, then a double quote.
while( line < limit && *line != '"' )
line++;
if( line == limit )
return false;
line += ReadDelimitedText( &m_Text, line );
// Doctor the *.lib file field which has a "~" in blank fields. New saves will
// not save like this, and eventually these two lines can be removed.
if( m_Text.size()==1 && m_Text[0]==wxChar( '~' ) )
m_Text.clear();
memset( textVJustify, 0, sizeof( textVJustify ) );
cnt = sscanf( line, " %d %d %d %c %c %c %s", &m_Pos.x, &m_Pos.y, &m_Size.y,
&textOrient, &textVisible, &textHJustify, textVJustify );
if( cnt < 5 )
{
errorMsg.Printf( wxT( "field %d does not have the correct number of parameters" ),
m_id );
return false;
}
m_Size.x = m_Size.y;
if( textOrient == 'H' )
m_Orient = TEXT_ORIENT_HORIZ;
else if( textOrient == 'V' )
m_Orient = TEXT_ORIENT_VERT;
else
{
errorMsg.Printf( wxT( "field %d text orientation parameter <%c> is not valid" ),
textOrient );
return false;
}
if( textVisible == 'V' )
m_Attributs &= ~TEXT_NO_VISIBLE;
else if ( textVisible == 'I' )
m_Attributs |= TEXT_NO_VISIBLE;
else
{
errorMsg.Printf( wxT( "field %d text visible parameter <%c> is not valid" ),
textVisible );
return false;
}
m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
if( cnt >= 6 )
{
if( textHJustify == 'C' )
m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
else if( textHJustify == 'L' )
m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
else if( textHJustify == 'R' )
m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
else
{
errorMsg.Printf(
wxT( "field %d text horizontal justification parameter <%c> is not valid" ),
textHJustify );
return false;
}
if( textVJustify[0] == 'C' )
m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
else if( textVJustify[0] == 'B' )
m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
else if( textVJustify[0] == 'T' )
m_VJustify = GR_TEXT_VJUSTIFY_TOP;
else
{
errorMsg.Printf(
wxT( "field %d text vertical justification parameter <%c> is not valid" ),
textVJustify[0] );
return false;
}
//.........这里部分代码省略.........