summaryrefslogtreecommitdiff
path: root/includes/image_io/jpeg/jpeg_segment_lister.h
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2018-11-15 16:07:46 -0800
committerEino-Ville Talvala <etalvala@google.com>2018-11-15 16:07:46 -0800
commit2d6d3250dcb304c8ad081dedc8eef6ea48fd669d (patch)
tree68cc8d5a9bf5a558f46025d740c47cb292eea9f0 /includes/image_io/jpeg/jpeg_segment_lister.h
parent840fc3b66a9e6593d542ada6fe14d91107fab98d (diff)
downloadimage_io-2d6d3250dcb304c8ad081dedc8eef6ea48fd669d.tar.gz
Initial commit of libimage_io
Image_io is a library for manipulating image files, especially XMP metadata within them. Test: m libimage_io Bug: 109735087 Bug: 119211681 Change-Id: I657f307be0459fe40154806c7cd388b97bcb0ea5
Diffstat (limited to 'includes/image_io/jpeg/jpeg_segment_lister.h')
-rw-r--r--includes/image_io/jpeg/jpeg_segment_lister.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/includes/image_io/jpeg/jpeg_segment_lister.h b/includes/image_io/jpeg/jpeg_segment_lister.h
new file mode 100644
index 0000000..ca2a19d
--- /dev/null
+++ b/includes/image_io/jpeg/jpeg_segment_lister.h
@@ -0,0 +1,35 @@
+#ifndef IMAGE_IO_JPEG_JPEG_SEGMENT_LISTER_H_ // NOLINT
+#define IMAGE_IO_JPEG_JPEG_SEGMENT_LISTER_H_ // NOLINT
+
+#include <string>
+#include <vector>
+
+#include "image_io/jpeg/jpeg_segment_processor.h"
+
+namespace photos_editing_formats {
+namespace image_io {
+
+/// JpegSegmentLister is an implementation of JpegSegmentProcesor that creates
+/// a listing (in the form of a vector of strings) describing the segments.
+class JpegSegmentLister : public JpegSegmentProcessor {
+ public:
+ JpegSegmentLister();
+ void Start(JpegScanner* scanner) override;
+ void Process(JpegScanner* scanner, const JpegSegment& segment) override;
+ void Finish(JpegScanner* scanner) override;
+
+ /// @return The lines representing the listing of the segments.
+ const std::vector<std::string>& GetLines() const { return lines_; }
+
+ private:
+ /// The number of occurences of the various segment types.
+ std::vector<int> marker_type_counts_;
+
+ /// The lines representing the listing output.
+ std::vector<std::string> lines_;
+};
+
+} // namespace image_io
+} // namespace photos_editing_formats
+
+#endif // IMAGE_IO_JPEG_JPEG_SEGMENT_LISTER_H_ // NOLINT