mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
* Add boost-regex library * If enabled use boost lib for regex Add property `_useBoostLib` to `CPowerRenameRegEx`. If enabled for replacements with regular expressions the Boost Library is used instead of the Standard Library. * Extend signatures to create RegEx with Boost Extend create and constructor singatures of `CPowerRenameRegEx` with an option to enable (or disabled, which is default) the Boost Library. * Verify Lookbehind fails with STD library To verify that the boost library is disabled as expected, check if a lookbehind fails. * Add Unit tests for RegEx with Boost Add unit tests to verify regex replacement with Boost Library. They are copied and adapted from the Standard Library tests. * Improve verify capturing groups test with Boost It is possible to use a capturing group followed by numbers as replacement if the group number is enclosed in curly braces. Added test cases based on the Standard Library tests. * Add useBoostLib to settings interface * Get library option from settings object * Reduce signatures of RegEx by "useBoost" Remove the parameter added in 19105cf, as it became obsolete. * Settings: Read useBoostLib from JSON file * Add UseBoostLib Option to UI * Boost Lib label states the regex syntax difference * Fix Regex with Boost Lib tests - Do not load settings another time in CPowerRenameRegEx ctor - Set flag correctly in standard library regex tests * Add "lookbehind" to dictionary * change Library to lowercase, and also add a comment As suggested by @enricogior. Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com> * Change Library to lowercase and add a comment As suggested by @enricogior. Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com>
91 lines
3.3 KiB
C++
91 lines
3.3 KiB
C++
#include "pch.h"
|
|
#include "trace.h"
|
|
#include "Settings.h"
|
|
|
|
TRACELOGGING_DEFINE_PROVIDER(
|
|
g_hProvider,
|
|
"Microsoft.PowerToys",
|
|
// {38e8889b-9731-53f5-e901-e8a7c1753074}
|
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
|
TraceLoggingOptionProjectTelemetry());
|
|
|
|
void Trace::RegisterProvider() noexcept
|
|
{
|
|
TraceLoggingRegister(g_hProvider);
|
|
}
|
|
|
|
void Trace::UnregisterProvider() noexcept
|
|
{
|
|
TraceLoggingUnregister(g_hProvider);
|
|
}
|
|
|
|
void Trace::Invoked() noexcept
|
|
{
|
|
TraceLoggingWrite(
|
|
g_hProvider,
|
|
"PowerRename_Invoked",
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
}
|
|
|
|
void Trace::InvokedRet(_In_ HRESULT hr) noexcept
|
|
{
|
|
TraceLoggingWrite(
|
|
g_hProvider,
|
|
"PowerRename_InvokedRet",
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingHResult(hr),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
}
|
|
|
|
void Trace::EnablePowerRename(_In_ bool enabled) noexcept
|
|
{
|
|
TraceLoggingWrite(
|
|
g_hProvider,
|
|
"PowerRename_EnablePowerRename",
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
|
TraceLoggingBoolean(enabled, "Enabled"));
|
|
}
|
|
|
|
void Trace::UIShownRet(_In_ HRESULT hr) noexcept
|
|
{
|
|
TraceLoggingWrite(
|
|
g_hProvider,
|
|
"PowerRename_UIShownRet",
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingHResult(hr),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
}
|
|
|
|
void Trace::RenameOperation(_In_ UINT totalItemCount, _In_ UINT selectedItemCount, _In_ UINT renameItemCount, _In_ DWORD flags, _In_ PCWSTR extensionList) noexcept
|
|
{
|
|
TraceLoggingWrite(
|
|
g_hProvider,
|
|
"PowerRename_RenameOperation",
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
|
TraceLoggingUInt32(totalItemCount, "TotalItemCount"),
|
|
TraceLoggingUInt32(selectedItemCount, "SelectedItemCount"),
|
|
TraceLoggingUInt32(renameItemCount, "RenameItemCount"),
|
|
TraceLoggingInt32(flags, "Flags"),
|
|
TraceLoggingWideString(extensionList, "ExtensionList"));
|
|
}
|
|
|
|
void Trace::SettingsChanged() noexcept
|
|
{
|
|
TraceLoggingWrite(
|
|
g_hProvider,
|
|
"PowerRename_SettingsChanged",
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
|
TraceLoggingBoolean(CSettingsInstance().GetEnabled(), "IsEnabled"),
|
|
TraceLoggingBoolean(CSettingsInstance().GetShowIconOnMenu(), "ShowIconOnMenu"),
|
|
TraceLoggingBoolean(CSettingsInstance().GetExtendedContextMenuOnly(), "ExtendedContextMenuOnly"),
|
|
TraceLoggingBoolean(CSettingsInstance().GetPersistState(), "PersistState"),
|
|
TraceLoggingBoolean(CSettingsInstance().GetMRUEnabled(), "IsMRUEnabled"),
|
|
TraceLoggingUInt64(CSettingsInstance().GetMaxMRUSize(), "MaxMRUSize"),
|
|
TraceLoggingBoolean(CSettingsInstance().GetUseBoostLib(), "UseBoostLib"),
|
|
TraceLoggingUInt64(CSettingsInstance().GetFlags(), "Flags"));
|
|
}
|