Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
url-parser.h
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 
16 #ifndef IMPALA_UTIL_URL_PARSER_H
17 #define IMPALA_UTIL_URL_PARSER_H
18 
19 #include "runtime/string-value.h"
20 #include "runtime/string-search.h"
21 
22 namespace impala {
23 
28 
41 class UrlParser {
42  public:
44  enum UrlPart {
52  REF,
54  };
55 
59  static bool ParseUrl(const StringValue& url, UrlPart part, StringValue* result);
60 
64  static bool ParseUrlKey(const StringValue& url, UrlPart part, const StringValue& key,
65  StringValue* result);
66 
70  static UrlPart GetUrlPart(const StringValue& part);
71 
72  private:
73  // Constants representing parts of a URL.
74  static const StringValue url_authority;
75  static const StringValue url_file;
76  static const StringValue url_host;
77  static const StringValue url_path;
78  static const StringValue url_protocol;
79  static const StringValue url_query;
80  static const StringValue url_ref;
81  static const StringValue url_userinfo;
82  // Constants used in searching for URL parts.
83  static const StringValue protocol;
84  static const StringValue at;
85  static const StringValue slash;
86  static const StringValue colon;
87  static const StringValue question;
88  static const StringValue hash;
90  static const StringSearch at_search;
91  static const StringSearch slash_search;
92  static const StringSearch colon_search;
94  static const StringSearch hash_search;
95 };
96 
97 }
98 
99 #endif
static const StringValue url_path
Definition: url-parser.h:77
static const StringValue url_authority
Definition: url-parser.h:74
static const StringValue question
Definition: url-parser.h:87
static const StringSearch protocol_search
Definition: url-parser.h:89
static const StringValue protocol
Definition: url-parser.h:83
static const StringSearch question_search
Definition: url-parser.h:93
static UrlPart GetUrlPart(const StringValue &part)
Definition: url-parser.cc:214
static const StringValue url_userinfo
Definition: url-parser.h:81
static const StringValue url_file
Definition: url-parser.h:75
static const StringValue hash
Definition: url-parser.h:88
static const StringSearch at_search
Definition: url-parser.h:90
static bool ParseUrlKey(const StringValue &url, UrlPart part, const StringValue &key, StringValue *result)
Definition: url-parser.cc:160
static const StringSearch colon_search
Definition: url-parser.h:92
static const StringSearch hash_search
Definition: url-parser.h:94
static const StringValue colon
Definition: url-parser.h:86
static const StringValue slash
Definition: url-parser.h:85
static const StringValue url_protocol
Definition: url-parser.h:78
static const StringValue url_host
Definition: url-parser.h:76
static bool ParseUrl(const StringValue &url, UrlPart part, StringValue *result)
Definition: url-parser.cc:43
static const StringValue url_ref
Definition: url-parser.h:80
UrlPart
Parts of a URL that can be requested.
Definition: url-parser.h:44
static const StringValue url_query
Definition: url-parser.h:79
static const StringSearch slash_search
Definition: url-parser.h:91
static const StringValue at
Definition: url-parser.h:84