本文整理汇总了C++中DataTargetRef::getFilePathHint方法的典型用法代码示例。如果您正苦于以下问题:C++ DataTargetRef::getFilePathHint方法的具体用法?C++ DataTargetRef::getFilePathHint怎么用?C++ DataTargetRef::getFilePathHint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataTargetRef
的用法示例。
在下文中一共展示了DataTargetRef::getFilePathHint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
std::unique_ptr<TargetFile> TargetFile::create( const DataTargetRef &dataTarget, size_t sampleRate, size_t numChannels, SampleType sampleType, const std::string &extension )
{
#if ! defined( CINDER_WINRT ) || ( _MSC_VER > 1800 )
std::string ext = dataTarget->getFilePathHint().extension().string();
#else
std::string ext = dataTarget->getFilePathHint().extension();
#endif
ext = ( ( ! ext.empty() ) && ( ext[0] == '.' ) ) ? ext.substr( 1, string::npos ) : ext;
#if defined( CINDER_COCOA )
return std::unique_ptr<TargetFile>( new cocoa::TargetFileCoreAudio( dataTarget, sampleRate, numChannels, sampleType, ext ) );
#elif defined( CINDER_MSW ) || defined( CINDER_WINRT )
return std::unique_ptr<TargetFile>( new msw::TargetFileMediaFoundation( dataTarget, sampleRate, numChannels, sampleType, ext ) );
#endif
}
示例2: getPathExtension
std::unique_ptr<TargetFile> TargetFile::create( const DataTargetRef &dataTarget, size_t sampleRate, size_t numChannels, const std::string &extension )
{
std::string ext = ( ! extension.empty() ? extension : getPathExtension( dataTarget->getFilePathHint() ) );
#if defined( CINDER_COCOA )
return std::unique_ptr<TargetFile>( new cocoa::TargetFileCoreAudio( dataTarget, sampleRate, numChannels, ext ) );
#elif defined( CINDER_MSW )
return std::unique_ptr<TargetFile>(); // TODO
// return std::unique_ptr<TargetFile>( new msw::TargetFileMediaFoundation( dataTarget, sampleRate, numChannels, ext ) );
#endif
}
示例3: writeImage
void writeImage( DataTargetRef dataTarget, const ImageSourceRef &imageSource, ImageTarget::Options options, string extension )
{
#if defined( CINDER_COCOA ) // this is necessary to limit the lifetime of the objc-based loader's allocations
cocoa::SafeNsAutoreleasePool autorelease;
#endif
if( extension.empty() )
extension = getPathExtension( dataTarget->getFilePathHint() );
ImageTargetRef imageTarget = ImageIoRegistrar::createTarget( dataTarget, imageSource, options, extension );
if( imageTarget ) {
writeImage( imageTarget, imageSource );
}
else
throw ImageIoExceptionUnknownExtension();
}