| 404 | } |
| 405 | |
| 406 | bool Find() |
| 407 | { |
| 408 | // reset result members |
| 409 | this->RootKey = cm::string_view{}; |
| 410 | this->SubKey = cm::string_view{}; |
| 411 | this->ValueName = cm::string_view{}; |
| 412 | |
| 413 | auto result = this->RegistryFormat.find(this->Expression); |
| 414 | |
| 415 | if (result) { |
| 416 | auto separator = cm::string_view{ |
| 417 | this->Expression.data() + this->RegistryFormat.start(1), |
| 418 | this->RegistryFormat.end(1) - this->RegistryFormat.start(1) |
| 419 | }; |
| 420 | if (separator.empty()) { |
| 421 | separator = this->Separator; |
| 422 | } else { |
| 423 | separator = separator.substr(1, separator.length() - 2); |
| 424 | } |
| 425 | |
| 426 | this->RootKey = cm::string_view{ |
| 427 | this->Expression.data() + this->RegistryFormat.start(2), |
| 428 | this->RegistryFormat.end(2) - this->RegistryFormat.start(2) |
| 429 | }; |
| 430 | this->SubKey = cm::string_view{ |
| 431 | this->Expression.data() + this->RegistryFormat.start(3), |
| 432 | this->RegistryFormat.end(3) - this->RegistryFormat.start(3) |
| 433 | }; |
| 434 | |
| 435 | auto pos = this->SubKey.find(separator); |
| 436 | if (pos != cm::string_view::npos) { |
| 437 | // split in ValueName and SubKey |
| 438 | this->ValueName = this->SubKey.substr(pos + separator.size()); |
| 439 | if (Strucmp(this->ValueName, "(default)") == 0) { |
| 440 | // handle magic name for default value |
| 441 | this->ValueName = ""_s; |
| 442 | } |
| 443 | this->SubKey = this->SubKey.substr(0, pos); |
| 444 | } else { |
| 445 | this->ValueName = ""_s; |
| 446 | } |
| 447 | } |
| 448 | return result; |
| 449 | } |
| 450 | |
| 451 | #if defined(_WIN32) && !defined(__CYGWIN__) |
| 452 | void Replace(std::string const& value) |