summaryrefslogtreecommitdiff
path: root/core/fpdfapi/edit/cpdf_pagecontentmanager.h
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-06-12 22:00:25 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-12 22:00:25 +0000
commit81a3085b250deafd18a2183a311cc57e2ec1c6f0 (patch)
treeacb64876cc05144da98690ea4d6b118045514120 /core/fpdfapi/edit/cpdf_pagecontentmanager.h
parent62d8ebeee58c5da29102e61d25b28967a1b2aa04 (diff)
downloadpdfium-81a3085b250deafd18a2183a311cc57e2ec1c6f0.tar.xz
Refactor modification of Contents in CPDF_PageContentGenerator.
This is a pure refactor, there should be no change in behavior. It prepares for the next CL, which will allow modification of content streams. Bug: pdfium:1051 Change-Id: I01ca3e897efe423e89df75e1f31cd67539cc3d08 Reviewed-on: https://pdfium-review.googlesource.com/34470 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/edit/cpdf_pagecontentmanager.h')
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentmanager.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentmanager.h b/core/fpdfapi/edit/cpdf_pagecontentmanager.h
new file mode 100644
index 0000000000..384405b188
--- /dev/null
+++ b/core/fpdfapi/edit/cpdf_pagecontentmanager.h
@@ -0,0 +1,38 @@
+// Copyright 2018 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTMANAGER_H_
+#define CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTMANAGER_H_
+
+#include <sstream>
+
+#include "core/fxcrt/unowned_ptr.h"
+
+class CPDF_Array;
+class CPDF_Document;
+class CPDF_Object;
+class CPDF_Stream;
+class CPDF_PageObjectHolder;
+
+class CPDF_PageContentManager {
+ public:
+ explicit CPDF_PageContentManager(CPDF_PageObjectHolder* pObjHolder);
+ ~CPDF_PageContentManager();
+
+ // Gets the Content stream at a given index. If Contents is a single stream
+ // rather than an array, it is considered to be at index 0.
+ CPDF_Stream* GetStreamByIndex(size_t stream_index);
+
+ // Adds a new Content stream. Its index in the array will be returned, or 0
+ // if Contents is not an array, but only a single stream.
+ size_t AddStream(std::ostringstream* buf);
+
+ private:
+ UnownedPtr<CPDF_PageObjectHolder> const obj_holder_;
+ UnownedPtr<CPDF_Document> const doc_;
+ UnownedPtr<CPDF_Array> contents_array_;
+ UnownedPtr<CPDF_Stream> contents_stream_;
+};
+
+#endif // CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTMANAGER_H_