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

Side by Side Diff: runtime/bin/mime_multipart_parser.dart

Issue 10909227: Use const instead of final for constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Parser for MIME multipart types of data as described in RFC 2046 6 * Parser for MIME multipart types of data as described in RFC 2046
7 * section 5.1.1. The data to parse is supplied through the [:update:] 7 * section 5.1.1. The data to parse is supplied through the [:update:]
8 * method. As the data is parsed the following callbacks are called: 8 * method. As the data is parsed the following callbacks are called:
9 * 9 *
10 * [:partStart; 10 * [:partStart;
11 * [:headerReceived; 11 * [:headerReceived;
12 * [:headersComplete; 12 * [:headersComplete;
13 * [:partDataReceived; 13 * [:partDataReceived;
14 * [:partEnd; 14 * [:partEnd;
15 * [:error:] 15 * [:error:]
16 */ 16 */
17 17
18 class _MimeMultipartParser { 18 class _MimeMultipartParser {
19 final int _START = 0; 19 const int _START = 0;
20 final int _FIRST_BOUNDARY_ENDING = 111; 20 const int _FIRST_BOUNDARY_ENDING = 111;
21 final int _FIRST_BOUNDARY_END = 112; 21 const int _FIRST_BOUNDARY_END = 112;
22 final int _BOUNDARY_ENDING = 1; 22 const int _BOUNDARY_ENDING = 1;
23 final int _BOUNDARY_END = 2; 23 const int _BOUNDARY_END = 2;
24 final int _HEADER_START = 3; 24 const int _HEADER_START = 3;
25 final int _HEADER_FIELD = 4; 25 const int _HEADER_FIELD = 4;
26 final int _HEADER_VALUE_START = 5; 26 const int _HEADER_VALUE_START = 5;
27 final int _HEADER_VALUE = 6; 27 const int _HEADER_VALUE = 6;
28 final int _HEADER_VALUE_FOLDING_OR_ENDING = 7; 28 const int _HEADER_VALUE_FOLDING_OR_ENDING = 7;
29 final int _HEADER_VALUE_FOLD_OR_END = 8; 29 const int _HEADER_VALUE_FOLD_OR_END = 8;
30 final int _HEADER_ENDING = 9; 30 const int _HEADER_ENDING = 9;
31 final int _CONTENT = 10; 31 const int _CONTENT = 10;
32 final int _LAST_BOUNDARY_DASH2 = 11; 32 const int _LAST_BOUNDARY_DASH2 = 11;
33 final int _LAST_BOUNDARY_ENDING = 12; 33 const int _LAST_BOUNDARY_ENDING = 12;
34 final int _LAST_BOUNDARY_END = 13; 34 const int _LAST_BOUNDARY_END = 13;
35 final int _DONE = 14; 35 const int _DONE = 14;
36 final int _FAILURE = 15; 36 const int _FAILURE = 15;
37 37
38 // Construct a new MIME multipart parser with the boundary 38 // Construct a new MIME multipart parser with the boundary
39 // [boundary]. The boundary should be as specified in the content 39 // [boundary]. The boundary should be as specified in the content
40 // type parameter, that is without the -- prefix. 40 // type parameter, that is without the -- prefix.
41 _MimeMultipartParser(String boundary) { 41 _MimeMultipartParser(String boundary) {
42 List<int> charCodes = boundary.charCodes(); 42 List<int> charCodes = boundary.charCodes();
43 _boundary = new List<int>(4 + charCodes.length); 43 _boundary = new List<int>(4 + charCodes.length);
44 // Set-up the matching boundary preceding it with CRLF and two 44 // Set-up the matching boundary preceding it with CRLF and two
45 // dashes. 45 // dashes.
46 _boundary[0] = _CharCode.CR; 46 _boundary[0] = _CharCode.CR;
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 Function partDataReceived; 322 Function partDataReceived;
323 Function partEnd; 323 Function partEnd;
324 } 324 }
325 325
326 326
327 class MimeParserException implements Exception { 327 class MimeParserException implements Exception {
328 const MimeParserException([String this.message = ""]); 328 const MimeParserException([String this.message = ""]);
329 String toString() => "MimeParserException: $message"; 329 String toString() => "MimeParserException: $message";
330 final String message; 330 final String message;
331 } 331 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698