Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Unified Diff: runtime/lib/string.dart

Issue 8383029: Implement external strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Finish native peer support Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/lib/string.dart
diff --git a/runtime/lib/string.dart b/runtime/lib/string.dart
index 318b01c1358b946d33bb32a78c7b43e102b52838..b4fbc431f8fd1f03cc302fb2168eb201608e723c 100644
--- a/runtime/lib/string.dart
+++ b/runtime/lib/string.dart
@@ -413,6 +413,43 @@ class FourByteString extends StringBase implements String {
}
}
+
+class ExternalOneByteString extends StringBase implements String {
+ // Checks for one-byte whitespaces only.
+ // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid
+ // whitespaces for one byte strings.
+ bool _isWhitespace(int codePoint) {
+ return
+ (codePoint === 32) || // Space.
+ ((9 <= codePoint) && (codePoint <= 13)); // CR, LF, TAB, etc.
+ }
+}
+
+
+class ExternalTwoByteString extends StringBase implements String {
+ // Checks for one-byte whitespaces only.
+ // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid
+ // whitespaces. Add checking for multi-byte whitespace codepoints.
+ bool _isWhitespace(int codePoint) {
+ return
+ (codePoint === 32) || // Space.
+ ((9 <= codePoint) && (codePoint <= 13)); // CR, LF, TAB, etc.
+ }
+}
+
+
+class ExternalFourByteString extends StringBase implements String {
+ // Checks for one-byte whitespaces only.
+ // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid
+ // whitespaces. Add checking for multi-byte whitespace codepoints.
+ bool _isWhitespace(int codePoint) {
+ return
+ (codePoint === 32) || // Space.
+ ((9 <= codePoint) && (codePoint <= 13)); // CR, LF, TAB, etc.
+ }
+}
+
+
class _StringMatch implements Match {
const _StringMatch(int this._start,
String this.str,

Powered by Google App Engine
This is Rietveld 408576698