• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef IMAGE_IO_JPEG_JPEG_XMP_INFO_BUILDER_H_  // NOLINT
2 #define IMAGE_IO_JPEG_JPEG_XMP_INFO_BUILDER_H_  // NOLINT
3 
4 #include <vector>
5 
6 #include "image_io/jpeg/jpeg_segment.h"
7 #include "image_io/jpeg/jpeg_xmp_info.h"
8 
9 namespace photos_editing_formats {
10 namespace image_io {
11 
12 /// A helper class for building information about the segments that contain
13 /// extended xmp data of various types.
14 class JpegXmpInfoBuilder {
15  public:
16   /// @param xmp_info_type The type of xmp information to build.
JpegXmpInfoBuilder(JpegXmpInfo::Type xmp_info_type)17   explicit JpegXmpInfoBuilder(JpegXmpInfo::Type xmp_info_type)
18       : xmp_info_type_(xmp_info_type) {}
19 
20   /// @param segment The segment to examine for xmp data.
21   void ProcessSegment(const JpegSegment& segment);
22 
23   /// @return The vector of segment data ranges that contains xmp property data.
GetPropertySegmentRanges()24   const std::vector<DataRange>& GetPropertySegmentRanges() const {
25     return property_segment_ranges_;
26   }
27 
28  private:
29   /// The type of xmp data to collect.
30   JpegXmpInfo::Type xmp_info_type_;
31 
32   /// The vector of segment data ranges that contains xmp property data.
33   std::vector<DataRange> property_segment_ranges_;
34 
35   /// The segment data range that contains the xmp property data end.
36   DataRange property_end_segment_range_;
37 };
38 
39 }  // namespace image_io
40 }  // namespace photos_editing_formats
41 
42 #endif // IMAGE_IO_JPEG_JPEG_XMP_INFO_BUILDER_H_  // NOLINT
43