本文整理汇总了C++中nsCString::CharAt方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCString::CharAt方法的具体用法?C++ nsCString::CharAt怎么用?C++ nsCString::CharAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCString
的用法示例。
在下文中一共展示了nsCString::CharAt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
nsresult
nsBeckyFilters::CreateLeaveOrDeleteAction(const nsCString &aLine,
nsIMsgFilter *aFilter,
nsIMsgRuleAction **_retval)
{
nsresult rv;
nsMsgRuleActionType actionType;
if (aLine.CharAt(3) == '0') {
actionType = nsMsgFilterAction::LeaveOnPop3Server;
} else if (aLine.CharAt(3) == '1') {
if (aLine.CharAt(5) == '1')
actionType = nsMsgFilterAction::Delete;
else
actionType = nsMsgFilterAction::DeleteFromPop3Server;
} else {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIMsgRuleAction> action;
rv = CreateRuleAction(aFilter, actionType, getter_AddRefs(action));
NS_ENSURE_SUCCESS(rv, rv);
action.forget(_retval);
return NS_OK;
}
示例2: switch
nsresult
nsBeckyFilters::SetRuleAction(const nsCString &aLine, nsIMsgFilter *aFilter)
{
if (!aFilter || aLine.Length() < 4)
return NS_ERROR_FAILURE;
nsresult rv = NS_OK;
nsCOMPtr<nsIMsgRuleAction> action;
switch (aLine.CharAt(1)) {
case 'R': // Reply
rv = CreateResendAction(aLine,
aFilter,
nsMsgFilterAction::Reply,
getter_AddRefs(action));
break;
case 'F': // Forward
rv = CreateResendAction(aLine,
aFilter,
nsMsgFilterAction::Forward,
getter_AddRefs(action));
break;
case 'L': // Leave or delete
rv = CreateLeaveOrDeleteAction(aLine, aFilter, getter_AddRefs(action));
break;
case 'Y': // Copy
rv = CreateDistributeAction(aLine,
aFilter,
nsMsgFilterAction::CopyToFolder,
getter_AddRefs(action));
break;
case 'M': // Move
rv = CreateDistributeAction(aLine,
aFilter,
nsMsgFilterAction::MoveToFolder,
getter_AddRefs(action));
break;
case 'G': // Set flag
if (aLine.CharAt(3) == 'R') // Read
rv = CreateRuleAction(aFilter, nsMsgFilterAction::MarkRead, getter_AddRefs(action));
break;
default:
return NS_OK;
}
NS_ENSURE_SUCCESS(rv, rv);
if (action) {
rv = aFilter->AppendAction(action);
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}
示例3: while
static PRUint32
net_FindMediaDelimiter(const nsCString& flatStr,
PRUint32 searchStart,
char delimiter)
{
do {
// searchStart points to the spot from which we should start looking
// for the delimiter.
const char delimStr[] = { delimiter, '"', '\0' };
PRUint32 curDelimPos = flatStr.FindCharInSet(delimStr, searchStart);
if (curDelimPos == PRUint32(kNotFound))
return flatStr.Length();
char ch = flatStr.CharAt(curDelimPos);
if (ch == delimiter) {
// Found delimiter
return curDelimPos;
}
// We hit the start of a quoted string. Look for its end.
searchStart = net_FindStringEnd(flatStr, curDelimPos, ch);
if (searchStart == flatStr.Length())
return searchStart;
++searchStart;
// searchStart now points to the first char after the end of the
// string, so just go back to the top of the loop and look for
// |delimiter| again.
} while (true);
NS_NOTREACHED("How did we get here?");
return flatStr.Length();
}
示例4: while
void nsEudoraWin32::ConvertPath( nsCString& str)
{
nsCString temp;
nsCString path;
PRInt32 idx = 0;
PRInt32 start = 0;
nsCString search;
idx = str.FindChar( '\\', idx);
if ((idx == 2) && (str.CharAt( 1) == ':'))
{
str.Left( path, 3);
idx++;
idx = str.FindChar( '\\', idx);
start = 3;
if ((idx == -1) && (str.Length() > 3))
{
str.Right( temp, str.Length() - start);
path.Append( temp);
}
}
WIN32_FIND_DATA findFileData;
while (idx != -1)
{
str.Mid( temp, start, idx - start);
search = path;
search.Append( temp);
HANDLE h = FindFirstFile( search.get(), &findFileData);
if (h == INVALID_HANDLE_VALUE)
return;
path.Append( findFileData.cFileName);
idx++;
start = idx;
idx = str.FindChar( '\\', idx);
FindClose( h);
if (idx != -1)
path.Append( '\\');
else
{
str.Right( temp, str.Length() - start);
path.Append( '\\');
path.Append( temp);
}
}
str = path;
}
示例5:
nsresult
rdf_MakeRelativeRef(const nsCSubstring& aBaseURI, nsCString& aURI)
{
// This implementation is extremely simple: e.g., it can't compute
// relative paths, or anything fancy like that. If the context URI
// is not a prefix of the URI in question, we'll just bail.
PRUint32 prefixLen = aBaseURI.Length();
if (prefixLen != 0 && StringBeginsWith(aURI, aBaseURI)) {
if (prefixLen < aURI.Length() && aURI.CharAt(prefixLen) == '/')
++prefixLen; // chop the leading slash so it's not `absolute'
aURI.Cut(0, prefixLen);
}
return NS_OK;
}