diff options
author | 2018-02-07 07:27:09 -0500 | |
---|---|---|
committer | 2018-02-07 12:46:16 +0000 | |
commit | 78de7519692ea93a2d2c70f8c0e773668df49fce (patch) | |
tree | 3c6510b3d8b6b53c23c68efb6dd12fc9ad5666c2 /tools/bookmaker/definition.cpp | |
parent | d521b0cc73717186559b9bbaf9728d107bb6b975 (diff) |
add subtopics to all methods
add self-check looking for #In markup on every method, pointing
to an existing #Subtopic to reference the method.
Docs-Preview: https://skia.org/?cl=104325
Bug: skia:6898
Change-Id: I749a25b9a43033ae68d193249b2c0b810dcf8fc8
Reviewed-on: https://skia-review.googlesource.com/104325
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'tools/bookmaker/definition.cpp')
-rw-r--r-- | tools/bookmaker/definition.cpp | 82 |
1 files changed, 78 insertions, 4 deletions
diff --git a/tools/bookmaker/definition.cpp b/tools/bookmaker/definition.cpp index 757169b1a9..25d154386d 100644 --- a/tools/bookmaker/definition.cpp +++ b/tools/bookmaker/definition.cpp @@ -897,7 +897,7 @@ bool Definition::crossCheckInside(const char* start, const char* end, return false; } -string Definition::formatFunction() const { +string Definition::formatFunction(Format format) const { const char* end = fContentStart; while (end > fStart && ' ' >= end[-1]) { --end; @@ -913,6 +913,9 @@ string Definition::formatFunction() const { const char* nameInParser = methodParser.strnstr(name.c_str(), methodParser.fEnd); methodParser.skipTo(nameInParser); const char* lastEnd = methodParser.fChar; + if (Format::kOmitReturn == format) { + lastStart = lastEnd; + } const char* paren = methodParser.strnchr('(', methodParser.fEnd); size_t indent; if (paren) { @@ -983,8 +986,10 @@ string Definition::formatFunction() const { if (delimiter) { if (nextEnd - nextStart >= (ptrdiff_t) (limit - written)) { written = indent; - methodStr += '\n'; - methodStr += string(indent, ' '); + if (Format::kIncludeReturn == format) { + methodStr += '\n'; + methodStr += string(indent, ' '); + } } methodParser.skipTo(delimiter); } @@ -1214,7 +1219,76 @@ string Definition::NormalizedName(string name) { return normalizedName; } -bool Definition::paramsMatch(const string& match, const string& name) const { +static string unpreformat(const string& orig) { + string result; + int amp = 0; + for (auto c : orig) { + switch (amp) { + case 0: + if ('&' == c) { + amp = 1; + } else { + amp = 0; + result += c; + } + break; + case 1: + if ('l' == c) { + amp = 2; + } else if ('g' == c) { + amp = 3; + } else { + amp = 0; + result += "&"; + result += c; + } + break; + case 2: + if ('t' == c) { + amp = 4; + } else { + amp = 0; + result += "&l"; + result += c; + } + break; + case 3: + if ('t' == c) { + amp = 5; + } else { + amp = 0; + result += "&g"; + result += c; + } + break; + case 4: + if (';' == c) { + result += '<'; + } else { + result += "<"; + result += c; + } + amp = 0; + break; + case 5: + if (';' == c) { + result += '>'; + } else { + result += ">"; + result += c; + } + amp = 0; + break; + } + } + return result; +} + +bool Definition::paramsMatch(const string& matchFormatted, const string& name) const { + if (string::npos != matchFormatted.find("readPixels")) { + SkDebugf(""); + } + string match = unpreformat(matchFormatted); TextParser def(fFileName, fStart, fContentStart, fLineCount); const char* dName = def.strnstr(name.c_str(), fContentStart); if (!dName) { |