Lines Matching refs:alias
46 std::ostream& operator<<(std::ostream& out, const FlagAlias& alias) { in operator <<() argument
47 switch (alias.mode) { in operator <<()
49 return out << alias.name; in operator <<()
51 return out << alias.name << "*"; in operator <<()
53 return out << alias.name << " *"; in operator <<()
55 LOG(FATAL) << "Unexpected flag alias mode " << (int)alias.mode; in operator <<()
60 Flag& Flag::UnvalidatedAlias(const FlagAlias& alias) & { in UnvalidatedAlias() argument
61 aliases_.push_back(alias); in UnvalidatedAlias()
64 Flag Flag::UnvalidatedAlias(const FlagAlias& alias) && { in UnvalidatedAlias() argument
65 aliases_.push_back(alias); in UnvalidatedAlias()
69 void Flag::ValidateAlias(const FlagAlias& alias) { in ValidateAlias() argument
73 CHECK(StartsWith(alias.name, "-")) << "Flags should start with \"-\""; in ValidateAlias()
74 if (alias.mode == FlagAliasMode::kFlagPrefix) { in ValidateAlias()
75 CHECK(EndsWith(alias.name, "=")) << "Prefix flags should end with \"=\""; in ValidateAlias()
78 CHECK(!HasAlias(alias)) << "Duplicate flag alias: " << alias.name; in ValidateAlias()
79 if (alias.mode == FlagAliasMode::kFlagConsumesFollowing) { in ValidateAlias()
80 CHECK(!HasAlias({FlagAliasMode::kFlagExact, alias.name})) in ValidateAlias()
81 << "Overlapping flag aliases for " << alias.name; in ValidateAlias()
82 CHECK(!HasAlias({FlagAliasMode::kFlagConsumesArbitrary, alias.name})) in ValidateAlias()
83 << "Overlapping flag aliases for " << alias.name; in ValidateAlias()
84 } else if (alias.mode == FlagAliasMode::kFlagExact) { in ValidateAlias()
85 CHECK(!HasAlias({FlagAliasMode::kFlagConsumesFollowing, alias.name})) in ValidateAlias()
86 << "Overlapping flag aliases for " << alias.name; in ValidateAlias()
87 CHECK(!HasAlias({FlagAliasMode::kFlagConsumesArbitrary, alias.name})) in ValidateAlias()
88 << "Overlapping flag aliases for " << alias.name; in ValidateAlias()
89 } else if (alias.mode == FlagAliasMode::kFlagConsumesArbitrary) { in ValidateAlias()
90 CHECK(!HasAlias({FlagAliasMode::kFlagExact, alias.name})) in ValidateAlias()
91 << "Overlapping flag aliases for " << alias.name; in ValidateAlias()
92 CHECK(!HasAlias({FlagAliasMode::kFlagConsumesFollowing, alias.name})) in ValidateAlias()
93 << "Overlapping flag aliases for " << alias.name; in ValidateAlias()
97 Flag& Flag::Alias(const FlagAlias& alias) & { in Alias() argument
98 ValidateAlias(alias); in Alias()
99 aliases_.push_back(alias); in Alias()
102 Flag Flag::Alias(const FlagAlias& alias) && { in Alias() argument
103 ValidateAlias(alias); in Alias()
104 aliases_.push_back(alias); in Alias()
156 for (auto& alias : aliases_) { in Process() local
157 auto normalized_alias = StringReplace(alias.name, "-", "_", true); in Process()
158 switch (alias.mode) { in Process()
189 CF_EXPECTF((*setter_)({alias.name, arg.substr(alias.name.size())}), in Process()
193 return CF_ERRF("Unknown flag alias mode: {}", (int)alias.mode); in Process()
229 for (const auto& alias : aliases_) { in HasAlias() local
230 if (alias.mode == test.mode && alias.name == test.name) { in HasAlias()
244 for (const auto& alias : aliases_) { in WriteGflagsCompatXml() local
245 std::string_view name = alias.name; in WriteGflagsCompatXml()
250 if (alias.mode == FlagAliasMode::kFlagExact) { in WriteGflagsCompatXml()
253 } else if (alias.mode == FlagAliasMode::kFlagConsumesFollowing) { in WriteGflagsCompatXml()
255 } else if (alias.mode == FlagAliasMode::kFlagPrefix) { in WriteGflagsCompatXml()