flags.h 678 B

1234567891011121314151617181920212223242526
  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. #ifndef UTIL_FLAGS_H_
  5. #define UTIL_FLAGS_H_
  6. // Simplified version of Google's command line flags.
  7. // Does not support parsing the command line.
  8. // If you want to do that, see
  9. // https://gflags.github.io/gflags/
  10. #define DEFINE_FLAG(type, name, deflt, desc) \
  11. namespace re2 { type FLAGS_##name = deflt; }
  12. #define DECLARE_FLAG(type, name) \
  13. namespace re2 { extern type FLAGS_##name; }
  14. namespace re2 {
  15. template <typename T>
  16. T GetFlag(const T& flag) {
  17. return flag;
  18. }
  19. } // namespace re2
  20. #endif // UTIL_FLAGS_H_