LIBJXL
decode_cxx.h
Go to the documentation of this file.
1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file.
5 
11 
12 #ifndef JXL_DECODE_CXX_H_
13 #define JXL_DECODE_CXX_H_
14 
15 #include <memory>
16 
17 #include "jxl/decode.h"
18 
19 #if !(defined(__cplusplus) || defined(c_plusplus))
20 #error "This a C++ only header. Use jxl/decode.h from C sources."
21 #endif
22 
26  void operator()(JxlDecoder* decoder) { JxlDecoderDestroy(decoder); }
27 };
28 
34 typedef std::unique_ptr<JxlDecoder, JxlDecoderDestroyStruct> JxlDecoderPtr;
35 
47 static inline JxlDecoderPtr JxlDecoderMake(
48  const JxlMemoryManager* memory_manager) {
49  return JxlDecoderPtr(JxlDecoderCreate(memory_manager));
50 }
51 
52 #endif // JXL_DECODE_CXX_H_
JxlDecoderDestroyStruct::operator()
void operator()(JxlDecoder *decoder)
Calls JxlDecoderDestroy() on the passed decoder.
Definition: decode_cxx.h:26
JxlDecoder
struct JxlDecoderStruct JxlDecoder
Definition: decode.h:80
JxlDecoderDestroyStruct
Struct to call JxlDecoderDestroy from the JxlDecoderPtr unique_ptr.
Definition: decode_cxx.h:24
decode.h
Decoding API for JPEG XL.
JxlDecoderDestroy
JXL_EXPORT void JxlDecoderDestroy(JxlDecoder *dec)
JxlMemoryManagerStruct
Definition: memory_manager.h:48
JxlDecoderCreate
JXL_EXPORT JxlDecoder * JxlDecoderCreate(const JxlMemoryManager *memory_manager)
JxlDecoderPtr
std::unique_ptr< JxlDecoder, JxlDecoderDestroyStruct > JxlDecoderPtr
Definition: decode_cxx.h:34