![]() |
OpenMS
|
Non-owning attribute view for an XML start-element callback. More...
#include <OpenMS/FORMAT/HANDLERS/XMLAttributes.h>
Classes | |
| class | NativeStore |
| Reusable UTF-8 attribute storage of an XML parser adapter. More... | |
Public Types | |
| using | Values = std::vector< std::pair< std::u16string, std::u16string > > |
Public Member Functions | |
| XMLAttributes (const Values &attributes) noexcept | |
| XMLAttributes (const NativeStore &attributes) noexcept | |
| XMLAttributes (Values &&)=delete | |
| XMLAttributes (const Values &&)=delete | |
| XMLAttributes (NativeStore &&)=delete | |
| XMLAttributes (const NativeStore &&)=delete | |
| Size | size () const noexcept |
| Number of attributes. | |
| const char16_t * | value (const char16_t *qname) const |
| UTF-16 value by name, or nullptr if absent. | |
| const char16_t * | value (const char *qname) const |
| UTF-16 value by UTF-8 name, or nullptr if absent. | |
| SignedSize | index (const char16_t *qname) const |
| Index by UTF-16 name, or a negative value if absent. | |
| const char16_t * | valueByIndex (Size i) const |
| UTF-16 value by index, or nullptr if out of range. | |
| bool | valueUTF8 (const char16_t *qname, std::string &value) const |
Assigns the UTF-8 value of the attribute named qname to value. Returns false (leaving value untouched) if absent. | |
| bool | valueUTF8 (const char *qname, std::string &value) const |
Assigns the UTF-8 value of the attribute with UTF-8 name qname to value. Returns false (leaving value untouched) if absent. | |
Private Member Functions | |
| SignedSize | indexUTF8_ (const char *qname) const |
| Index by UTF-8 name, or a negative value if absent. | |
| void | valueUTF8ByIndex_ (Size i, std::string &value) const |
UTF-8 value at index i (which must be valid) | |
Private Attributes | |
| const Values * | attributes_ = nullptr |
| const NativeStore * | native_ = nullptr |
Non-owning attribute view for an XML start-element callback.
The view refers either to UTF-16 name/value pairs or to a parser-owned NativeStore of UTF-8 slices. The latter converts a value to UTF-16 only when it is requested through value() or valueByIndex(); valueUTF8() copies it without conversion. This view and the pointers it returns must not outlive the callback that receives them.
| using Values = std::vector<std::pair<std::u16string, std::u16string> > |
|
inlineexplicitnoexcept |
|
inlineexplicitnoexcept |
|
delete |
|
delete |
|
delete |
|
delete |
| SignedSize index | ( | const char16_t * | qname | ) | const |
Index by UTF-16 name, or a negative value if absent.
|
private |
Index by UTF-8 name, or a negative value if absent.
|
noexcept |
Number of attributes.
| const char16_t * value | ( | const char * | qname | ) | const |
UTF-16 value by UTF-8 name, or nullptr if absent.
| const char16_t * value | ( | const char16_t * | qname | ) | const |
UTF-16 value by name, or nullptr if absent.
Referenced by XMLHandler::optionalAttributeAsDoubleList_(), XMLHandler::optionalAttributeAsDoubleList_(), XMLHandler::optionalAttributeAsIntList_(), XMLHandler::optionalAttributeAsIntList_(), XMLHandler::optionalAttributeAsStringList_(), and XMLHandler::optionalAttributeAsStringList_().
| const char16_t * valueByIndex | ( | Size | i | ) | const |
UTF-16 value by index, or nullptr if out of range.
| bool valueUTF8 | ( | const char * | qname, |
| std::string & | value | ||
| ) | const |
Assigns the UTF-8 value of the attribute with UTF-8 name qname to value. Returns false (leaving value untouched) if absent.
| bool valueUTF8 | ( | const char16_t * | qname, |
| std::string & | value | ||
| ) | const |
Assigns the UTF-8 value of the attribute named qname to value. Returns false (leaving value untouched) if absent.
Referenced by XMLHandler::attributeAsDouble_(), XMLHandler::attributeAsDouble_(), XMLHandler::attributeAsInt_(), XMLHandler::attributeAsInt_(), XMLHandler::attributeAsString_(), XMLHandler::attributeAsString_(), XMLHandler::optionalAttributeAsDouble_(), XMLHandler::optionalAttributeAsDouble_(), XMLHandler::optionalAttributeAsInt_(), XMLHandler::optionalAttributeAsInt_(), XMLHandler::optionalAttributeAsString_(), XMLHandler::optionalAttributeAsString_(), XMLHandler::optionalAttributeAsUInt_(), and XMLHandler::optionalAttributeAsUInt_().
|
private |
UTF-8 value at index i (which must be valid)
|
private |
|
private |