Chromium Code Reviews| Index: include/core/SkDocument.h |
| diff --git a/include/core/SkDocument.h b/include/core/SkDocument.h |
| index a35f448208701d4c76af7eafb9a57ab56618fbd9..a0d3319053389d4da6f937fdd98a7e4bb45329b1 100644 |
| --- a/include/core/SkDocument.h |
| +++ b/include/core/SkDocument.h |
| @@ -12,6 +12,8 @@ |
| #include "SkPicture.h" |
| #include "SkRect.h" |
| #include "SkRefCnt.h" |
| +#include "SkString.h" |
| +#include "SkTime.h" |
| class SkCanvas; |
| class SkWStream; |
| @@ -104,6 +106,33 @@ public: |
| */ |
| void abort(); |
| + /** |
| + * Set the document's metadata, if supported by the document |
| + * type. The creationDate and modifiedDate parameters can be |
| + * nullptr. For example: |
| + * |
| + * SkDocument* make_doc(SkWStream* output) { |
| + * SkTArray<SkDocument::Attribute> info; |
| + * info.emplace_back(SkString("Title"), SkString("...")); |
| + * info.emplace_back(SkString("Author"), SkString("...")); |
| + * info.emplace_back(SkString("Subject"), SkString("...")); |
| + * info.emplace_back(SkString("Keywords"), SkString("...")); |
| + * info.emplace_back(SkString("Creator"), SkString("...")); |
| + * SkTime::DateTime now; |
| + * SkTime::GetDateTime(&now); |
| + * SkDocument* doc = SkDocument::CreatePDF(output); |
| + * doc->setMetadata(info, &now, &now); |
| + * return doc; |
| + * } |
| + */ |
| + struct Attribute { |
| + SkString key, value; |
|
reed1
2015/09/23 10:14:47
following skia fNaming fConvention?
hal.canary
2015/09/23 12:42:43
Done.
|
| + Attribute(const SkString& k, const SkString& v) : key(k), value(v) {} |
| + }; |
| + virtual void setMetadata(const SkTArray<SkDocument::Attribute>&, |
| + const SkTime::DateTime* /* creationDate */, |
| + const SkTime::DateTime* /* modifiedDate */) {} |
| + |
| protected: |
| SkDocument(SkWStream*, void (*)(SkWStream*, bool aborted)); |