/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/powerrename/lib/PropVariantValue.h
62 строки
1 KB
moooyo
[PowerRename] Support using photo metadata to replace in the PowerRename (#41728)
04 ноя 2025, 04:27
Не верифицирован
04 ноя 2025, 04:27
70e1177
Код
Авторство
О чём код?
#pragma once #include <propvarutil.h> #include <propidl.h> namespace PowerRenameLib { /// <summary> /// RAII wrapper around PROPVARIANT to ensure proper initialization and cleanup. /// Move-only semantics keep ownership simple while still allowing use in optionals. /// </summary> struct PropVariantValue { PropVariantValue() noexcept { PropVariantInit(&value); } ~PropVariantValue() { PropVariantClear(&value); } PropVariantValue(const PropVariantValue&) = delete; PropVariantValue& operator=(const PropVariantValue&) = delete; PropVariantValue(PropVariantValue&& other) noexcept { value = other.value; PropVariantInit(&other.value); // Properly clear the moved-from object } PropVariantValue& operator=(PropVariantValue&& other) noexcept { if (this != &other) { PropVariantClear(&value); value = other.value; PropVariantInit(&other.value); // Properly clear the moved-from object } return *this; } PROPVARIANT* GetAddressOf() noexcept { return &value; } PROPVARIANT& Get() noexcept { return value; } const PROPVARIANT& Get() const noexcept { return value; } private: PROPVARIANT value; }; }