Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
DiffResource Struct Reference

#include <skdiff.h>

Public Types

enum  Status {
  kDecoded_Status , kCouldNotDecode_Status , kRead_Status , kCouldNotRead_Status ,
  kExists_Status , kDoesNotExist_Status , kSpecified_Status , kUnspecified_Status ,
  kUnknown_Status , kStatusCount
}
 

Public Member Functions

 DiffResource ()
 

Static Public Member Functions

static Status getStatusByName (const char *name)
 
static const char * getStatusDescription (Status status)
 
static bool isStatusFailed (Status status)
 
static bool getMatchingStatuses (char *selector, bool statuses[kStatusCount])
 

Public Attributes

SkString fFilename
 
SkString fFullPath
 
SkBitmap fBitmap
 
Status fStatus
 

Static Public Attributes

static char const *const StatusNames [DiffResource::kStatusCount]
 

Detailed Description

Definition at line 29 of file skdiff.h.

Member Enumeration Documentation

◆ Status

Enumerator
kDecoded_Status 

The resource was specified, exists, read, and decoded.

kCouldNotDecode_Status 

The resource was specified, exists, read, but could not be decoded.

kRead_Status 

The resource was specified, exists, and read.

kCouldNotRead_Status 

The resource was specified, exists, but could not be read.

kExists_Status 

The resource was specified and exists.

kDoesNotExist_Status 

The resource was specified, but does not exist.

kSpecified_Status 

The resource was specified.

kUnspecified_Status 

The resource was not specified.

kUnknown_Status 

Nothing is yet known about the resource.

kStatusCount 

NOT A VALID VALUE – used to set up arrays and to represent an unknown value.

Definition at line 30 of file skdiff.h.

30 {
31 /** The resource was specified, exists, read, and decoded. */
33 /** The resource was specified, exists, read, but could not be decoded. */
35
36 /** The resource was specified, exists, and read. */
38 /** The resource was specified, exists, but could not be read. */
40
41 /** The resource was specified and exists. */
43 /** The resource was specified, but does not exist. */
45
46 /** The resource was specified. */
48 /** The resource was not specified. */
50
51 /** Nothing is yet known about the resource. */
53
54 /** NOT A VALID VALUE -- used to set up arrays and to represent an unknown value. */
56 };
@ kCouldNotDecode_Status
Definition: skdiff.h:34
@ kRead_Status
Definition: skdiff.h:37
@ kExists_Status
Definition: skdiff.h:42
@ kCouldNotRead_Status
Definition: skdiff.h:39
@ kDoesNotExist_Status
Definition: skdiff.h:44
@ kStatusCount
Definition: skdiff.h:55
@ kUnknown_Status
Definition: skdiff.h:52
@ kSpecified_Status
Definition: skdiff.h:47
@ kDecoded_Status
Definition: skdiff.h:32
@ kUnspecified_Status
Definition: skdiff.h:49

Constructor & Destructor Documentation

◆ DiffResource()

DiffResource::DiffResource ( )
inline

Definition at line 76 of file skdiff.h.

SkString fFullPath
Definition: skdiff.h:81
SkBitmap fBitmap
Definition: skdiff.h:83
Status fStatus
Definition: skdiff.h:84
SkString fFilename
Definition: skdiff.h:79

Member Function Documentation

◆ getMatchingStatuses()

bool DiffResource::getMatchingStatuses ( char *  selector,
bool  statuses[kStatusCount] 
)
static

Sets statuses[i] if it is implied by selector, unsets it if not. Selector may be a comma delimited list of status names, "any", or "failed". Returns true if the selector was entirely understood, false otherwise.

Definition at line 98 of file skdiff.cpp.

98 {
99 if (!strcmp(selector, "any")) {
100 for (int statusIndex = 0; statusIndex < kStatusCount; ++statusIndex) {
101 statuses[statusIndex] = true;
102 }
103 return true;
104 }
105
106 for (int statusIndex = 0; statusIndex < kStatusCount; ++statusIndex) {
107 statuses[statusIndex] = false;
108 }
109
110 static const char kDelimiterChar = ',';
111 bool understood = true;
112 while (true) {
113 char* delimiterPtr = strchr(selector, kDelimiterChar);
114
115 if (delimiterPtr) {
116 *delimiterPtr = '\0';
117 }
118
119 if (!strcmp(selector, "failed")) {
120 for (int statusIndex = 0; statusIndex < kStatusCount; ++statusIndex) {
121 Status status = static_cast<Status>(statusIndex);
122 statuses[statusIndex] |= isStatusFailed(status);
123 }
124 } else {
125 Status status = getStatusByName(selector);
126 if (status == kStatusCount) {
127 understood = false;
128 } else {
129 statuses[status] = true;
130 }
131 }
132
133 if (!delimiterPtr) {
134 break;
135 }
136
137 *delimiterPtr = kDelimiterChar;
138 selector = delimiterPtr + 1;
139 }
140 return understood;
141}
static Status getStatusByName(const char *name)
Definition: skdiff.cpp:61
static bool isStatusFailed(Status status)
Definition: skdiff.cpp:90

◆ getStatusByName()

DiffResource::Status DiffResource::getStatusByName ( const char *  name)
static

Returns the Status with this name. If there is no Status with this name, returns kStatusCount.

Definition at line 61 of file skdiff.cpp.

61 {
62 for (int status = 0; status < DiffResource::kStatusCount; ++status) {
63 if (0 == strcmp(DiffResource::StatusNames[status], name)) {
64 return static_cast<DiffResource::Status>(status);
65 }
66 }
68}
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
static char const *const StatusNames[DiffResource::kStatusCount]
Definition: skdiff.h:57

◆ getStatusDescription()

const char * DiffResource::getStatusDescription ( DiffResource::Status  status)
static

Returns a text description of the given Status type.

Definition at line 86 of file skdiff.cpp.

86 {
87 return StatusDescriptions[status];
88}
static char const *const StatusDescriptions[DiffResource::kStatusCount]
Definition: skdiff.cpp:70

◆ isStatusFailed()

bool DiffResource::isStatusFailed ( DiffResource::Status  status)
static

Returns true if the Status indicates some kind of failure.

Definition at line 90 of file skdiff.cpp.

Member Data Documentation

◆ fBitmap

SkBitmap DiffResource::fBitmap

If empty() indicates the bitmap could not be created.

Definition at line 83 of file skdiff.h.

◆ fFilename

SkString DiffResource::fFilename

If isEmpty() indicates no filename available.

Definition at line 79 of file skdiff.h.

◆ fFullPath

SkString DiffResource::fFullPath

If isEmpty() indicates no path available.

Definition at line 81 of file skdiff.h.

◆ fStatus

Status DiffResource::fStatus

Definition at line 84 of file skdiff.h.

◆ StatusNames

char const *const DiffResource::StatusNames
static
Initial value:
= {
"Decoded",
"CouldNotDecode",
"Read",
"CouldNotRead",
"Exists",
"DoesNotExist",
"Specified",
"Unspecified",
"Unknown",
}

Definition at line 57 of file skdiff.h.


The documentation for this struct was generated from the following files: