Coverage Report

Created: 2025-07-23 09:13

/src/gdal/ogr/ogrsf_frmts/cad/libopencad/cadclasses.cpp
Line
Count
Source (jump to first uncovered line)
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
15.2k
CADClass::CADClass() : sCppClassName(""),
27
15.2k
                sApplicationName(""),
28
15.2k
                sDXFRecordName(""),
29
15.2k
                dProxyCapFlag(0),
30
15.2k
                dInstanceCount(0),
31
15.2k
                bWasZombie(false),
32
15.2k
                bIsEntity(false),
33
15.2k
                dClassNum(0),
34
15.2k
                dClassVersion(0)
35
15.2k
{
36
15.2k
}
37
38
//------------------------------------------------------------------------------
39
// CADClasses
40
//------------------------------------------------------------------------------
41
42
CADClasses::CADClasses()
43
7.48k
{
44
7.48k
}
45
46
void CADClasses::addClass( CADClass stClass )
47
10.7k
{
48
10.7k
    classes.push_back( stClass );
49
50
10.7k
    DebugMsg( "CLASS INFO\n"
51
10.7k
                      "  Class Number: %d\n"
52
10.7k
                      "  Proxy capabilities flag or Version: %d\n"
53
10.7k
                      "  App name: %s\n"
54
10.7k
                      "  C++ Class Name: %s\n"
55
10.7k
                      "  DXF Class name: %s\n"
56
10.7k
                      "  Was a zombie? %x\n"
57
10.7k
                      "  Is-an-entity flag: %x\n\n", stClass.dClassNum, stClass.dProxyCapFlag,
58
10.7k
              stClass.sApplicationName.c_str(), stClass.sCppClassName.c_str(), stClass.sDXFRecordName.c_str(),
59
10.7k
              stClass.bWasZombie, stClass.bIsEntity );
60
10.7k
}
61
62
CADClass CADClasses::getClassByNum( short num ) const
63
6.25k
{
64
6.25k
    for( const CADClass &cadClass : classes )
65
17.5k
    {
66
17.5k
        if( cadClass.dClassNum == num )
67
1.70k
            return cadClass;
68
17.5k
    }
69
4.55k
    return CADClass();
70
6.25k
}
71
72
void CADClasses::print() const
73
0
{
74
0
    cout << "============ CLASSES Section ============\n";
75
76
0
    for( CADClass stClass : classes )
77
0
    {
78
0
        cout << "Class:" <<
79
0
        "\n  Class Number: " << stClass.dClassNum <<
80
0
        "\n  Proxy capabilities flag or Version: " << stClass.dProxyCapFlag <<
81
0
        "\n  App name: " << stClass.sApplicationName <<
82
0
        "\n  C++ Class Name: " << stClass.sCppClassName <<
83
0
        "\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
0
    }
87
0
}