本文整理汇总了C++中OsPath::length方法的典型用法代码示例。如果您正苦于以下问题:C++ OsPath::length方法的具体用法?C++ OsPath::length怎么用?C++ OsPath::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsPath
的用法示例。
在下文中一共展示了OsPath::length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Path
OsPath SipXecsService::Path(DirectoryType pathType, const char* fileName)
{
OsPath path;
const char* dirPath;
if ( (dirPath = getenv(pathType)) )
{
OsSysLog::add(FAC_KERNEL, PRI_NOTICE,
"SipXecsService::Path type '%s' overridden by environment to '%s'",
pathType, dirPath);
}
else
{
dirPath = defaultDir(pathType);
}
path.append(dirPath);
const char slash = OsPath::separator(0);
const char lastPathChar = path(path.length()-1);
if (fileName && *fileName != '\000')
{
// Add the file name
// make sure there is exactly one separator between the directory and the file
if ( slash != lastPathChar
&& slash != fileName[0]
)
{
// neither has separator - add one
path.append(OsPath::separator);
}
else if ( slash == lastPathChar
&& slash == fileName[0]
)
{
// both have the separator - take one off so there's only one
path.remove(path.length()-1);
}
path.append(fileName);
}
// There is no file name, so make sure the returned directory name does not
// end in a separator
else if ( slash == lastPathChar )
{
path.remove(path.length()-1);
}
OsSysLog::add(FAC_KERNEL, PRI_DEBUG,
"SipXecsService::Path('%s', '%s') returning '%s'",
pathType, fileName ? fileName : "", path.data() );
return path;
}