LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/cad/libopencad - caddictionary.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 3 3 100.0 %
Date: 2025-07-05 13:22:42 Functions: 4 6 66.7 %

          Line data    Source code
       1             : /*******************************************************************************
       2             :  *  Project: libopencad
       3             :  *  Purpose: OpenSource CAD formats support library
       4             :  *  Author: Alexandr Borzykh, mush3d at gmail.com
       5             :  *  Author: Dmitry Baryshnikov, bishop.dev@gmail.com
       6             :  *  Language: C++
       7             :  *******************************************************************************
       8             :  *  The MIT License (MIT)
       9             :  *
      10             :  *  Copyright (c) 2016 Alexandr Borzykh
      11             :  *  Copyright (c) 2016 NextGIS, <info@nextgis.com>
      12             :  *
      13             :   * SPDX-License-Identifier: MIT
      14             :  *******************************************************************************/
      15             : #ifndef CADDICTIONARY_H
      16             : #define CADDICTIONARY_H
      17             : 
      18             : #include "cadobjects.h"
      19             : #include <memory>
      20             : 
      21             : /*
      22             :  * @brief Base-class for XRecord and Dictionary.
      23             :  */
      24          32 : class OCAD_EXTERN CADDictionaryRecord
      25             : {
      26             : public:
      27             :     virtual ~CADDictionaryRecord();
      28             :     CADObject::ObjectType getType() const;
      29             : 
      30             : protected:
      31             :     CADDictionaryRecord();
      32             :     CADDictionaryRecord(const CADDictionaryRecord&) = default;
      33             :     CADDictionaryRecord(CADDictionaryRecord&&)=default;
      34             : 
      35             :     CADObject::ObjectType objType;
      36             : };
      37             : 
      38             : /*
      39             :  * @brief Class which implements XRecord
      40             :  */
      41          48 : class OCAD_EXTERN CADXRecord : public CADDictionaryRecord
      42             : {
      43             : public:
      44             :     CADXRecord();
      45             :     ~CADXRecord() override;
      46             :     CADXRecord(const CADXRecord&) = default;
      47             :     CADXRecord(CADXRecord&&)=default;
      48             : 
      49             :     const std::string getRecordData() const;
      50             :     void              setRecordData( const std::string& data );
      51             : 
      52             : private:
      53             :     std::string sRecordData;
      54             :     CADXRecord& operator=(const CADXRecord&) =delete;
      55             :     CADXRecord& operator=(CADXRecord&&)= delete;
      56             : };
      57             : 
      58             : /*
      59             :  * @brief Class which implements Dictionary
      60             :  */
      61             : typedef std::pair< std::string, std::shared_ptr<CADDictionaryRecord>> CADDictionaryItem;
      62           8 : class OCAD_EXTERN CADDictionary : public CADDictionaryRecord
      63             : {
      64             : public:
      65             :     CADDictionary();
      66             :     ~CADDictionary() override;
      67             :     CADDictionary(const CADDictionary&) = default;
      68             :     CADDictionary(CADDictionary&&)=default;
      69             : 
      70             :     size_t getRecordsCount();
      71             :     void   addRecord( CADDictionaryItem );
      72             :     CADDictionaryItem getRecord( size_t index );
      73             :     std::string getRecordByName(const std::string& name) const;
      74             : private:
      75             :     std::vector< CADDictionaryItem > astXRecords;
      76             :     CADDictionary& operator=(const CADDictionary&) =delete;
      77             :     CADDictionary& operator=(CADDictionary&&)= delete;
      78             : };
      79             : 
      80             : #endif // CADDICTIONARY_H

Generated by: LCOV version 1.14