本文整理汇总了C++中FilePath::size方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePath::size方法的具体用法?C++ FilePath::size怎么用?C++ FilePath::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: concatenateFilePath
bool SDLPlatform::concatenateFilePath( const FilePath & _folder, const FilePath & _fileName, WChar * _filePath, size_t _capacity )
{
size_t folderSize = _folder.size();
size_t dirSize = _fileName.size();
size_t filePathSize = folderSize + dirSize;
if( filePathSize >= MENGINE_MAX_PATH )
{
return false;
}
Char filePath[MENGINE_MAX_PATH];
stdex::memorycopy( filePath, 0, _folder.c_str(), folderSize );
stdex::memorycopy( filePath, folderSize, _fileName.c_str(), dirSize );
filePath[filePathSize] = '\0';
//filePathSize += 1; //Null
if( UNICODE_SERVICE( m_serviceProvider )
->utf8ToUnicode( filePath, filePathSize, _filePath, _capacity, nullptr ) == false )
{
return false;
}
return true;
}
示例2: concatenateFilePath
bool PosixFileInputStream::concatenateFilePath( const FilePath & _folder, const FilePath & _fileName, Char * _filePath, size_t _capacity ) const
{
size_t folderSize = _folder.size();
size_t fileNameSize = _fileName.size();
if( folderSize + fileNameSize > _capacity )
{
return false;
}
strcpy( _filePath, _folder.c_str() );
strcat( _filePath, _fileName.c_str() );
return true;
}
示例3: iconData
// determines the icon data; this could be either a path on disk (if we have
// a suitable icon locally), base64-encoded icon data (if the icon is embedded
// in an R package), or nothing (if we cannot determine an icon at all)
std::string iconData(const std::string& iconGroup,
const std::string& iconName,
const std::string& iconPath)
{
if (iconPath.empty())
{
// convert the icon name into the format of our shipped icons, which is
// all lowercase with no whitespace (e.g. "SQL Server" => "sqlserver.png")
std::string iconFilename(string_utils::toLower(iconName));
iconFilename = boost::regex_replace(iconFilename,
boost::regex("\\s"), "") + ".png";
// the package did not supply an icon; see if there's one baked in
FilePath path = options().rResourcesPath().childPath("connections")
.childPath(iconGroup)
.childPath(iconFilename);
if (path.exists())
return std::string("connections/") + iconGroup + "/" + iconFilename;
if (iconGroup == "drivers")
return std::string("connections/drivers/odbc.png");
// didn't find anything
return std::string();
}
// expand the path
FilePath icon = module_context::resolveAliasedPath(iconPath);
std::string iconData;
// ensure that the icon file exists and is a small GIF, JPG, or PNG image
if (icon.exists() && icon.size() < kMaxIconSize &&
(icon.hasExtensionLowerCase(".gif") ||
icon.hasExtensionLowerCase(".png") ||
icon.hasExtensionLowerCase(".jpg") ||
icon.hasExtensionLowerCase(".jpeg")))
{
Error error = base64::encode(icon, &iconData);
if (error)
LOG_ERROR(error);
else
{
iconData = "data:" + icon.mimeContentType("image/png") +
";base64," + iconData;
}
}
return iconData;
}