Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
html_detector.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
22 
23 #ifndef PAGESPEED_AUTOMATIC_HTML_DETECTOR_H_
24 #define PAGESPEED_AUTOMATIC_HTML_DETECTOR_H_
25 
26 #include "base/logging.h"
30 
31 namespace net_instaweb {
32 
54 class HtmlDetector {
55  public:
56  HtmlDetector();
57  ~HtmlDetector();
58 
68  bool ConsiderInput(const StringPiece& data);
69 
72  bool already_decided() const { return already_decided_; }
73 
75  bool probable_html() const {
76  DCHECK(already_decided_);
77  return probable_html_;
78  }
79 
83  void ReleaseBuffered(GoogleString* out_buffer);
84 
88  void ForceDecision(bool is_html);
89 
90  private:
91  GoogleString buffer_;
92  bool already_decided_;
93  bool probable_html_;
94 
95 
96 };
97 
98 }
99 
100 #endif
Definition: html_detector.h:54
void ReleaseBuffered(GoogleString *out_buffer)
void ForceDecision(bool is_html)
bool probable_html() const
Precondition: already_decided() true (or ConsiderInput returning true).
Definition: html_detector.h:75
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
bool already_decided() const
Definition: html_detector.h:72
bool ConsiderInput(const StringPiece &data)