MCPcopy Create free account
hub / github.com/MITK/MITK / ValidateUid

Function ValidateUid

Modules/RESTAPI/src/mitkDataStorageController.cpp:215–222  ·  view source on GitHub ↗

* @brief Validate a UID string. * * UIDs must be alphanumeric plus hyphens and underscores, 1-64 characters. * The REST API UID format is "node_N" (see NodeUidMapper::GenerateUid). * * @param uid The UID to validate. * @return true if valid, false otherwise. */

Source from the content-addressed store, hash-verified

213 * @return true if valid, false otherwise.
214 */
215 bool ValidateUid(const std::string& uid)
216 {
217 if (uid.empty() || uid.size() > 64)
218 return false;
219 return std::all_of(uid.begin(), uid.end(), [](char c) {
220 return std::isalnum(static_cast<unsigned char>(c)) || c == '-' || c == '_';
221 });
222 }
223
224 /**
225 * @brief Validate a property key string.

Calls 4

emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected