Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
wildcard.h
Go to the documentation of this file.
1 // Copyright 2010 Google Inc.
17 
18 #ifndef PAGESPEED_KERNEL_BASE_WILDCARD_H_
19 #define PAGESPEED_KERNEL_BASE_WILDCARD_H_
20 
24 
25 namespace net_instaweb {
26 
27 class Wildcard {
28  public:
29  static const char kMatchAny;
30  static const char kMatchOne;
31 
34  explicit Wildcard(const StringPiece& wildcard_spec);
35 
37  bool Match(const StringPiece& str) const;
38 
41  bool IsSimple() const { return is_simple_; }
42 
44  const StringPiece spec() const {
45  return StringPiece(storage_.data(), storage_.size() - 1);
46  }
47 
49  Wildcard* Duplicate() const;
50 
51  private:
52  Wildcard(const GoogleString& storage, int num_blocks,
53  int last_block_offset, bool is_simple);
54 
55  void InitFromSpec(const StringPiece& wildcard_spec);
56 
57  GoogleString storage_;
58  int num_blocks_;
59  int last_block_offset_;
60  bool is_simple_;
61 
62 };
63 
64 }
65 
66 #endif
Wildcard(const StringPiece &wildcard_spec)
const StringPiece spec() const
Returns the original wildcard specification.
Definition: wildcard.h:44
static const char kMatchOne
?
Definition: wildcard.h:30
static const char kMatchAny
Definition: wildcard.h:29
bool IsSimple() const
Definition: wildcard.h:41
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: wildcard.h:27
Wildcard * Duplicate() const
Makes a duplicate copy of the wildcard object.
bool Match(const StringPiece &str) const
Determines whether a string matches the wildcard.