ObjFW
OFXMLAttribute.h
1 /*
2  * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFXMLNode.h"
17 
18 OF_ASSUME_NONNULL_BEGIN
19 
20 @class OFString;
21 
28 {
29 #if defined(OF_XML_ELEMENT_M) || defined(OF_XML_PARSER_M)
30 @public
31 #endif
32  OFString *_name, *_Nullable _namespace, *_stringValue;
33  bool _useDoubleQuotes;
34  OF_RESERVE_IVARS(OFXMLAttribute, 4)
35 }
36 
40 @property (readonly, nonatomic) OFString *name;
41 
45 #ifndef __cplusplus
46 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *namespace;
47 #else
48 @property OF_NULLABLE_PROPERTY (readonly, nonatomic, getter=namespace)
49  OFString *namespace_;
50 #endif
51 
59 + (instancetype)attributeWithName: (OFString *)name
60  stringValue: (OFString *)stringValue;
61 
70 + (instancetype)attributeWithName: (OFString *)name
71  namespace: (nullable OFString *)namespace_
72  stringValue: (OFString *)stringValue;
73 
81 - (instancetype)initWithName: (OFString *)name
82  stringValue: (OFString *)stringValue;
83 
92 - (instancetype)initWithName: (OFString *)name
93  namespace: (nullable OFString *)namespace_
94  stringValue: (OFString *)stringValue;
95 
96 - (instancetype)initWithSerialization: (OFXMLElement *)element;
97 @end
98 
99 OF_ASSUME_NONNULL_END
A class for handling strings.
Definition: OFString.h:132
A representation of an attribute of an XML element as an object.
Definition: OFXMLAttribute.h:28
A class which stores an XML element.
Definition: OFXMLElement.h:34
A class which stores an XML element.
Definition: OFXMLNode.h:30