Skip to content

Commit 2ab2012

Browse files
committed
Replace throw() with noexcept.
1 parent a885740 commit 2ab2012

19 files changed

Lines changed: 201 additions & 201 deletions

Application.ixx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public:
2424
static int DisplayError(__in_z const char16_t* message, __in_z_opt const char16_t* formatString, int functionResult);
2525
static void Fail(__in_z const char16_t* message, __in_z_opt const char16_t* formatString, int functionResult);
2626
static void DebugLog(const char16_t* logMessage, ...);
27-
static HRESULT ExceptionToHResult() throw();
27+
static HRESULT ExceptionToHResult() noexcept;
2828
};
2929

3030
HINSTANCE Application::g_hModule = nullptr;

Attributes.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ struct Attribute
140140
static bool IsTypeParsable(Attribute::Type type); // Requires parsing, not just a string of characters.
141141
static Type GetBaseType(Attribute::Type type);
142142

143-
bool IsTypeArray() const throw() { return IsTypeArray(this->type); }
144-
bool AreCompatibleTypes(Attribute::Type type2) const throw() { return AreCompatibleTypes(this->type, type2); }
145-
size_t GetTypeSizeof() const throw() { return GetTypeSizeof(this->type); }
143+
bool IsTypeArray() const noexcept { return IsTypeArray(this->type); }
144+
bool AreCompatibleTypes(Attribute::Type type2) const noexcept { return AreCompatibleTypes(this->type, type2); }
145+
size_t GetTypeSizeof() const noexcept { return GetTypeSizeof(this->type); }
146146

147147
char16_t const* GetPredefinedValueName(uint32_t valueIndex) const;
148148

Common.ArrayRef.ixx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public:
2626
WrapperType(ResourceType resource) : resource_(resource) {}
2727
WrapperType(WrapperType<ResourceType> const& other) : resource_(other.resource_) {}
2828
inline WrapperType() { resource_ = 0; }
29-
inline operator ResourceType() const throw() { return resource_; }
30-
inline operator ResourceType&() throw() { return resource_; }
31-
inline ResourceType* operator&() throw() { return &resource_; }
32-
inline ResourceType operator->() const throw() { return resource_; }
29+
inline operator ResourceType() const noexcept { return resource_; }
30+
inline operator ResourceType&() noexcept { return resource_; }
31+
inline ResourceType* operator&() noexcept { return &resource_; }
32+
inline ResourceType operator->() const noexcept { return resource_; }
3333
inline WrapperType& operator=(ResourceType resource) { resource_ = resource; return *this; }
3434

3535
ResourceType resource_;

Common.AutoResource.Windows.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ template <
77
>
88
struct HandleResourceTypePolicy : public DefaultResourceTypePolicy<ResourceType>
99
{
10-
inline static void Release(ResourceType resource) throw()
10+
inline static void Release(ResourceType resource) noexcept
1111
{
1212
if (resource != 0)
1313
{
@@ -21,7 +21,7 @@ struct HandleResourceTypePolicy : public DefaultResourceTypePolicy<ResourceType>
2121

2222

2323
// Releasing function for WaitHandleResource to pass to use with HandleResourceTypePolicy.
24-
inline void WaitHandleUnregister(HANDLE handle) throw()
24+
inline void WaitHandleUnregister(HANDLE handle) noexcept
2525
{
2626
if (handle != nullptr)
2727
{
@@ -52,15 +52,15 @@ using WaitHandleResource = AutoResource<HANDLE, HandleResourceTypePolicy<HANDLE,
5252

5353
struct ComResourceTypePolicy : public DefaultResourceTypePolicy<IUnknown*>
5454
{
55-
inline static void Acquire(_Inout_opt_ IUnknown* resource) throw()
55+
inline static void Acquire(_Inout_opt_ IUnknown* resource) noexcept
5656
{
5757
if (resource != nullptr)
5858
{
5959
resource->AddRef();
6060
}
6161
}
6262

63-
inline static void Release(_Inout_opt_ IUnknown* resource) throw()
63+
inline static void Release(_Inout_opt_ IUnknown* resource) noexcept
6464
{
6565
if (resource != nullptr)
6666
{

Common.AutoResource.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
template <typename ResourceType = void*> // type of the resource held onto
5050
struct DefaultResourceTypePolicy
5151
{
52-
inline static void InitializeEmpty(_Out_ ResourceType* resource) throw()
52+
inline static void InitializeEmpty(_Out_ ResourceType* resource) noexcept
5353
{
5454
// Most resources (pointers to memory, HGLOBALS, HGDIOBJ...)
5555
// are indicated as empty by setting to 0/NULL. If a resource
@@ -62,17 +62,17 @@ struct DefaultResourceTypePolicy
6262
*resource = 0;
6363
}
6464

65-
inline static bool IsNull(ResourceType resource) throw()
65+
inline static bool IsNull(ResourceType resource) noexcept
6666
{
6767
return (resource == 0);
6868
}
6969

70-
inline static void Acquire(ResourceType resource) throw()
70+
inline static void Acquire(ResourceType resource) noexcept
7171
{
7272
// Do nothing.
7373
}
7474

75-
inline static void Release(ResourceType resource) throw()
75+
inline static void Release(ResourceType resource) noexcept
7676
{
7777
// Do nothing.
7878
}
@@ -121,7 +121,7 @@ class AutoResource
121121
ResourceTypePolicy::InitializeEmpty(Cast(&resource_));
122122
}
123123

124-
inline ~AutoResource() throw()
124+
inline ~AutoResource() noexcept
125125
{
126126
// Notice we merely free the resource and do not zero the resource,
127127
// since we actually prefer to leave the value intact, not because
@@ -137,14 +137,14 @@ class AutoResource
137137

138138
// Implicitly promote to the resource type for all the times the resource
139139
// handle/pointer is passed by value to a function.
140-
inline operator ResourceType() const throw()
140+
inline operator ResourceType() const noexcept
141141
{
142142
return resource_;
143143
}
144144

145145
// Explicit getter for times when the compiler becomes confused
146146
// during overload resolution.
147-
inline ResourceType Get() const throw()
147+
inline ResourceType Get() const noexcept
148148
{
149149
return resource_;
150150
}
@@ -156,27 +156,27 @@ class AutoResource
156156
// since needing the address of a resource is not only for the sake of
157157
// out params - it's perfectly legitimate as an in param too, such as with
158158
// WaitForMultipleObjects().
159-
inline operator ResourceType&() throw()
159+
inline operator ResourceType&() noexcept
160160
{
161161
return resource_;
162162
}
163163

164164
// Used when passed as an out parameter to any function,
165165
// or when the caller needs a pointer to a pointer.
166166
// If modified directly, the caller is responsible for managing the object.
167-
inline ResourceType* operator&() throw()
167+
inline ResourceType* operator&() noexcept
168168
{
169169
return &resource_;
170170
}
171171

172172
// Explicitly named form.
173-
inline ResourceType* Address() throw()
173+
inline ResourceType* Address() noexcept
174174
{
175175
return &resource_;
176176
}
177177

178178
// Explicitly named form.
179-
inline ResourceType& Reference() throw()
179+
inline ResourceType& Reference() noexcept
180180
{
181181
return resource_;
182182
}
@@ -185,7 +185,7 @@ class AutoResource
185185
//
186186
// ComPtr<ICat> cat;
187187
// cat->Meow();
188-
inline ResourceType operator->() const throw()
188+
inline ResourceType operator->() const noexcept
189189
{
190190
return resource_;
191191
}
@@ -253,7 +253,7 @@ class AutoResource
253253
}
254254

255255
// Abandon the resource without freeing it.
256-
inline void Abandon() throw()
256+
inline void Abandon() noexcept
257257
{
258258
ResourceTypePolicy::InitializeEmpty(Cast(&resource_));
259259
}
@@ -262,7 +262,7 @@ class AutoResource
262262
// this Attach does not increment the ref count, which is symmetric
263263
// to Detach().
264264
// * No self-assignment checking is done here.
265-
ResourceType Attach(ResourceType resource) throw()
265+
ResourceType Attach(ResourceType resource) noexcept
266266
{
267267
DEBUG_ASSERT(resource != resource_);
268268
std::swap(resource_, resource);
@@ -272,7 +272,7 @@ class AutoResource
272272

273273
// Lets go of the resource without freeing it, but returning it
274274
// to the caller.
275-
ResourceType Detach() throw()
275+
ResourceType Detach() noexcept
276276
{
277277
ResourceType resource = resource_;
278278
ResourceTypePolicy::InitializeEmpty(Cast(&resource_));
@@ -284,18 +284,18 @@ class AutoResource
284284
//
285285
// p1.Attach(p2.Detach()) -> p1.Steal(p2)
286286
//
287-
inline void Steal(Self& other) throw()
287+
inline void Steal(Self& other) noexcept
288288
{
289289
swap(other);
290290
other.Clear();
291291
}
292292

293-
inline bool IsNull() const throw()
293+
inline bool IsNull() const noexcept
294294
{
295295
return ResourceTypePolicy::IsNull(resource_);
296296
}
297297

298-
inline bool IsSet() const throw()
298+
inline bool IsSet() const noexcept
299299
{
300300
return !ResourceTypePolicy::IsNull(resource_);
301301
}
@@ -308,7 +308,7 @@ class AutoResource
308308
Clear();
309309
}
310310

311-
inline void swap(ResourceType& resource) throw()
311+
inline void swap(ResourceType& resource) noexcept
312312
{
313313
std::swap(resource_, resource);
314314
}
@@ -353,7 +353,7 @@ namespace std
353353
void swap(
354354
AutoResource<ResourceType, ResourceTypePolicy, BaseResourceType>& lhs,
355355
AutoResource<ResourceType, ResourceTypePolicy, BaseResourceType>& rhs
356-
) throw()
356+
) noexcept
357357
{
358358
lhs.swap(rhs);
359359
}
@@ -387,7 +387,7 @@ using UnownedMemoryPointer = AutoResource<ResourceType*, UnownedMemoryPointerPol
387387
template <typename ResourceType>
388388
struct OwnedMemoryPointerPolicy : public DefaultResourceTypePolicy<ResourceType>
389389
{
390-
inline static void Release(ResourceType resource) throw()
390+
inline static void Release(ResourceType resource) noexcept
391391
{
392392
if (resource != nullptr)
393393
{

Common.ListSubstringPrioritizer.h

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
1-
//----------------------------------------------------------------------------
2-
// Author: Dwayne Robinson
3-
// History: 2015-06-19 Created
4-
//----------------------------------------------------------------------------
5-
#pragma once
6-
7-
8-
class ListSubstringPrioritizer
9-
{
10-
struct IndexAndWeight
11-
{
12-
enum WeightValue
13-
{
14-
WeightValueStringPrefix = 0,
15-
WeightValueWordPrefix = 1,
16-
WeightValueSubstring = 2,
17-
WeightValueNoMatch = 3,
18-
};
19-
20-
uint32_t index;
21-
WeightValue weight;
22-
23-
bool operator < (IndexAndWeight const& other) const throw()
24-
{
25-
return weight < other.weight;
26-
}
27-
};
28-
29-
public:
30-
using WeightValue = IndexAndWeight::WeightValue;
31-
32-
ListSubstringPrioritizer(
33-
array_ref<char16_t const> filterString,
34-
uint32_t itemCount
35-
);
36-
37-
WeightValue GetStringWeight(array_ref<char16_t const> name);
38-
void SetItemWeight(uint32_t itemIndex, WeightValue weight);
39-
array_ref<uint32_t> GetItemIndices(_Out_ array_ref<uint32_t> items, bool excludeMismatches);
40-
41-
private:
42-
std::vector<IndexAndWeight> items_;
43-
std::u16string filterString_;
44-
std::u16string majusculeName_;
45-
};
1+
//----------------------------------------------------------------------------
2+
// Author: Dwayne Robinson
3+
// History: 2015-06-19 Created
4+
//----------------------------------------------------------------------------
5+
#pragma once
6+
7+
8+
class ListSubstringPrioritizer
9+
{
10+
struct IndexAndWeight
11+
{
12+
enum WeightValue
13+
{
14+
WeightValueStringPrefix = 0,
15+
WeightValueWordPrefix = 1,
16+
WeightValueSubstring = 2,
17+
WeightValueNoMatch = 3,
18+
};
19+
20+
uint32_t index;
21+
WeightValue weight;
22+
23+
bool operator < (IndexAndWeight const& other) const noexcept
24+
{
25+
return weight < other.weight;
26+
}
27+
};
28+
29+
public:
30+
using WeightValue = IndexAndWeight::WeightValue;
31+
32+
ListSubstringPrioritizer(
33+
array_ref<char16_t const> filterString,
34+
uint32_t itemCount
35+
);
36+
37+
WeightValue GetStringWeight(array_ref<char16_t const> name);
38+
void SetItemWeight(uint32_t itemIndex, WeightValue weight);
39+
array_ref<uint32_t> GetItemIndices(_Out_ array_ref<uint32_t> items, bool excludeMismatches);
40+
41+
private:
42+
std::vector<IndexAndWeight> items_;
43+
std::u16string filterString_;
44+
std::u16string majusculeName_;
45+
};

0 commit comments

Comments
 (0)