1 /*
2  * Copyright 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef IMG_UTILS_TIFF_WRITABLE
18 #define IMG_UTILS_TIFF_WRITABLE
19 
20 #include <img_utils/Orderable.h>
21 #include <img_utils/EndianUtils.h>
22 #include <img_utils/Output.h>
23 
24 #include <cutils/compiler.h>
25 #include <utils/Errors.h>
26 #include <utils/RefBase.h>
27 #include <stdint.h>
28 
29 namespace android {
30 namespace img_utils {
31 
32 /**
33  * TiffWritable subclasses represent TIFF metadata objects that can be written
34  * to an EndianOutput object.  This is used for TIFF entries and IFDs.
35  */
36 class ANDROID_API TiffWritable : public Orderable, public LightRefBase<TiffWritable> {
37     public:
38         TiffWritable();
39         virtual ~TiffWritable();
40 
41         /**
42          * Write the data to the output. The given offset is used to calculate
43          * the header offset for values written.  The offset is defined
44          * relative to the beginning of the TIFF header, and is word aligned.
45          *
46          * Returns OK on success, or a negative error code on failure.
47          */
48         virtual status_t writeData(uint32_t offset, /*out*/EndianOutput* out) const = 0;
49 
50         /**
51          * Get the size of the data to write.
52          */
53         virtual size_t getSize() const = 0;
54 
55 };
56 
57 } /*namespace img_utils*/
58 } /*namespace android*/
59 
60 #endif /*IMG_UTILS_TIFF_WRITABLE*/
61