diff options
author | def <dennis@felsin9.de> | 2015-02-19 22:29:41 +0100 |
---|---|---|
committer | def <dennis@felsin9.de> | 2015-02-27 03:10:06 +0100 |
commit | ba63a8f8b8b3706660c7b257327269473e3a584c (patch) | |
tree | 49c594a31bde0aa10de31ba283e3d84386baa293 /lib/pure | |
parent | 15cc3bf67036c204ace466be4232bfed8cf76d2e (diff) | |
download | Nim-ba63a8f8b8b3706660c7b257327269473e3a584c.tar.gz |
Use templates in parsexml instead for performance
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/parsexml.nim | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/pure/parsexml.nim b/lib/pure/parsexml.nim index 6e6f6ab5d..a9fdf87b4 100644 --- a/lib/pure/parsexml.nim +++ b/lib/pure/parsexml.nim @@ -139,43 +139,43 @@ proc kind*(my: XmlParser): XmlEventKind {.inline.} = ## returns the current event type for the XML parser return my.kind -proc charData*(my: var XmlParser): var string {.inline.} = +template charData*(my: XmlParser): string = ## returns the character data for the events: ``xmlCharData``, ## ``xmlWhitespace``, ``xmlComment``, ``xmlCData``, ``xmlSpecial`` assert(my.kind in {xmlCharData, xmlWhitespace, xmlComment, xmlCData, 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``, ## ``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`` 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`` 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`` 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`` 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`` assert(my.kind == xmlPI) - return my.b + my.b proc rawData*(my: XmlParser): string {.inline.} = ## returns the underlying 'data' string by reference. |