当前位置: 首页>>代码示例>>C++>>正文


C++ BMimeType::GetLongDescription方法代码示例

本文整理汇总了C++中BMimeType::GetLongDescription方法的典型用法代码示例。如果您正苦于以下问题:C++ BMimeType::GetLongDescription方法的具体用法?C++ BMimeType::GetLongDescription怎么用?C++ BMimeType::GetLongDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BMimeType的用法示例。


在下文中一共展示了BMimeType::GetLongDescription方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: read

/*!
	Determines if the data in \a inSource is of the UTF8 plain

	\param data buffer containing data already read (must be at
		least DATA_BUFFER_SIZE bytes large)
	\param nread number of bytes that have already been read from the stream
	\param header the STXT stream header read in by Identify() or Translate()
	\param inSource the stream with the STXT data
	\param outInfo information about the type of data from inSource is stored here
	\param outType the desired output type for the data in inSource
*/
status_t
identify_text(uint8* data, int32 bytesRead, BPositionIO* source,
              translator_info* outInfo, uint32 outType, const char*& encoding)
{
    ssize_t readLater = source->Read(data + bytesRead, DATA_BUFFER_SIZE - bytesRead);
    if (readLater < B_OK)
        return B_NO_TRANSLATOR;

    bytesRead += readLater;

    // TODO: identify encoding as possible!
    BMimeType type;
    if (!file_ascmagic((const unsigned char*)data, bytesRead, &type, encoding))
        return B_NO_TRANSLATOR;

    float capability = TEXT_IN_CAPABILITY;
    if (bytesRead < 20)
        capability = .1f;

    // return information about the data in the stream
    outInfo->type = B_TRANSLATOR_TEXT;
    outInfo->group = B_TRANSLATOR_TEXT;
    outInfo->quality = TEXT_IN_QUALITY;
    outInfo->capability = capability;

    char description[B_MIME_TYPE_LENGTH];
    if (type.GetLongDescription(description) == B_OK)
        strlcpy(outInfo->name, description, sizeof(outInfo->name));
    else
        strlcpy(outInfo->name, "Plain text file", sizeof(outInfo->name));

    //strlcpy(outInfo->MIME, type.Type(), sizeof(outInfo->MIME));
    strcpy(outInfo->MIME, "text/plain");
    return B_OK;
}
开发者ID:mmanley,项目名称:Antares,代码行数:46,代码来源:STXTTranslator.cpp


注:本文中的BMimeType::GetLongDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。