本文整理汇总了C++中ON_BinaryArchive::ReadShort方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_BinaryArchive::ReadShort方法的具体用法?C++ ON_BinaryArchive::ReadShort怎么用?C++ ON_BinaryArchive::ReadShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_BinaryArchive
的用法示例。
在下文中一共展示了ON_BinaryArchive::ReadShort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Default
ON_BOOL32 ON_3dmObjectAttributes::Read( ON_BinaryArchive& file )
{
Default();
if ( file.Archive3dmVersion() >= 5
&& file.ArchiveOpenNURBSVersion() >= 200712190 )
{
return ReadV5Helper(file);
}
int i;
int major_version = 0;
int minor_version = 0;
bool rc = file.Read3dmChunkVersion(&major_version,&minor_version);
if ( rc && major_version == 1 )
{
if (rc) rc = file.ReadUuid(m_uuid);
if (rc) rc = file.ReadInt(&m_layer_index);
if (rc) rc = file.ReadInt(&m_material_index);
if (rc) rc = file.ReadColor(m_color);
while(rc)
{
// OBSOLETE if (rc) rc = file.ReadLineStyle(m_line_style); // 23 March 2005 Dale Lear
// replaced with
short s = 0;
double x;
rc = file.ReadShort(&s);
if (!rc) break;
if ( file.Archive3dmVersion() < 4 || file.ArchiveOpenNURBSVersion() < 200503170 )
{
// ignore unused linestyle info in old files
// This bit keeps the curve arrowheads from V3 showing up
// in V4.
m_object_decoration = ON::ObjectDecoration( (s & ON::both_arrowhead) );
}
rc = file.ReadShort(&s);
if (!rc) break;
rc = file.ReadDouble(&x);
if (!rc) break;
rc = file.ReadDouble(&x);
break;
}
if (rc) rc = file.ReadInt(&m_wire_density);
if (rc) rc = file.ReadChar(&m_mode);
if (rc) rc = file.ReadChar(&m_color_source);
if (rc) m_color_source = (unsigned char)ON::ObjectColorSource(m_color_source);
if (rc) rc = file.ReadChar(&m_linetype_source);
if (rc) m_linetype_source = (unsigned char)ON::ObjectLinetypeSource(m_linetype_source);
if (rc) rc = file.ReadChar(&m_material_source);
if (rc) m_material_source = (unsigned char)ON::ObjectMaterialSource(m_material_source);
if (rc) rc = file.ReadString(m_name);
if (rc) rc = file.ReadString(m_url);
m_bVisible = (Mode() != ON::hidden_object);
if ( rc && minor_version >= 1 )
{
rc = file.ReadArray( m_group );
if ( rc && minor_version >= 2 )
{
rc = file.ReadBool(&m_bVisible);
if ( rc && minor_version >= 3 )
{
rc = file.ReadArray(m_dmref);
if (rc && minor_version >= 4 )
{
// 23 March 2005 Dale Lear
// Added m_plot_color_source and m_plot_color
i = 0;
if (rc) rc = file.ReadInt(&i);
if (rc) m_object_decoration = ON::ObjectDecoration(i);
if (rc) rc = file.ReadChar(&m_plot_color_source);
if (rc) m_plot_color_source = (unsigned char)ON::PlotColorSource(m_plot_color_source);
if (rc) rc = file.ReadColor( m_plot_color );
if (rc) rc = file.ReadChar(&m_plot_weight_source);
if (rc) m_plot_weight_source = (unsigned char)ON::PlotWeightSource(m_plot_weight_source);
if (rc) rc = file.ReadDouble(&m_plot_weight_mm);
if (rc && minor_version >= 5 )
{
// version 1.5 fields 11 April 2005
if (rc) rc = file.ReadInt(&m_linetype_index);
// version 1.6 fields 2 September 2005
if (rc && minor_version >= 6 )
{
unsigned char uc = 0;
rc = file.ReadChar(&uc);
if (rc)
{
m_space = (1 == uc) ? ON::page_space : ON::model_space;
m_dmref.Empty();
int i, count=0;
rc = file.ReadInt(&count);
//.........这里部分代码省略.........
示例2: Read
ON_BOOL32 ON_Font::Read(
ON_BinaryArchive& file // restore definition from binary archive
)
{
Defaults();
m_font_index = -1;
int major_version = 0;
int minor_version = 0;
bool rc = file.Read3dmChunkVersion(&major_version,&minor_version);
if ( rc && major_version == 1 )
{
int i;
for(;;)
{
rc = file.ReadInt( &m_font_index );
if (!rc) break;
rc = file.ReadString( m_font_name );
if (!rc) break;
{
// 18 October 2002 Dale Lear:
// Lowell, wchar_t has different sizes on different OSs.
// When writing a wchar_t string, you should use one
// of the WriteString functions. This function must continue
// to use ReadShort(64,...) so old files will remain valid.
unsigned short sh[64];
rc = file.ReadShort(64, sh);
if (!rc) break;
wchar_t facename[65];
for ( i = 0; i < 64; i++ )
{
facename[i] = sh[i];
}
facename[64] = 0;
SetFontFaceName(facename);
}
if( minor_version >= 1 )
{
rc = file.ReadInt( &i );
if (!rc) break;
SetFontWeight(i);
rc = file.ReadInt( &i);
if (!rc) break;
SetIsItalic(i?true:false);
rc = file.ReadDouble( &m_linefeed_ratio );
if (!rc) break;
if ( minor_version >= 2 )
{
rc = file.ReadUuid( m_font_id );
if (!rc) break;
}
//if ( minor_version >= 3 )
//{
// rc = file.ReadInt( &i);
// if (!rc) break;
// SetUnderlined(i?true:false);
//}
}
break;
}
}
else
{
ON_ERROR("ON_Font::Read - get newer version of opennurbs");
rc = false;
}
return rc;
}
示例3: Read
BOOL ON_Layer::Read(
ON_BinaryArchive& file // restore definition from binary archive
)
{
int obsolete_value1 = 0; // see ON_Layer::Write
int major_version=0;
int minor_version=0;
int mode = ON::normal_layer;
Default();
BOOL rc = file.Read3dmChunkVersion(&major_version,&minor_version);
if ( rc && major_version == 1 )
{
// common to all 1.x formats
if ( rc ) rc = file.ReadInt( &mode );
if ( rc )
{
switch(mode)
{
case 0: // OBSOLETE ON::normal_layer
m_bVisible = true;
m_bLocked = false;
break;
case 1: // OBSOLETE ON::hidden_layer
m_bVisible = false;
m_bLocked = false;
break;
case 2: // OBSOLETE ON::locked_layer
m_bVisible = true;
m_bLocked = true;
break;
default:
m_bVisible = true;
m_bLocked = false;
break;
}
}
if ( rc ) rc = file.ReadInt( &m_layer_index );
if ( rc ) rc = file.ReadInt( &m_iges_level );
if ( rc ) rc = file.ReadInt( &m_material_index );
if ( rc ) rc = file.ReadInt( &obsolete_value1 );
if ( rc ) rc = file.ReadColor( m_color );
{
// OBSOLETE line style was never used - read and discard the next 20 bytes
short s;
double x;
if (rc) file.ReadShort(&s);
if (rc) file.ReadShort(&s);
if (rc) file.ReadDouble(&x);
if (rc) file.ReadDouble(&x);
}
if ( rc ) rc = file.ReadString( m_name );
if ( rc && minor_version >= 1 )
{
rc = file.ReadBool(&m_bVisible);
if ( rc && minor_version >= 2 )
{
rc = file.ReadInt( &m_linetype_index);
if (rc && minor_version >= 3 )
{
// 23 March 2005 Dale Lear
rc = file.ReadColor( m_plot_color);
if (rc) rc = file.ReadDouble( &m_plot_weight_mm);
if (rc && minor_version >= 4 )
{
rc = file.ReadBool(&m_bLocked);
if (rc && minor_version >= 5 )
{
rc = file.ReadUuid(m_layer_id);
if ( rc
&& minor_version >= 6
&& file.ArchiveOpenNURBSVersion() > 200505110
)
{
// Some files saved with opennurbs version 200505110
// do not contain correctly written m_parent_layer_id
// and m_bExpanded values.
// It is ok to default these values.
rc = file.ReadUuid(m_parent_layer_id);
if (rc)
rc = file.ReadBool(&m_bExpanded);
}
if ( rc && minor_version >= 7 )
{
// 1.7 field - added 6 June 2006
rc = m_rendering_attributes.Read(file);
if ( rc && minor_version >= 8 )
{
// 1.8 field - added 19 Sep 2006
rc = file.ReadUuid(m_display_material_id);
}
}
}
}
}
//.........这里部分代码省略.........