LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/cad/libopencad - cadclasses.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 15 24 62.5 %
Date: 2024-11-21 22:18:42 Functions: 4 5 80.0 %

          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             : #include "cadclasses.h"
      16             : #include "opencad.h"
      17             : 
      18             : #include <iostream>
      19             : 
      20             : using namespace std;
      21             : 
      22             : //------------------------------------------------------------------------------
      23             : // CADClass
      24             : //------------------------------------------------------------------------------
      25             : 
      26         121 : CADClass::CADClass() : sCppClassName(""),
      27             :                 sApplicationName(""),
      28             :                 sDXFRecordName(""),
      29             :                 dProxyCapFlag(0),
      30             :                 dInstanceCount(0),
      31             :                 bWasZombie(false),
      32             :                 bIsEntity(false),
      33             :                 dClassNum(0),
      34         121 :                 dClassVersion(0)
      35             : {
      36         121 : }
      37             : 
      38             : //------------------------------------------------------------------------------
      39             : // CADClasses
      40             : //------------------------------------------------------------------------------
      41             : 
      42           8 : CADClasses::CADClasses()
      43             : {
      44           8 : }
      45             : 
      46         121 : void CADClasses::addClass( CADClass stClass )
      47             : {
      48         121 :     classes.push_back( stClass );
      49             : 
      50         121 :     DebugMsg( "CLASS INFO\n"
      51             :                       "  Class Number: %d\n"
      52             :                       "  Proxy capabilities flag or Version: %d\n"
      53             :                       "  App name: %s\n"
      54             :                       "  C++ Class Name: %s\n"
      55             :                       "  DXF Class name: %s\n"
      56             :                       "  Was a zombie? %x\n"
      57         121 :                       "  Is-an-entity flag: %x\n\n", stClass.dClassNum, stClass.dProxyCapFlag,
      58             :               stClass.sApplicationName.c_str(), stClass.sCppClassName.c_str(), stClass.sDXFRecordName.c_str(),
      59         121 :               stClass.bWasZombie, stClass.bIsEntity );
      60         121 : }
      61             : 
      62           8 : CADClass CADClasses::getClassByNum( short num ) const
      63             : {
      64           8 :     for( const CADClass &cadClass : classes )
      65             :     {
      66           8 :         if( cadClass.dClassNum == num )
      67           8 :             return cadClass;
      68             :     }
      69           0 :     return CADClass();
      70             : }
      71             : 
      72           0 : void CADClasses::print() const
      73             : {
      74           0 :     cout << "============ CLASSES Section ============\n";
      75             : 
      76           0 :     for( CADClass stClass : classes )
      77             :     {
      78             :         cout << "Class:" <<
      79           0 :         "\n  Class Number: " << stClass.dClassNum <<
      80           0 :         "\n  Proxy capabilities flag or Version: " << stClass.dProxyCapFlag <<
      81             :         "\n  App name: " << stClass.sApplicationName <<
      82             :         "\n  C++ Class Name: " << stClass.sCppClassName <<
      83             :         "\n  DXF Class name: " << stClass.sDXFRecordName <<
      84           0 :         "\n  Was a zombie: " << stClass.bWasZombie <<
      85           0 :         "\n  Is-an-entity flag: " << stClass.bIsEntity << "\n\n";
      86             :     }
      87           0 : }

Generated by: LCOV version 1.14