| 1 | // Copyright 2009 The RE2 Authors. All Rights Reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | #ifndef UTIL_FLAGS_H_ |
| 6 | #define UTIL_FLAGS_H_ |
| 7 | |
| 8 | // Simplified version of Google's command line flags. |
| 9 | // Does not support parsing the command line. |
| 10 | // If you want to do that, see |
| 11 | // https://gflags.github.io/gflags/ |
| 12 | |
| 13 | #define DEFINE_FLAG(type, name, deflt, desc) \ |
| 14 | namespace re2 { type FLAGS_##name = deflt; } |
| 15 | |
| 16 | #define DECLARE_FLAG(type, name) \ |
| 17 | namespace re2 { extern type FLAGS_##name; } |
| 18 | |
| 19 | namespace re2 { |
| 20 | template <typename T> |
| 21 | T GetFlag(const T& flag) { |
| 22 | return flag; |
| 23 | } |
| 24 | } // namespace re2 |
| 25 | |
| 26 | #endif // UTIL_FLAGS_H_ |
| 27 | |