MCPcopy Create free account
hub / github.com/Kitware/CMake / CheckFlagTable

Method CheckFlagTable

Source/cmIDEOptions.cxx:99–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table,
100 std::string const& flag, bool& flag_handled)
101{
102 char const* pf = flag.c_str() + 1;
103 // Look for an entry in the flag table matching this flag.
104 for (cmIDEFlagTable const* entry = table; !entry->IDEName.empty(); ++entry) {
105 bool entry_found = false;
106 if (entry->special & cmIDEFlagTable::UserValue) {
107 // This flag table entry accepts a user-specified value. If
108 // the entry specifies UserRequired we must match only if a
109 // non-empty value is given.
110 int n = static_cast<int>(entry->commandFlag.length());
111 if ((strncmp(pf, entry->commandFlag.c_str(), n) == 0 ||
112 (entry->special & cmIDEFlagTable::CaseInsensitive &&
113 cmsysString_strncasecmp(pf, entry->commandFlag.c_str(), n))) &&
114 (!(entry->special & cmIDEFlagTable::UserRequired) ||
115 static_cast<int>(strlen(pf)) > n)) {
116 this->FlagMapUpdate(entry, std::string(pf + n));
117 entry_found = true;
118 }
119 } else if (strcmp(pf, entry->commandFlag.c_str()) == 0 ||
120 (entry->special & cmIDEFlagTable::CaseInsensitive &&
121 cmsysString_strcasecmp(pf, entry->commandFlag.c_str()) == 0)) {
122 if (entry->special & cmIDEFlagTable::UserFollowing) {
123 // This flag expects a value in the following argument.
124 this->DoingFollowing = entry;
125 } else {
126 // This flag table entry provides a fixed value.
127 this->FlagMap[entry->IDEName] = entry->value;
128 }
129 entry_found = true;
130 }
131
132 // If the flag has been handled by an entry not requesting a
133 // search continuation we are done.
134 if (entry_found && !(entry->special & cmIDEFlagTable::Continue)) {
135 return true;
136 }
137
138 // If the entry was found the flag has been handled.
139 flag_handled = flag_handled || entry_found;
140 }
141
142 return false;
143}
144
145void cmIDEOptions::FlagMapUpdate(cmIDEFlagTable const* entry,
146 std::string const& new_value)

Callers 1

HandleFlagMethod · 0.95

Calls 5

FlagMapUpdateMethod · 0.95
c_strMethod · 0.80
lengthMethod · 0.80
strlenFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected