本文整理汇总了C++中nsString::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ nsString::IsEmpty方法的具体用法?C++ nsString::IsEmpty怎么用?C++ nsString::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsString
的用法示例。
在下文中一共展示了nsString::IsEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
void
HangMonitorParent::UpdateMinidump(uint32_t aPluginId, const nsString& aDumpId)
{
if (aDumpId.IsEmpty()) {
return;
}
MutexAutoLock lock(mBrowserCrashDumpHashLock);
mBrowserCrashDumpIds.Put(aPluginId, aDumpId);
}
示例2: AddClass
void nsCSSSelector::AddClass(const nsString& aClass)
{
if (!aClass.IsEmpty()) {
nsAtomList** list = &mClassList;
while (nullptr != *list) {
list = &((*list)->mNext);
}
*list = new nsAtomList(aClass);
}
}
示例3: AddID
void nsCSSSelector::AddID(const nsString& aID)
{
if (!aID.IsEmpty()) {
nsAtomList** list = &mIDList;
while (nsnull != *list) {
list = &((*list)->mNext);
}
*list = new nsAtomList(aID);
}
}
示例4:
static PLDHashOperator
DeleteMinidump(const uint32_t& aPluginId, nsString aCrashId, void* aUserData)
{
#ifdef MOZ_CRASHREPORTER
if (!aCrashId.IsEmpty()) {
CrashReporter::DeleteMinidumpFilesForID(aCrashId);
}
#endif
return PL_DHASH_NEXT;
}
示例5: AddAttribute
void nsCSSSelector::AddAttribute(int32_t aNameSpace, const nsString& aAttr)
{
if (!aAttr.IsEmpty()) {
nsAttrSelector** list = &mAttrList;
while (nullptr != *list) {
list = &((*list)->mNext);
}
*list = new nsAttrSelector(aNameSpace, aAttr);
}
}
示例6: GetTextEquivFromIDRefs
void
nsXFormsAccessible::Description(nsString& aDescription)
{
nsTextEquivUtils::
GetTextEquivFromIDRefs(this, nsGkAtoms::aria_describedby,
aDescription);
if (aDescription.IsEmpty())
GetBoundChildElementValue(NS_LITERAL_STRING("hint"), aDescription);
}
示例7: IPC_OK
mozilla::ipc::IPCResult FilePickerParent::RecvOpen(
const int16_t& aSelectedType, const bool& aAddToRecentDocs,
const nsString& aDefaultFile, const nsString& aDefaultExtension,
InfallibleTArray<nsString>&& aFilters,
InfallibleTArray<nsString>&& aFilterNames,
InfallibleTArray<nsString>&& aRawFilters, const nsString& aDisplayDirectory,
const nsString& aDisplaySpecialDirectory, const nsString& aOkButtonLabel) {
if (!CreateFilePicker()) {
Unused << Send__delete__(this, void_t(), nsIFilePicker::returnCancel);
return IPC_OK();
}
mFilePicker->SetAddToRecentDocs(aAddToRecentDocs);
for (uint32_t i = 0; i < aFilters.Length(); ++i) {
mFilePicker->AppendFilter(aFilterNames[i], aFilters[i]);
}
for (uint32_t i = 0; i < aRawFilters.Length(); ++i) {
mFilePicker->AppendRawFilter(aRawFilters[i]);
}
mFilePicker->SetDefaultString(aDefaultFile);
mFilePicker->SetDefaultExtension(aDefaultExtension);
mFilePicker->SetFilterIndex(aSelectedType);
mFilePicker->SetOkButtonLabel(aOkButtonLabel);
if (!aDisplayDirectory.IsEmpty()) {
nsCOMPtr<nsIFile> localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
if (localFile) {
localFile->InitWithPath(aDisplayDirectory);
mFilePicker->SetDisplayDirectory(localFile);
}
} else if (!aDisplaySpecialDirectory.IsEmpty()) {
mFilePicker->SetDisplaySpecialDirectory(aDisplaySpecialDirectory);
}
mCallback = new FilePickerShownCallback(this);
mFilePicker->Open(mCallback);
return IPC_OK();
}
示例8:
void
HTMLSpinnerAccessible::Value(nsString& aValue) const
{
AccessibleWrap::Value(aValue);
if (!aValue.IsEmpty())
return;
// Pass NonSystem as the caller type, to be safe. We don't expect to have a
// file input here.
HTMLInputElement::FromNode(mContent)->GetValue(aValue, CallerType::NonSystem);
}
示例9: if
nscoord
nsMathMLmfracFrame::CalcLineThickness(nsPresContext* aPresContext,
nsStyleContext* aStyleContext,
nsString& aThicknessAttribute,
nscoord onePixel,
nscoord aDefaultRuleThickness,
float aFontSizeInflation)
{
nscoord defaultThickness = aDefaultRuleThickness;
nscoord lineThickness = aDefaultRuleThickness;
nscoord minimumThickness = onePixel;
// linethickness
//
// "Specifies the thickness of the horizontal 'fraction bar', or 'rule'. The
// default value is 'medium', 'thin' is thinner, but visible, 'thick' is
// thicker; the exact thickness of these is left up to the rendering agent."
//
// values: length | "thin" | "medium" | "thick"
// default: medium
//
if (!aThicknessAttribute.IsEmpty()) {
if (aThicknessAttribute.EqualsLiteral("thin")) {
lineThickness = NSToCoordFloor(defaultThickness * THIN_FRACTION_LINE);
minimumThickness = onePixel * THIN_FRACTION_LINE_MINIMUM_PIXELS;
// should visually decrease by at least one pixel, if default is not a pixel
if (defaultThickness > onePixel && lineThickness > defaultThickness - onePixel)
lineThickness = defaultThickness - onePixel;
}
else if (aThicknessAttribute.EqualsLiteral("medium")) {
// medium is default
}
else if (aThicknessAttribute.EqualsLiteral("thick")) {
lineThickness = NSToCoordCeil(defaultThickness * THICK_FRACTION_LINE);
minimumThickness = onePixel * THICK_FRACTION_LINE_MINIMUM_PIXELS;
// should visually increase by at least one pixel
if (lineThickness < defaultThickness + onePixel)
lineThickness = defaultThickness + onePixel;
}
else {
// length value
lineThickness = defaultThickness;
ParseNumericValue(aThicknessAttribute, &lineThickness,
nsMathMLElement::PARSE_ALLOW_UNITLESS,
aPresContext, aStyleContext, aFontSizeInflation);
}
}
// use minimum if the lineThickness is a non-zero value less than minimun
if (lineThickness && lineThickness < minimumThickness)
lineThickness = minimumThickness;
return lineThickness;
}
示例10: Name
ENameValueFlag RootAccessible::Name(nsString& aName) const {
aName.Truncate();
if (ARIARoleMap()) {
Accessible::Name(aName);
if (!aName.IsEmpty()) return eNameOK;
}
mDocumentNode->GetTitle(aName);
return eNameOK;
}
示例11: AddPseudoClass
void nsCSSSelector::AddPseudoClass(const nsString& aPseudoClass,
const PRUnichar* aString)
{
if (!aPseudoClass.IsEmpty()) {
nsAtomStringList** list = &mPseudoClassList;
while (nsnull != *list) {
list = &((*list)->mNext);
}
*list = new nsAtomStringList(aPseudoClass, aString);
}
}
示例12: StringBeginsWith
nsresult
nsAutoCompleteController::CompleteValue(nsString &aValue)
/* mInput contains mSearchString, which we want to autocomplete to aValue. If
* selectDifference is true, select the remaining portion of aValue not
* contained in mSearchString. */
{
const PRInt32 mSearchStringLength = mSearchString.Length();
PRInt32 endSelect = aValue.Length(); // By default, select all of aValue.
if (aValue.IsEmpty() ||
StringBeginsWith(aValue, mSearchString,
nsCaseInsensitiveStringComparator())) {
// aValue is empty (we were asked to clear mInput), or mSearchString
// matches the beginning of aValue. In either case we can simply
// autocomplete to aValue.
mInput->SetTextValue(aValue);
} else {
nsresult rv;
nsCOMPtr<nsIIOService> ios = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString scheme;
if (NS_SUCCEEDED(ios->ExtractScheme(NS_ConvertUTF16toUTF8(aValue), scheme))) {
// Trying to autocomplete a URI from somewhere other than the beginning.
// Only succeed if the missing portion is "http://"; otherwise do not
// autocomplete. This prevents us from "helpfully" autocompleting to a
// URI that isn't equivalent to what the user expected.
const PRInt32 findIndex = 7; // length of "http://"
if ((endSelect < findIndex + mSearchStringLength) ||
!scheme.LowerCaseEqualsLiteral("http") ||
!Substring(aValue, findIndex, mSearchStringLength).Equals(
mSearchString, nsCaseInsensitiveStringComparator())) {
return NS_OK;
}
mInput->SetTextValue(mSearchString +
Substring(aValue, mSearchStringLength + findIndex,
endSelect));
endSelect -= findIndex; // We're skipping this many characters of aValue.
} else {
// Autocompleting something other than a URI from the middle.
// Use the format "searchstring >> full string" to indicate to the user
// what we are going to replace their search string with.
mInput->SetTextValue(mSearchString + NS_LITERAL_STRING(" >> ") + aValue);
endSelect = mSearchString.Length() + 4 + aValue.Length();
}
}
mInput->SelectTextRange(mSearchStringLength, endSelect);
return NS_OK;
}
示例13: AddAttribute
void nsCSSSelector::AddAttribute(int32_t aNameSpace, const nsString& aAttr, uint8_t aFunc,
const nsString& aValue, bool aCaseSensitive)
{
if (!aAttr.IsEmpty()) {
nsAttrSelector** list = &mAttrList;
while (nullptr != *list) {
list = &((*list)->mNext);
}
*list = new nsAttrSelector(aNameSpace, aAttr, aFunc, aValue, aCaseSensitive);
}
}
示例14: AddAttribute
void nsCSSSelector::AddAttribute(PRInt32 aNameSpace, const nsString& aAttr, PRUint8 aFunc,
const nsString& aValue, PRBool aCaseSensitive)
{
if (!aAttr.IsEmpty()) {
nsAttrSelector** list = &mAttrList;
while (nsnull != *list) {
list = &((*list)->mNext);
}
*list = new nsAttrSelector(aNameSpace, aAttr, aFunc, aValue, aCaseSensitive);
}
}
示例15: ShowStatusMsg
nsresult nsFolderCompactState::ShowStatusMsg(const nsString& aMsg)
{
nsCOMPtr <nsIMsgStatusFeedback> statusFeedback;
if (m_window)
{
m_window->GetStatusFeedback(getter_AddRefs(statusFeedback));
if (statusFeedback && !aMsg.IsEmpty())
return statusFeedback->SetStatusString(aMsg);
}
return NS_OK;
}