本文整理汇总了C++中SString::Begin方法的典型用法代码示例。如果您正苦于以下问题:C++ SString::Begin方法的具体用法?C++ SString::Begin怎么用?C++ SString::Begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SString
的用法示例。
在下文中一共展示了SString::Begin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MutateUrlToPath
void MutateUrlToPath(SString &urlOrPath)
{
BINDER_LOG_ENTER(W("Utils::MutateUrlToPath"));
const SString fileUrlPrefix(SString::Literal, W("file://"));
SString::Iterator i = urlOrPath.Begin();
BINDER_LOG_STRING(W("URL"), urlOrPath);
if (urlOrPath.MatchCaseInsensitive(i, fileUrlPrefix))
{
urlOrPath.Delete(i, fileUrlPrefix.GetCount());
i = urlOrPath.Begin() + 1;
if (i[0] == W(':'))
{
// CLR erroneously passes in file:// prepended to file paths,
// so we can't tell the difference between UNC and local file.
goto Exit;
}
i = urlOrPath.Begin();
#if !defined(PLATFORM_UNIX)
if (i[0] == W('/'))
{
// Disk path file:///
urlOrPath.Delete(i, 1);
}
else if (i[0] != W('\\'))
{
// UNC Path, re-insert "//" if not the wrong file://\\...
urlOrPath.Insert(i, W("//"));
}
#else
// Unix doesn't have a distinction between local and network path
_ASSERTE(i[0] == W('\\') || i[0] == W('/'));
#endif
}
Exit:
while (urlOrPath.Find(i, W('/')))
{
urlOrPath.Replace(i, W('\\'));
}
BINDER_LOG_STRING(W("Path"), urlOrPath);
BINDER_LOG_LEAVE(W("Utils::MutateUrlToPath"));
}
示例2: MutatePathToUrl
void MutatePathToUrl(SString &pathOrUrl)
{
BINDER_LOG_ENTER(W("Utils::MutatePathToUrl"));
SString::Iterator i = pathOrUrl.Begin();
BINDER_LOG_STRING(W("Path"), pathOrUrl);
#if !defined(PLATFORM_UNIX)
// Network path \\server --> file://server
// Disk path c:\dir --> file:///c:/dir
if (i[0] == W('\\'))
{
const SString networkUrlPrefix(SString::Literal, W("file:"));
// Network path
pathOrUrl.Insert(i, networkUrlPrefix);
pathOrUrl.Skip(i, networkUrlPrefix);
}
else
{
const SString diskPathUrlPrefix(SString::Literal, W("file:///"));
// Disk path
pathOrUrl.Insert(i, diskPathUrlPrefix);
pathOrUrl.Skip(i, diskPathUrlPrefix);
}
#else
// Unix doesn't have a distinction between a network or a local path
_ASSERTE(i[0] == W('\\') || i[0] == W('/'));
const SString fileUrlPrefix(SString::Literal, W("file://"));
pathOrUrl.Insert(i, fileUrlPrefix);
pathOrUrl.Skip(i, fileUrlPrefix);
#endif
while (pathOrUrl.Find(i, W('\\')))
{
pathOrUrl.Replace(i, W('/'));
}
BINDER_LOG_STRING(W("URL"), pathOrUrl);
BINDER_LOG_LEAVE(W("Utils::MutatePathToUrl"));
}
示例3: TrimTrailingWhiteSpaces
void StringLexer::TrimTrailingWhiteSpaces(SString ¤tString)
{
SString::Iterator begin = currentString.Begin();
SString::Iterator cursor = currentString.End() - 1;
BOOL fFoundWhiteSpace = FALSE;
for (;;)
{
if ((cursor >= begin) && IsWhitespace(cursor[0]))
{
fFoundWhiteSpace = TRUE;
cursor--;
continue;
}
break;
}
if (fFoundWhiteSpace)
{
currentString.Truncate(cursor + 1);
}
}