| 1 | /* |
| 2 | * Copyright 2017 The Chromium Authors. All rights reserved. |
| 3 | * Copyright (C) 2018 Akamai Technologies Inc. All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 15 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 16 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 17 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 18 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 20 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | */ |
| 26 | |
| 27 | #pragma once |
| 28 | |
| 29 | #include <wtf/text/WTFString.h> |
| 30 | |
| 31 | namespace WebCore { |
| 32 | |
| 33 | // Parses header fields into tokens, quoted strings and separators. |
| 34 | // Commonly used by ParsedContent* classes. |
| 35 | class { |
| 36 | |
| 37 | public: |
| 38 | explicit (const String&); |
| 39 | |
| 40 | // Try to parse a separator character, a token or either a token or a quoted |
| 41 | // string from the |header_field| input. Return |true| on success. Return |
| 42 | // |false| if the separator character, the token or the quoted string is |
| 43 | // missing or invalid. |
| 44 | bool (UChar); |
| 45 | String (); |
| 46 | String (); |
| 47 | |
| 48 | // Consume all characters before (but excluding) any of the characters from |
| 49 | // the Vector parameter are found. |
| 50 | // Because we potentially have to iterate through the entire Vector for each |
| 51 | // character of the base string, the Vector should be small (< 3 members). |
| 52 | void (const Vector<UChar>&); |
| 53 | |
| 54 | bool () const { return m_index >= m_input.length(); } |
| 55 | |
| 56 | private: |
| 57 | String (); |
| 58 | void (); |
| 59 | |
| 60 | unsigned = 0; |
| 61 | const String ; |
| 62 | }; |
| 63 | |
| 64 | } // namespace WebCore |
| 65 | |