BorrowedAttrInfo.h (1135B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef BorrowedAttrInfo_h__ 8 #define BorrowedAttrInfo_h__ 9 10 class nsAttrName; 11 class nsAttrValue; 12 13 namespace mozilla::dom { 14 15 /** 16 * Struct that stores info on an attribute. The name and value must either both 17 * be null or both be non-null. 18 * 19 * Note that, just as the pointers returned by GetAttrNameAt, the pointers that 20 * this struct hold are only valid until the element or its attributes are 21 * mutated (directly or via script). 22 */ 23 struct BorrowedAttrInfo { 24 BorrowedAttrInfo() : mName(nullptr), mValue(nullptr) {} 25 26 BorrowedAttrInfo(const nsAttrName* aName, const nsAttrValue* aValue); 27 28 BorrowedAttrInfo(const BorrowedAttrInfo& aOther); 29 30 const nsAttrName* mName; 31 const nsAttrValue* mValue; 32 33 explicit operator bool() const { return mName != nullptr; } 34 }; 35 36 } // namespace mozilla::dom 37 #endif