summaryrefslogtreecommitdiff
path: root/includes/image_io/jpeg/jpeg_segment_lister.h
blob: ca2a19d9299f49d0a75133e97faaa4d9c0678fbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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