本文整理汇总了C++中ON_String::SetLength方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_String::SetLength方法的具体用法?C++ ON_String::SetLength怎么用?C++ ON_String::SetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_String
的用法示例。
在下文中一共展示了ON_String::SetLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ON_Base32ToString
bool ON_Base32ToString( const ON_SimpleArray<unsigned char>& base32_digits, ON_String& sBase32 )
{
int digit_count = base32_digits.Count();
sBase32.ReserveArray(digit_count);
sBase32.SetLength(digit_count);
bool rc = ON_Base32ToString( base32_digits, digit_count, sBase32.Array() );
if (!rc)
sBase32.SetLength(0);
return rc;
}
示例2: ON_CorrectBase32StringTypos
int ON_CorrectBase32StringTypos( const char* sBase32, ON_String& sBase32clean )
{
char* sClean = 0;
if ( sBase32 == sBase32clean.Array() )
sClean = sBase32clean.Array();
else
{
sBase32clean.SetLength(0);
sBase32clean.ReserveArray(strlen(sBase32));
sClean = sBase32clean.Array();
}
int length = ON_CorrectBase32StringTypos( sBase32, sClean );
sBase32clean.SetLength(length);
return length;
}
示例3: main
//.........这里部分代码省略.........
// read the contents of the file into "model"
bool rc = model.Read( archive, dump );
// close the file
ON::CloseFile( archive_fp );
// print diagnostic
if ( rc )
dump->Print("Successfully read.\n");
else
dump->Print("Errors during reading.\n");
// see if everything is in good shape
if ( model.IsValid(dump) )
dump->Print("Model is valid.\n");
else
{
model.Polish();
if ( model.IsValid() )
{
dump->Print("Model is valid after calling Polish().\n");
}
else
{
dump->Print("Model is not valid.\n");
}
}
/*
int oi = 14;
if ( oi >=0 && oi < model.m_object_table.Count() )
{
dump->Print("m_object_table[%d].m_object:\n",oi);
dump->PushIndent();
model.m_object_table[oi].m_object->Dump(*dump);
dump->PopIndent();
}
*/
int version = 0; // write current Rhino file
ON_String outfile = sFileName;
int len = outfile.Length() - 4;
outfile.SetLength(len);
outfile += "_roundtrip.3dm";
bool outrc = model.Write( outfile, version, "roundtrip", dump );
if ( outrc )
{
dump->Print("model.Write(%s) succeeded.\n",outfile.Array());
ONX_Model model2;
if ( model2.Read( outfile, dump ) )
{
dump->Print("model2.Read(%s) succeeded.\n",outfile.Array());
if ( model2.IsValid(dump) )
{
dump->Print("Model2 is valid.\n");
}
else
{
dump->Print("Model2 is not valid.\n");
}
/*
if ( oi >=0 && oi < model2.m_object_table.Count() )
{
dump->Print("m_object_table[%d].m_object:\n",oi);
dump->PushIndent();
model2.m_object_table[oi].m_object->Dump(*dump);
dump->PopIndent();
}
*/
}
else
{
dump->Print("model2.Read(%s) failed.\n",outfile.Array());
}
}
else
dump->Print("model.Write(%s) failed.\n",outfile.Array());
// destroy this model
model.Destroy();
dump->PopIndent();
}
if ( dump_fp )
{
// close the text dump file
delete dump;
ON::CloseFile( dump_fp );
}
// OPTIONAL: Call just before your application exits to clean
// up opennurbs class definition information.
// Opennurbs will not work correctly after ON::End()
// is called.
ON::End();
return 0;
}