/src/gdal/frmts/pcidsk/sdk/pcidsk_buffer.h
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Purpose: Declaration of the PCIDSKBuffer class |
4 | | * |
5 | | ****************************************************************************** |
6 | | * Copyright (c) 2009 |
7 | | * PCI Geomatics, 90 Allstate Parkway, Markham, Ontario, Canada. |
8 | | * |
9 | | * SPDX-License-Identifier: MIT |
10 | | ****************************************************************************/ |
11 | | #ifndef INCLUDE_PCIDSKBUFFER_H |
12 | | #define INCLUDE_PCIDSKBUFFER_H |
13 | | |
14 | | #include "pcidsk_config.h" |
15 | | |
16 | | #include <string> |
17 | | |
18 | | namespace PCIDSK |
19 | | { |
20 | | /************************************************************************/ |
21 | | /* PCIDSKBuffer */ |
22 | | /* */ |
23 | | /* Convenience class for managing ascii headers of various */ |
24 | | /* sorts. Primarily for internal use. */ |
25 | | /************************************************************************/ |
26 | | |
27 | | class PCIDSKBuffer |
28 | | { |
29 | | friend class MetadataSegment; // ? |
30 | | public: |
31 | | PCIDSKBuffer( int size = 0 ); |
32 | | PCIDSKBuffer( const char *src, int size ); |
33 | | ~PCIDSKBuffer(); |
34 | | |
35 | | char *buffer; |
36 | | int buffer_size; |
37 | | |
38 | | PCIDSKBuffer &operator=(const PCIDSKBuffer& src); |
39 | | |
40 | | const char *Get( int offset, int size ) const; |
41 | | void Get( int offset, int size, std::string &target, int unpad=1 ) const; |
42 | | |
43 | | double GetDouble( int offset, int size ) const; |
44 | | int GetInt( int offset, int size ) const; |
45 | | int64 GetInt64( int offset, int size ) const; |
46 | | uint64 GetUInt64( int offset, int size ) const; |
47 | | |
48 | | void Put( const char *value, int offset, int size, bool null_term = false ); |
49 | | void Put( uint64 value, int offset, int size ); |
50 | | void Put( double value, int offset, int size, const char *fmt=nullptr ); |
51 | | void Put( int value, int offset, int size ) |
52 | 20.5k | { Put( (uint64) value, offset, size ); } |
53 | | void Put( unsigned int value, int offset, int size ) |
54 | 0 | { Put( (uint64) value, offset, size ); } |
55 | | |
56 | | void PutBin(double value, int offset); |
57 | | void PutBin(int16 value, int offset); |
58 | | |
59 | | void SetSize( int size ); |
60 | | |
61 | | private: |
62 | | mutable std::string work_field; |
63 | | }; |
64 | | } // end namespace PCIDSK |
65 | | #endif // INCLUDE_PCIDSKBUFFER_H |