2
* Copyright 2011 Google Inc.
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
17
// Author: jmarantz@google.com (Joshua Marantz)
19
#ifndef NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_GFLAGS_H_
20
#define NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_GFLAGS_H_
22
#include "net/instaweb/util/public/basictypes.h"
24
namespace net_instaweb {
27
class RewriteDriverFactory;
30
// Implements rewriter options as command-line options, using the
31
// Google "gflags" package.
34
// The constructor parses the options.
35
RewriteGflags(const char* progname, int* argc, char*** argv);
37
// Constructor that does no option parsing.
40
// Apply the parsed options to the options and factory. Note that some of
41
// the command-line flags control how the factory is constructed, whereas
42
// others affect the rewriting options, and should be considered global
44
bool SetOptions(RewriteDriverFactory* factory, RewriteOptions* options) const;
46
// LRU size is potentially needed at factory construction time so it
47
// is exposed as a method.
48
int64 lru_cache_size_bytes() const;
50
// Determines whether a flag was explicitly set, as opposed to having its
52
static bool WasExplicitlySet(const char* name);
54
// Sets the rewrite level/list passed on the specified option names
55
// & values. The flag names are passed in to provide better error
58
// False is returned if the values cannot be parsed.
59
bool SetRewriters(const char* rewriters_flag_name,
60
const char* rewriters_value,
61
const char* rewrite_level_flag_name,
62
const char* rewrite_level_value,
63
RewriteOptions* options,
64
MessageHandler* handler) const;
67
// There is no data in this class because the underlying gflags
68
// class holds the parsed options in globals.
70
DISALLOW_COPY_AND_ASSIGN(RewriteGflags);
73
} // namespace net_instaweb
75
#endif // NET_INSTAWEB_REWRITER_PUBLIC_REWRITE_GFLAGS_H_