Use templates in parsexml instead for performance
This commit is contained in:
parent
15cc3bf670
commit
ba63a8f8b8
1 changed files with 14 additions and 14 deletions
|
|
@ -139,43 +139,43 @@ proc kind*(my: XmlParser): XmlEventKind {.inline.} =
|
||||||
## returns the current event type for the XML parser
|
## returns the current event type for the XML parser
|
||||||
return my.kind
|
return my.kind
|
||||||
|
|
||||||
proc charData*(my: var XmlParser): var string {.inline.} =
|
template charData*(my: XmlParser): string =
|
||||||
## returns the character data for the events: ``xmlCharData``,
|
## returns the character data for the events: ``xmlCharData``,
|
||||||
## ``xmlWhitespace``, ``xmlComment``, ``xmlCData``, ``xmlSpecial``
|
## ``xmlWhitespace``, ``xmlComment``, ``xmlCData``, ``xmlSpecial``
|
||||||
assert(my.kind in {xmlCharData, xmlWhitespace, xmlComment, xmlCData,
|
assert(my.kind in {xmlCharData, xmlWhitespace, xmlComment, xmlCData,
|
||||||
xmlSpecial})
|
xmlSpecial})
|
||||||
return my.a
|
my.a
|
||||||
|
|
||||||
proc elementName*(my: var XmlParser): var string {.inline.} =
|
template elementName*(my: XmlParser): string =
|
||||||
## returns the element name for the events: ``xmlElementStart``,
|
## returns the element name for the events: ``xmlElementStart``,
|
||||||
## ``xmlElementEnd``, ``xmlElementOpen``
|
## ``xmlElementEnd``, ``xmlElementOpen``
|
||||||
assert(my.kind in {xmlElementStart, xmlElementEnd, xmlElementOpen})
|
assert(my.kind in {xmlElementStart, xmlElementEnd, xmlElementOpen})
|
||||||
return my.a
|
my.a
|
||||||
|
|
||||||
proc entityName*(my: var XmlParser): var string {.inline.} =
|
template entityName*(my: XmlParser): string =
|
||||||
## returns the entity name for the event: ``xmlEntity``
|
## returns the entity name for the event: ``xmlEntity``
|
||||||
assert(my.kind == xmlEntity)
|
assert(my.kind == xmlEntity)
|
||||||
return my.a
|
my.a
|
||||||
|
|
||||||
proc attrKey*(my: var XmlParser): var string {.inline.} =
|
template attrKey*(my: XmlParser): string =
|
||||||
## returns the attribute key for the event ``xmlAttribute``
|
## returns the attribute key for the event ``xmlAttribute``
|
||||||
assert(my.kind == xmlAttribute)
|
assert(my.kind == xmlAttribute)
|
||||||
return my.a
|
my.a
|
||||||
|
|
||||||
proc attrValue*(my: var XmlParser): var string {.inline.} =
|
template attrValue*(my: XmlParser): string =
|
||||||
## returns the attribute value for the event ``xmlAttribute``
|
## returns the attribute value for the event ``xmlAttribute``
|
||||||
assert(my.kind == xmlAttribute)
|
assert(my.kind == xmlAttribute)
|
||||||
return my.b
|
my.b
|
||||||
|
|
||||||
proc piName*(my: var XmlParser): var string {.inline.} =
|
template piName*(my: XmlParser): string =
|
||||||
## returns the processing instruction name for the event ``xmlPI``
|
## returns the processing instruction name for the event ``xmlPI``
|
||||||
assert(my.kind == xmlPI)
|
assert(my.kind == xmlPI)
|
||||||
return my.a
|
my.a
|
||||||
|
|
||||||
proc piRest*(my: var XmlParser): var string {.inline.} =
|
template piRest*(my: XmlParser): string =
|
||||||
## returns the rest of the processing instruction for the event ``xmlPI``
|
## returns the rest of the processing instruction for the event ``xmlPI``
|
||||||
assert(my.kind == xmlPI)
|
assert(my.kind == xmlPI)
|
||||||
return my.b
|
my.b
|
||||||
|
|
||||||
proc rawData*(my: XmlParser): string {.inline.} =
|
proc rawData*(my: XmlParser): string {.inline.} =
|
||||||
## returns the underlying 'data' string by reference.
|
## returns the underlying 'data' string by reference.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue