1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "CrashAnnotations.h"
15 namespace CrashReporter
{
17 bool AnnotationFromString(Annotation
& aResult
, const char* aValue
) {
18 const auto* elem
= find_if(
19 begin(kAnnotationStrings
), end(kAnnotationStrings
),
20 [&aValue
](const char* aString
) { return strcmp(aString
, aValue
) == 0; });
22 if (elem
== end(kAnnotationStrings
)) {
26 aResult
= static_cast<Annotation
>(elem
- begin(kAnnotationStrings
));
30 bool IsAnnotationAllowedForPing(Annotation aAnnotation
) {
31 const auto* elem
= find_if(
32 begin(kCrashPingAllowedList
), end(kCrashPingAllowedList
),
33 [&aAnnotation
](Annotation aElement
) { return aElement
== aAnnotation
; });
35 return elem
!= end(kCrashPingAllowedList
);
38 bool ShouldIncludeAnnotation(Annotation aAnnotation
, const char* aValue
) {
39 const auto* elem
= find_if(begin(kSkipIfList
), end(kSkipIfList
),
40 [&aAnnotation
](AnnotationSkipValue aElement
) {
41 return aElement
.annotation
== aAnnotation
;
44 if (elem
!= end(kSkipIfList
)) {
45 if (strcmp(aValue
, elem
->value
) == 0) {
53 } // namespace CrashReporter