michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef txStringUtils_h__ michael@0: #define txStringUtils_h__ michael@0: michael@0: #include "nsAString.h" michael@0: #include "nsIAtom.h" michael@0: #include "nsUnicharUtils.h" michael@0: #include "nsContentUtils.h" // For ASCIIToLower(). michael@0: michael@0: typedef nsCaseInsensitiveStringComparator txCaseInsensitiveStringComparator; michael@0: michael@0: /** michael@0: * Check equality between a string and an atom containing ASCII. michael@0: */ michael@0: inline bool michael@0: TX_StringEqualsAtom(const nsASingleFragmentString& aString, nsIAtom* aAtom) michael@0: { michael@0: return aAtom->Equals(aString); michael@0: } michael@0: michael@0: inline already_AddRefed michael@0: TX_ToLowerCaseAtom(nsIAtom* aAtom) michael@0: { michael@0: nsAutoString str; michael@0: aAtom->ToString(str); michael@0: nsContentUtils::ASCIIToLower(str); michael@0: return do_GetAtom(str); michael@0: } michael@0: michael@0: #endif // txStringUtils_h__