Tamarin:String implementation: Difference between revisions

Jump to navigation Jump to search
m
(Moved from global Fixed-Width-Strings page)
 
Line 226: Line 226:
=== StringDataUTF8 ===
=== StringDataUTF8 ===


This TT helper class was used to wrap a String instance (which contained UTF-8 data) into a class providing direct access to the string buffer. The new String code creates a String instance containing UTF-8 data and provides access to that data if the String instance passed in to the constructor does not contain ASCII only. If the String contains ASCII only, it can be used directly. The operator new is private to make sure that the instance can be created on the stack only. This permits some optimizations regarding the temporary STring instance. Currently, pcre needs this buffer, causing a performance degradation and increase of memory usage in all cases where regular exporessions are used.
This TT helper class was used to wrap a String instance (which contained UTF-8 data) into a class providing direct access to the string buffer. The new String code offers a stack-based <tt>StUTF8String</tt> containing UTF-8 data and provides access to that data. The pcre code needs this class and another class <tt>StIndexableUTF8String</tt> class, since pcre is UTF-8 based. This leads to a performance slowdown that could be avoided if a regular expression parser was used that worked with UTF-16 data.


=== StringNULLTerminatedUTF8 ===
=== StringNULLTerminatedUTF8 ===


This TT helper class returns a pointer to a null-terminated UTF-8 string. Again, this string is a temporary String instance containing this data.
This TT helper class returns a pointer to a null-terminated UTF-8 string. Again, this string is a temporary String instance containing this data.
55

edits

Navigation menu