LCOV - code coverage report
Current view: top level - frmts/pcidsk/sdk - pcidsk_buffer.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 2 4 50.0 %
Date: 2024-05-04 12:52:34 Functions: 1 2 50.0 %

          Line data    Source code
       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             :  * Permission is hereby granted, free of charge, to any person obtaining a
      10             :  * copy of this software and associated documentation files (the "Software"),
      11             :  * to deal in the Software without restriction, including without limitation
      12             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      13             :  * and/or sell copies of the Software, and to permit persons to whom the
      14             :  * Software is furnished to do so, subject to the following conditions:
      15             :  *
      16             :  * The above copyright notice and this permission notice shall be included
      17             :  * in all copies or substantial portions of the Software.
      18             :  *
      19             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      20             :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      21             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      22             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      23             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      24             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      25             :  * DEALINGS IN THE SOFTWARE.
      26             :  ****************************************************************************/
      27             : #ifndef INCLUDE_PCIDSKBUFFER_H
      28             : #define INCLUDE_PCIDSKBUFFER_H
      29             : 
      30             : #include "pcidsk_config.h"
      31             : 
      32             : #include <string>
      33             : 
      34             : namespace PCIDSK
      35             : {
      36             : /************************************************************************/
      37             : /*                             PCIDSKBuffer                             */
      38             : /*                                                                      */
      39             : /*      Convenience class for managing ascii headers of various         */
      40             : /*      sorts.  Primarily for internal use.                             */
      41             : /************************************************************************/
      42             : 
      43             :     class PCIDSKBuffer
      44             :     {
      45             :         friend class MetadataSegment; // ?
      46             :     public:
      47             :         PCIDSKBuffer( int size = 0 );
      48             :         PCIDSKBuffer( const char *src, int size );
      49             :         ~PCIDSKBuffer();
      50             : 
      51             :         char        *buffer;
      52             :         int         buffer_size;
      53             : 
      54             :         PCIDSKBuffer &operator=(const PCIDSKBuffer& src);
      55             : 
      56             :         const char *Get( int offset, int size ) const;
      57             :         void        Get( int offset, int size, std::string &target, int unpad=1 ) const;
      58             : 
      59             :         double      GetDouble( int offset, int size ) const;
      60             :         int         GetInt( int offset, int size ) const;
      61             :         int64       GetInt64( int offset, int size ) const;
      62             :         uint64      GetUInt64( int offset, int size ) const;
      63             : 
      64             :         void        Put( const char *value,  int offset, int size, bool null_term = false );
      65             :         void        Put( uint64 value, int offset, int size );
      66             :         void        Put( double value, int offset, int size, const char *fmt=nullptr );
      67       10656 :         void        Put( int value, int offset, int size )
      68       10656 :             { Put( (uint64) value, offset, size ); }
      69           0 :         void        Put( unsigned int value, int offset, int size )
      70           0 :             { Put( (uint64) value, offset, size ); }
      71             : 
      72             :         void        PutBin(double value, int offset);
      73             :         void        PutBin(int16 value, int offset);
      74             : 
      75             :         void        SetSize( int size );
      76             : 
      77             :     private:
      78             :         mutable std::string work_field;
      79             :     };
      80             : } // end namespace PCIDSK
      81             : #endif // INCLUDE_PCIDSKBUFFER_H

Generated by: LCOV version 1.14