本文整理汇总了C++中plString::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ plString::empty方法的具体用法?C++ plString::empty怎么用?C++ plString::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plString
的用法示例。
在下文中一共展示了plString::empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cdUp
plString cdUp(plString path) {
// Check for root paths, we can't go up from there!
#ifdef WIN32
if (path.mid(1) == ":\\")
return path;
#else
if (path == "/")
return path;
#endif
// Not very robust, but it works for one level of parent scanning
if (path.empty())
return ".." PATHSEPSTR;
// Strip the ending slash, if necessary, and then go up one dir
if (path[path.len()-1] == PATHSEP)
path = path.left(path.len() - 1);
plString up = path.beforeLast(PATHSEP);
if (path[0] == PATHSEP) {
// Absolute path specified -- make sure we keep it that way
return up + PATHSEP;
} else {
// Relative path specified
return up.empty() ? "" : up + PATHSEP;
}
}
示例2: FixSlashes
plString FixSlashes(const plString& src) {
if (src.empty())
return plString();
char* pbuf = strdup(src);
for (char* pc = pbuf; *pc != 0; pc++) {
if (*pc == '/' || *pc == '\\')
*pc = PATHSEP;
}
plString dest(pbuf);
free(pbuf);
return dest;
}