本文整理汇总了C++中String::Break方法的典型用法代码示例。如果您正苦于以下问题:C++ String::Break方法的具体用法?C++ String::Break怎么用?C++ String::Break使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::Break方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FromString
bool FileDataCacheItem::FromString( const String& s )
{
path.Clear();
lastUsed = 0;
time.year = 0;
StringList tokens;
s.Break( tokens, char16_type( '\n' ) );
for ( StringList::const_iterator i = tokens.Begin(); i != tokens.End(); )
{
if ( *i == "path" )
{
if ( ++i == tokens.End() )
return false;
path = i->Trimmed();
++i;
}
else if ( *i == "lastUsed" )
{
if ( ++i == tokens.End() )
return false;
lastUsed = i->ToUInt();
++i;
}
else if ( *i == "time" )
{
if ( tokens.End() - i < 3 )
return false;
int y, m, d; double f;
JDToComplexTime( y, m, d, f, i[1].ToUInt()+0.5 );
unsigned t = i[2].ToUInt();
time.year = y;
time.month = m;
time.day = d;
time.milliseconds = t - 86399000;
time.hour = TruncI( (t = TruncI( t/1000.0 ))/3600.0 );
time.minute = TruncI( (t -= time.hour*3600)/60.0 );
time.second = t - time.minute*60;
i += 3;
}
else if ( *i == "data" )
{
if ( !GetDataFromTokens( tokens ) )
return false;
++i;
}
else
{
++i;
}
}
return !path.IsEmpty() && lastUsed > 0 && time.year > 0 && ValidateData();
}
示例2: setRACoords
void EditEqCoordPropertyDialog::setRACoords(String value){
StringList tokens;
value.Break(tokens,':',true);
assert(tokens.Length()==3);
tokens[0].TrimLeft();
RA_Hour_Edit.SetText(tokens[0]);
RA_Minute_Edit.SetText(tokens[1]);
RA_Second_Edit.SetText(tokens[2]);
m_ra_hour=tokens[0].ToDouble();
m_ra_minute=tokens[1].ToDouble();
m_ra_second=tokens[2].ToDouble();
double coord_ra=m_ra_hour + m_ra_minute / 60 + m_ra_second / 3600;
m_RA_TargetCoord = String(coord_ra);
}
示例3: setDECCoords
void EditEqCoordPropertyDialog::setDECCoords(String value){
StringList tokens;
value.Break(tokens,':',true);
assert(tokens.Length()==3);
tokens[0].TrimLeft();
DEC_Hour_Edit.SetText(tokens[0]);
DEC_Minute_Edit.SetText(tokens[1]);
DEC_Second_Edit.SetText(tokens[2]);
m_dec_deg=tokens[0].ToDouble();
m_dec_arcminute=tokens[1].ToDouble();
m_dec_arcsecond=tokens[2].ToDouble();
int sign=m_dec_deg >= 0 ? 1 : -1;
double coord_dec=sign * (fabs(m_dec_deg) + m_dec_arcminute / 60 + m_dec_arcsecond / 3600);
m_DEC_TargetCoord = String(coord_dec);
}
示例4: LoadFiltersFromGlobalString
void LoadFiltersFromGlobalString( const IsoString& globalKey )
{
filters.Clear();
String s = PixInsightSettings::GlobalString( globalKey );
if ( !s.IsEmpty() )
{
for ( size_type p = 0; ; )
{
size_type p1 = s.Find( '(', p );
if ( p1 == String::notFound )
break;
size_type p2 = s.Find( ')', p1 );
if ( p2 == String::notFound )
break;
String extStr = s.Substring( p1, p2-p1 );
if ( !extStr.IsEmpty() )
{
StringList extLst;
extStr.Break( extLst, ' ', true );
if ( !extLst.IsEmpty() )
{
FileFilter filter;
for ( StringList::const_iterator i = extLst.Begin(); i != extLst.End(); ++i )
{
size_type d = i->Find( '.' );
if ( d != String::notFound )
filter.AddExtension( i->Substring( d ) );
}
if ( !filter.Extensions().IsEmpty() )
{
String desc = s.Substring( p, p1-p );
desc.Trim();
filter.SetDescription( desc );
filters.Add( filter );
}
}
}
p = p2 + 1;
}
}
}