1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xslt/base/txStringUtils.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,34 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef txStringUtils_h__ 1.10 +#define txStringUtils_h__ 1.11 + 1.12 +#include "nsAString.h" 1.13 +#include "nsIAtom.h" 1.14 +#include "nsUnicharUtils.h" 1.15 +#include "nsContentUtils.h" // For ASCIIToLower(). 1.16 + 1.17 +typedef nsCaseInsensitiveStringComparator txCaseInsensitiveStringComparator; 1.18 + 1.19 +/** 1.20 + * Check equality between a string and an atom containing ASCII. 1.21 + */ 1.22 +inline bool 1.23 +TX_StringEqualsAtom(const nsASingleFragmentString& aString, nsIAtom* aAtom) 1.24 +{ 1.25 + return aAtom->Equals(aString); 1.26 +} 1.27 + 1.28 +inline already_AddRefed<nsIAtom> 1.29 +TX_ToLowerCaseAtom(nsIAtom* aAtom) 1.30 +{ 1.31 + nsAutoString str; 1.32 + aAtom->ToString(str); 1.33 + nsContentUtils::ASCIIToLower(str); 1.34 + return do_GetAtom(str); 1.35 +} 1.36 + 1.37 +#endif // txStringUtils_h__