|
||||
File indexing completed on 2025-01-18 09:27:16
0001 // 0002 // Copyright 2019 The Abseil Authors. 0003 // 0004 // Licensed under the Apache License, Version 2.0 (the "License"); 0005 // you may not use this file except in compliance with the License. 0006 // You may obtain a copy of the License at 0007 // 0008 // https://www.apache.org/licenses/LICENSE-2.0 0009 // 0010 // Unless required by applicable law or agreed to in writing, software 0011 // distributed under the License is distributed on an "AS IS" BASIS, 0012 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0013 // See the License for the specific language governing permissions and 0014 // limitations under the License. 0015 0016 #ifndef ABSL_FLAGS_INTERNAL_COMMANDLINEFLAG_H_ 0017 #define ABSL_FLAGS_INTERNAL_COMMANDLINEFLAG_H_ 0018 0019 #include "absl/base/config.h" 0020 #include "absl/base/internal/fast_type_id.h" 0021 0022 namespace absl { 0023 ABSL_NAMESPACE_BEGIN 0024 namespace flags_internal { 0025 0026 // An alias for flag fast type id. This value identifies the flag value type 0027 // similarly to typeid(T), without relying on RTTI being available. In most 0028 // cases this id is enough to uniquely identify the flag's value type. In a few 0029 // cases we'll have to resort to using actual RTTI implementation if it is 0030 // available. 0031 using FlagFastTypeId = absl::base_internal::FastTypeIdType; 0032 0033 // Options that control SetCommandLineOptionWithMode. 0034 enum FlagSettingMode { 0035 // update the flag's value unconditionally (can call this multiple times). 0036 SET_FLAGS_VALUE, 0037 // update the flag's value, but *only if* it has not yet been updated 0038 // with SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef". 0039 SET_FLAG_IF_DEFAULT, 0040 // set the flag's default value to this. If the flag has not been updated 0041 // yet (via SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef") 0042 // change the flag's current value to the new default value as well. 0043 SET_FLAGS_DEFAULT 0044 }; 0045 0046 // Options that control ParseFrom: Source of a value. 0047 enum ValueSource { 0048 // Flag is being set by value specified on a command line. 0049 kCommandLine, 0050 // Flag is being set by value specified in the code. 0051 kProgrammaticChange, 0052 }; 0053 0054 // Handle to FlagState objects. Specific flag state objects will restore state 0055 // of a flag produced this flag state from method CommandLineFlag::SaveState(). 0056 class FlagStateInterface { 0057 public: 0058 virtual ~FlagStateInterface(); 0059 0060 // Restores the flag originated this object to the saved state. 0061 virtual void Restore() const = 0; 0062 }; 0063 0064 } // namespace flags_internal 0065 ABSL_NAMESPACE_END 0066 } // namespace absl 0067 0068 #endif // ABSL_FLAGS_INTERNAL_COMMANDLINEFLAG_H_
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |