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

Side by Side Diff: third_party/WebKit/Source/platform/network/ContentHeaderFieldInput.h

Issue 2880543003: Implement a parser for Content-Disposition header fields (Closed)
Patch Set: Class comments Created 3 years, 7 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ContentHeaderFieldInput_h
6 #define ContentHeaderFieldInput_h
7
8 #include "platform/network/ParsedContentHeaderFieldParameters.h"
9 #include "platform/wtf/text/WTFString.h"
10
11 namespace blink {
12
13 // ContentHeaderFieldInput is used internally by ParsedContentDisposition,
14 // ParsedContentHeaderFieldParameters and ParsedContentType classes for parsing
15 // content header fields into tokens, quoted strings and separators.
kinuko 2017/05/23 11:27:31 Maybe just: "Parses content header fields into to
e_hakkinen 2017/05/23 20:07:02 Done.
16 class ContentHeaderFieldInput final {
kinuko 2017/05/23 11:27:31 Would it make sense to rather call it, say, Conten
e_hakkinen 2017/05/23 20:07:02 Done.
17 STACK_ALLOCATED();
18
19 public:
20 using Mode = ParsedContentHeaderFieldParameters::Mode;
21
22 explicit ContentHeaderFieldInput(const String& header_field);
23 ContentHeaderFieldInput(ContentHeaderFieldInput&&);
24
25 // Try to parse a separator character, a token or either a token or a quoted
26 // string from the |header_field| input. Return |true| on success. Return
27 // |false| if the separator character, the token or the quoted string is
28 // missing or invalid.
29 bool Consume(char);
30 bool ConsumeToken(Mode, StringView& output);
31 bool ConsumeTokenOrQuotedString(Mode, String& output);
32
33 unsigned Index() const { return index_; }
34 bool IsConsumed() const { return index_ >= input_.length(); }
35 void SkipSpaces();
36
37 private:
38 bool ConsumeQuotedString(String& output);
39
40 unsigned index_;
41 const String input_;
42 };
43
44 } // namespace blink
45
46 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698