Page Speed Optimization Libraries
1.3.25.1
|
00001 // Copyright 2010 Google Inc. 00017 00018 #ifndef NET_INSTAWEB_UTIL_PUBLIC_WILDCARD_H_ 00019 #define NET_INSTAWEB_UTIL_PUBLIC_WILDCARD_H_ 00020 00021 #include "net/instaweb/util/public/basictypes.h" 00022 #include "net/instaweb/util/public/string.h" 00023 #include "net/instaweb/util/public/string_util.h" 00024 00025 namespace net_instaweb { 00026 00027 class Wildcard { 00028 public: 00029 static const char kMatchAny; 00030 static const char kMatchOne; 00031 00034 explicit Wildcard(const StringPiece& wildcard_spec); 00035 00037 bool Match(const StringPiece& str) const; 00038 00041 bool IsSimple() const { return is_simple_; } 00042 00044 const StringPiece spec() const { 00045 return StringPiece(storage_.data(), storage_.size() - 1); 00046 } 00047 00049 Wildcard* Duplicate() const; 00050 00051 private: 00052 Wildcard(const GoogleString& storage, int num_blocks, 00053 int last_block_offset, bool is_simple); 00054 00055 void InitFromSpec(const StringPiece& wildcard_spec); 00056 00057 GoogleString storage_; 00058 int num_blocks_; 00059 int last_block_offset_; 00060 bool is_simple_; 00061 DISALLOW_COPY_AND_ASSIGN(Wildcard); 00062 }; 00063 00064 } 00065 00066 #endif ///< NET_INSTAWEB_UTIL_PUBLIC_WILDCARD_H_