Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: gm/gm_error.h

Issue 14187007: GM: allow caller to specify which result types trigger an error (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: sync_to_r8651 Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gm/gmmain.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gm_error.h
===================================================================
--- gm/gm_error.h (revision 8651)
+++ gm/gm_error.h (working copy)
@@ -58,6 +58,22 @@
}
/**
+ * Fills in "type" with the ErrorType associated with name "name".
+ * Returns true if we found one, false if it is an unknown type name.
+ */
+ static bool getErrorTypeByName(const char name[], ErrorType *type) {
+ for (int typeInt = 0; typeInt <= kLast_ErrorType; typeInt++) {
+ ErrorType thisType = static_cast<ErrorType>(typeInt);
+ const char *thisTypeName = getErrorTypeName(thisType);
+ if (0 == strcmp(thisTypeName, name)) {
+ *type = thisType;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* A combination of 0 or more ErrorTypes.
*/
class ErrorCombination {
@@ -94,6 +110,26 @@
}
/**
+ * Returns a string representation of all ErrorTypes in this
+ * ErrorCombination.
+ *
+ * @param separator text with which to separate ErrorType names
+ */
+ SkString asString(const char separator[]) const {
+ SkString s;
+ for (int typeInt = 0; typeInt <= kLast_ErrorType; typeInt++) {
+ ErrorType type = static_cast<ErrorType>(typeInt);
+ if (this->includes(type)) {
+ if (!s.isEmpty()) {
+ s.append(separator);
+ }
+ s.append(getErrorTypeName(type));
+ }
+ }
+ return s;
+ }
+
+ /**
* Returns a new ErrorCombination, which includes the union of all
* ErrorTypes in two ErrorCombination objects (this and other).
*/
« no previous file with comments | « no previous file | gm/gmmain.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698