| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_EXTENSION_PARSER_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_EXTENSION_PARSER_H_ |
| 6 #define NET_WEBSOCKETS_WEBSOCKET_EXTENSION_PARSER_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_EXTENSION_PARSER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 private: | 42 private: |
| 43 WARN_UNUSED_RESULT bool Consume(char c); | 43 WARN_UNUSED_RESULT bool Consume(char c); |
| 44 WARN_UNUSED_RESULT bool ConsumeExtension(WebSocketExtension* extension); | 44 WARN_UNUSED_RESULT bool ConsumeExtension(WebSocketExtension* extension); |
| 45 WARN_UNUSED_RESULT bool ConsumeExtensionParameter( | 45 WARN_UNUSED_RESULT bool ConsumeExtensionParameter( |
| 46 WebSocketExtension::Parameter* parameter); | 46 WebSocketExtension::Parameter* parameter); |
| 47 WARN_UNUSED_RESULT bool ConsumeToken(base::StringPiece* token); | 47 WARN_UNUSED_RESULT bool ConsumeToken(base::StringPiece* token); |
| 48 WARN_UNUSED_RESULT bool ConsumeQuotedToken(std::string* token); | 48 WARN_UNUSED_RESULT bool ConsumeQuotedToken(std::string* token); |
| 49 void ConsumeSpaces(); | 49 void ConsumeSpaces(); |
| 50 WARN_UNUSED_RESULT bool Lookahead(char c); | 50 WARN_UNUSED_RESULT bool Lookahead(char c); |
| 51 WARN_UNUSED_RESULT bool ConsumeIfMatch(char c); | 51 WARN_UNUSED_RESULT bool ConsumeIfMatch(char c); |
| 52 size_t UnconsumedBytes() const { return end_ - current_; } | |
| 53 | |
| 54 static bool IsControl(char c); | |
| 55 static bool IsSeparator(char c); | |
| 56 | 52 |
| 57 // The current position in the input string. | 53 // The current position in the input string. |
| 58 const char* current_; | 54 const char* current_; |
| 59 // The pointer of the end of the input string. | 55 // The pointer of the end of the input string. |
| 60 const char* end_; | 56 const char* end_; |
| 61 std::vector<WebSocketExtension> extensions_; | 57 std::vector<WebSocketExtension> extensions_; |
| 62 | 58 |
| 63 DISALLOW_COPY_AND_ASSIGN(WebSocketExtensionParser); | 59 DISALLOW_COPY_AND_ASSIGN(WebSocketExtensionParser); |
| 64 }; | 60 }; |
| 65 | 61 |
| 66 } // namespace net | 62 } // namespace net |
| 67 | 63 |
| 68 #endif // NET_WEBSOCKETS_WEBSOCKET_EXTENSION_PARSER_H_ | 64 #endif // NET_WEBSOCKETS_WEBSOCKET_EXTENSION_PARSER_H_ |
| OLD | NEW |