本文整理汇总了C++中IsoString::Break方法的典型用法代码示例。如果您正苦于以下问题:C++ IsoString::Break方法的具体用法?C++ IsoString::Break怎么用?C++ IsoString::Break使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IsoString
的用法示例。
在下文中一共展示了IsoString::Break方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Open
ImageDescriptionArray JPEGInstance::Open( const String& filePath, const IsoString& hints )
{
Close();
try
{
Exception::EnableConsoleOutput();
JPEGImageOptions jpegOptions = JPEGFormat::DefaultOptions();
IsoStringList theHints;
hints.Break( theHints, ' ', true/*trim*/ );
theHints.Remove( IsoString() );
for ( IsoStringList::const_iterator i = theHints.Begin(); i < theHints.End(); ++i )
if ( *i == "verbosity" )
{
if ( ++i == theHints.End() )
break;
int n;
if ( i->TryToInt( n ) )
jpegOptions.verbosity = Range( n, 0, 3 );
}
m_reader = new JPEGReader;
m_reader->SetJPEGOptions( jpegOptions );
m_reader->Open( filePath );
return ImageDescriptionArray() << ImageDescription( m_reader->Info(), m_reader->Options() );
}
catch ( ... )
{
Close();
throw;
}
}
示例2: getFormattedNumber
String PropertyUtils::getFormattedNumber( String numberStr, IsoString numberFormat )
{
if ( numberStr.IsEmpty() )
return numberStr;
size_t im = numberFormat.Find( 'm' );
if ( im == String::notFound )
return String().Format( numberFormat.c_str(), stringToFloatSafe( numberStr ) );
numberFormat.DeleteRight( im );
numberFormat.DeleteLeft( 1 );
StringList tokens;
numberFormat.Break( tokens, '.', true/*trim*/ );
size_t fraction = stringToIntSafe( tokens[1] );
size_t width = stringToIntSafe( tokens[0] ) - fraction;
assert( width > 0 );
int hours = Trunc( stringToFloatSafe( numberStr ) );
switch ( fraction )
{
case 3:
{
int minutes = Trunc( (stringToFloatSafe( numberStr ) - hours)*60 );
IsoString formatStr = '%' + IsoString().Format( "%dd",width ) + ":%02d";
return String().Format( formatStr.c_str(), hours, Abs( minutes ) );
}
case 5:
{
int minutes = Trunc( (stringToFloatSafe( numberStr ) - hours)*60 );
int minutesfrac = Trunc( ((stringToFloatSafe( numberStr ) - hours)*60 - minutes)*10);
IsoString formatStr = '%' + IsoString().Format( "%dd", width ) + ":%02d.%d";
return String().Format( formatStr.c_str(), hours, Abs( minutes ), Abs( minutesfrac ) );
}
case 6:
{
int minutes = Trunc( (stringToFloatSafe( numberStr ) - hours)*60 );
int seconds = Trunc( ((stringToFloatSafe( numberStr ) - hours)*60 - minutes)*60 );
IsoString formatStr = '%' + IsoString().Format( "%dd", width ) + ":%02d:%02d";
return String().Format( formatStr.c_str(), hours, Abs( minutes ), Abs( seconds ) );
}
case 8:
{
int minutes = Trunc( (stringToFloatSafe( numberStr ) - hours)*60 );
int seconds = Trunc( ((stringToFloatSafe( numberStr ) - hours)*60 - minutes)*60 );
int secondsfrac = Trunc( (((stringToFloatSafe( numberStr ) - hours)*60 - minutes)*60 - seconds)*10 );
IsoString formatStr = '%' + IsoString().Format( "%dd", width ) + ":%02d:%02d.%d";
return String().Format( formatStr.c_str(), hours, Abs( minutes ), Abs( seconds ), Abs( secondsfrac ) );
}
case 9:
{
int minutes = Trunc( (stringToFloatSafe( numberStr ) - hours)*60 );
int seconds = Trunc( ((stringToFloatSafe( numberStr ) - hours)*60 - minutes)*60 );
int secondsfrac = Trunc( (((stringToFloatSafe( numberStr ) - hours)*60 - minutes)*60 - seconds)*100 );
IsoString formatStr = '%' + IsoString().Format( "%dd", width ) + ":%02d:%02d.%02d";
return String().Format( formatStr.c_str(), hours, Abs( minutes ), Abs( seconds ), Abs( secondsfrac ) );
}
default:
return String();
}
}
示例3: FromSource
Filter Filter::FromSource( const IsoString& src )
{
IsoStringList lines;
src.Break( lines, '\n' );
FilterParser P( lines );
if ( P.Filters().IsEmpty() )
return Filter();
return P.Filters()[0];
}
示例4: Create
void JPEGInstance::Create( const String& filePath, int numberOfImages, const IsoString& hints )
{
Close();
Exception::EnableConsoleOutput();
m_writer = new JPEGWriter;
m_writer->Create( filePath );
JPEGImageOptions jpegOptions = JPEGFormat::DefaultOptions();
IsoStringList theHints;
hints.Break( theHints, ' ', true/*trim*/ );
theHints.Remove( IsoString() );
for ( IsoStringList::const_iterator i = theHints.Begin(); i < theHints.End(); ++i )
{
if ( *i == "quality" )
{
if ( ++i == theHints.End() )
break;
int q = jpegOptions.quality;
if ( i->TryToInt( q ) )
jpegOptions.quality = Range( q, 0, 100 );
}
else if ( *i == "optimized" )
jpegOptions.optimizedCoding = true;
else if ( *i == "no-optimized" )
jpegOptions.optimizedCoding = false;
else if ( *i == "arithmetic" )
jpegOptions.arithmeticCoding = true;
else if ( *i == "huffman" )
jpegOptions.arithmeticCoding = false;
else if ( *i == "progressive" )
jpegOptions.progressive = true;
else if ( *i == "no-progressive" )
jpegOptions.progressive = false;
else if ( *i == "verbosity" )
{
if ( ++i == theHints.End() )
break;
int n;
if ( i->TryToInt( n ) )
jpegOptions.verbosity = Range( n, 0, 3 );
}
}
m_writer->SetJPEGOptions( jpegOptions );
}
示例5: Aliases
IsoStringList ProcessParameter::Aliases() const
{
size_type len = 0;
(*API->Process->GetParameterAliasIdentifiers)( m_data->handle, 0, &len );
IsoStringList aliases;
if ( len > 0 )
{
IsoString csAliases;
csAliases.SetLength( len );
if ( (*API->Process->GetParameterAliasIdentifiers)( m_data->handle, csAliases.c_str(), &len ) == api_false )
throw APIFunctionError( "GetParameterAliasIdentifiers" );
csAliases.ResizeToNullTerminated();
csAliases.Break( aliases, ',' );
}
return aliases;
}
示例6: EnumerationElements
ProcessParameter::enumeration_element_list ProcessParameter::EnumerationElements() const
{
if ( !IsEnumeration() )
return enumeration_element_list();
size_type count = (*API->Process->GetParameterElementCount)( m_data->handle );
if ( count == 0 )
throw APIFunctionError( "GetParameterElementCount" );
enumeration_element_list elements( count );
for ( size_type i = 0; i < count; ++i )
{
size_type len = 0;
(*API->Process->GetParameterElementIdentifier)( m_data->handle, i, 0, &len );
if ( len == 0 )
throw APIFunctionError( "GetParameterElementIdentifier" );
elements[i].id.SetLength( len );
if ( (*API->Process->GetParameterElementIdentifier)( m_data->handle, i, elements[i].id.c_str(), &len ) == api_false )
throw APIFunctionError( "GetParameterElementIdentifier" );
elements[i].id.ResizeToNullTerminated();
len = 0;
(*API->Process->GetParameterElementAliasIdentifiers)( m_data->handle, i, 0, &len );
if ( len > 0 )
{
IsoString aliases;
aliases.SetLength( len );
if ( (*API->Process->GetParameterElementAliasIdentifiers)( m_data->handle, i, aliases.c_str(), &len ) == api_false )
throw APIFunctionError( "GetParameterElementAliasIdentifiers" );
aliases.ResizeToNullTerminated();
aliases.Break( elements[i].aliases, ',' );
}
elements[i].value = (*API->Process->GetParameterElementValue)( m_data->handle, i );
}
return elements;
}
示例7: Create
void JPCInstance::Create( const String& filePath, int/*numberOfImages*/, const IsoString& hints )
{
Close();
Exception::EnableConsoleOutput();
m_path = filePath;
IsoStringList theHints;
hints.Break( theHints, ' ', true/*trim*/ );
theHints.Remove( IsoString() );
for ( IsoStringList::const_iterator i = theHints.Begin(); i < theHints.End(); ++i )
{
if ( *i == "lossy" )
m_jp2Options.lossyCompression = true;
else if ( *i == "lossless" )
m_jp2Options.lossyCompression = false;
else if ( *i == "compression-rate" )
{
if ( ++i == theHints.End() )
break;
if ( i->TryToFloat( m_jp2Options.compressionRate ) )
m_jp2Options.compressionRate = Range( m_jp2Options.compressionRate, 0.01F, 0.99F );
}
else if ( *i == "signed" )
m_jp2Options.signedSample = true;
else if ( *i == "unsigned" )
m_jp2Options.signedSample = false;
else if ( *i == "tiled" )
m_jp2Options.tiledImage = true;
else if ( *i == "untiled" )
m_jp2Options.tiledImage = true;
else if ( *i == "tile-width" )
{
if ( ++i == theHints.End() )
break;
if ( i->TryToInt( m_jp2Options.tileWidth ) )
m_jp2Options.tileWidth = Range( m_jp2Options.tileWidth, 16, 8192 );
}
else if ( *i == "tile-height" )
{
if ( ++i == theHints.End() )
break;
if ( i->TryToInt( m_jp2Options.tileHeight ) )
m_jp2Options.tileHeight = Range( m_jp2Options.tileHeight, 16, 8192 );
}
else if ( *i == "layers" )
{
if ( ++i == theHints.End() )
break;
if ( i->TryToInt( m_jp2Options.numberOfLayers ) )
m_jp2Options.numberOfLayers = Range( m_jp2Options.numberOfLayers, 1, 10 );
}
else if ( *i == "lrcp" )
m_jp2Options.progressionOrder = JPEG2000ProgressionOrder::LRCP;
else if ( *i == "rlcp" )
m_jp2Options.progressionOrder = JPEG2000ProgressionOrder::RLCP;
else if ( *i == "rpcl" )
m_jp2Options.progressionOrder = JPEG2000ProgressionOrder::RPCL;
else if ( *i == "pcrl" )
m_jp2Options.progressionOrder = JPEG2000ProgressionOrder::PCRL;
else if ( *i == "cprl" )
m_jp2Options.progressionOrder = JPEG2000ProgressionOrder::CPRL;
}
}