skia2/tools/bookmaker/bookmaker.h
Cary Clark abaffd85ab bookmaker does deprecated
Bookmaker does not require documentation for public symbols
described as "deprecated", "private", or "experimental".
Adding one of these words (case-insensitive) to the symbol
description in the include file tells bookmaker that the bmh file
should not include documentation, and the generated markdown
should omit it in its indices and descriptions.

Symbols marked as "to be deprecated" or "may be deprecated"
are still regarded as public and documented.

Private notes in the includes that start with TODO: are
omitted as well.

This CL updated generated includes to describe its symbols
accordingly. The includes will be fully regenerated in a future
CL. The corresponding documentation has been deleted from the
bmh files, and the web markup has been regenerated.

TBR=reed@google.com
Docs-Preview: https://skia.org/?cl=169830
Bug: skia:
Change-Id: Ie6ec3ccdadb7be9ac15db4811823a30948c4af25
Reviewed-on: https://skia-review.googlesource.com/c/169830
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
2018-11-15 14:08:45 +00:00

233 lines
4.4 KiB
C++

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef bookmaker_DEFINED
#define bookmaker_DEFINED
#include <algorithm>
#include <cmath>
#include <cctype>
#include <cstring>
#include <forward_list>
#include <list>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>
#include "SkTypes.h"
using std::forward_list;
using std::list;
using std::string;
using std::unordered_map;
using std::vector;
class Definition;
class NonAssignable {
public:
NonAssignable(NonAssignable const&) = delete;
NonAssignable& operator=(NonAssignable const&) = delete;
NonAssignable() {}
};
#define FPRINTF(...) \
if (fDebugOut) { \
SkDebugf(__VA_ARGS__); \
} \
fprintf(fOut, __VA_ARGS__)
// std::to_string isn't implemented on android
template <typename T>
string to_string(T value)
{
std::ostringstream os ;
os << value ;
return os.str() ;
}
enum class KeyWord {
kNone,
kSK_API,
kSK_BEGIN_REQUIRE_DENSE,
kAlignAs,
kBool,
kChar,
kClass,
kConst,
kConstExpr,
kDefine,
kDouble,
kElif,
kElse,
kEndif,
kEnum,
kError,
kFloat,
kFriend,
kIf,
kIfdef,
kIfndef,
kInclude,
kInline,
kInt,
kOperator,
kPrivate,
kProtected,
kPublic,
kSigned,
kSize_t,
kStatic,
kStruct,
kTemplate,
kTypedef,
kTypename,
kUint16_t,
kUint32_t,
kUint64_t,
kUint8_t,
kUintPtr_t,
kUnion,
kUnsigned,
kUsing,
kVoid,
};
enum class MarkType {
kNone,
kAnchor,
kAlias,
kBug,
kClass,
kCode,
kColumn,
kComment,
kConst,
kDefine,
kDescription,
kDetails, // used by #Const to specify #Subtopic details with examples and so on
kDuration,
kEnum,
kEnumClass,
kExample,
kExternal,
kFile,
kFilter,
kFormula,
kFunction,
kHeight,
kIllustration,
kImage,
kIn,
kLegend,
kLine,
kLink, // used internally by #Anchor
kList,
kLiteral, // don't lookup hyperlinks, do substitution, etc
kMarkChar,
kMember,
kMethod,
kNoExample,
kNoJustify, // don't contribute this #Line to tabular comment measure, even if it fits
kOutdent,
kParam,
kPhraseDef,
kPhraseParam,
kPhraseRef,
kPlatform,
kPopulate,
kReturn,
kRow,
kSeeAlso,
kSet,
kStdOut,
kStruct,
kSubstitute,
kSubtopic,
kTable,
kTemplate,
kText,
kToDo,
kTopic,
kTypedef,
kUnion,
kUsing,
kVolatile,
kWidth,
};
enum {
Last_MarkType = (int) MarkType::kWidth,
};
enum class Bracket {
kNone,
kParen,
kSquare,
kBrace,
kAngle,
kString,
kChar,
kSlashStar,
kSlashSlash,
kPound,
kColon,
kDebugCode, // parens get special treatment so SkDEBUGCODE( isn't treated as method
};
enum class Punctuation { // catch-all for misc symbols tracked in C
kNone,
kAsterisk, // for pointer-to
kSemicolon, // e.g., to delinate xxx() const ; const int* yyy()
kLeftBrace,
kColon, // for foo() : bar(1), baz(2) {}
};
enum class KeyProperty {
kNone,
kClassSection,
kFunction,
kModifier,
kNumber,
kObject,
kPreprocessor,
};
struct IncludeKey {
const char* fName;
KeyWord fKeyWord;
KeyProperty fProperty;
};
extern const IncludeKey kKeyWords[];
struct NameMap {
void copyToParent(NameMap* parent) const;
void setParams(Definition* bmhDef, Definition* iMethod);
string fName;
NameMap* fParent = nullptr;
unordered_map<string, string> fLinkMap; // from SkRect to #Rect
// ref map includes "xxx", "xxx ", "xxx yyy", "xxx zzz", etc.
unordered_map<string, Definition*> fRefMap; // e.g., from #Substitute entry to #Topic entry
};
enum class Resolvable {
kNo, // neither resolved nor output
kYes, // resolved, output
kOut, // mostly resolved, output (FIXME: is this really different from kYes?)
kCode, // resolve methods as they are used, not as they are prototyped
kFormula, // kCode, plus make most spaces non-breaking
kLiteral, // output untouched
kClone, // resolved, output, with references to clones as well
kSimple, // resolve simple words (used to resolve method declarations)
kInclude, // like simple, plus reverse resolve SkXXX to XXX
};
#endif