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 : * Permission is hereby granted, free of charge, to any person obtaining a copy 14 : * of this software and associated documentation files (the "Software"), to deal 15 : * in the Software without restriction, including without limitation the rights 16 : * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 : * copies of the Software, and to permit persons to whom the Software is 18 : * furnished to do so, subject to the following conditions: 19 : * 20 : * The above copyright notice and this permission notice shall be included in all 21 : * copies or substantial portions of the Software. 22 : * 23 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 : * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 : * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 : * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 : * SOFTWARE. 30 : *******************************************************************************/ 31 : #include "cadclasses.h" 32 : #include "opencad.h" 33 : 34 : #include <iostream> 35 : 36 : using namespace std; 37 : 38 : //------------------------------------------------------------------------------ 39 : // CADClass 40 : //------------------------------------------------------------------------------ 41 : 42 121 : CADClass::CADClass() : sCppClassName(""), 43 : sApplicationName(""), 44 : sDXFRecordName(""), 45 : dProxyCapFlag(0), 46 : dInstanceCount(0), 47 : bWasZombie(false), 48 : bIsEntity(false), 49 : dClassNum(0), 50 121 : dClassVersion(0) 51 : { 52 121 : } 53 : 54 : //------------------------------------------------------------------------------ 55 : // CADClasses 56 : //------------------------------------------------------------------------------ 57 : 58 8 : CADClasses::CADClasses() 59 : { 60 8 : } 61 : 62 121 : void CADClasses::addClass( CADClass stClass ) 63 : { 64 121 : classes.push_back( stClass ); 65 : 66 121 : DebugMsg( "CLASS INFO\n" 67 : " Class Number: %d\n" 68 : " Proxy capabilities flag or Version: %d\n" 69 : " App name: %s\n" 70 : " C++ Class Name: %s\n" 71 : " DXF Class name: %s\n" 72 : " Was a zombie? %x\n" 73 121 : " Is-an-entity flag: %x\n\n", stClass.dClassNum, stClass.dProxyCapFlag, 74 : stClass.sApplicationName.c_str(), stClass.sCppClassName.c_str(), stClass.sDXFRecordName.c_str(), 75 121 : stClass.bWasZombie, stClass.bIsEntity ); 76 121 : } 77 : 78 8 : CADClass CADClasses::getClassByNum( short num ) const 79 : { 80 8 : for( const CADClass &cadClass : classes ) 81 : { 82 8 : if( cadClass.dClassNum == num ) 83 8 : return cadClass; 84 : } 85 0 : return CADClass(); 86 : } 87 : 88 0 : void CADClasses::print() const 89 : { 90 0 : cout << "============ CLASSES Section ============\n"; 91 : 92 0 : for( CADClass stClass : classes ) 93 : { 94 : cout << "Class:" << 95 0 : "\n Class Number: " << stClass.dClassNum << 96 0 : "\n Proxy capabilities flag or Version: " << stClass.dProxyCapFlag << 97 : "\n App name: " << stClass.sApplicationName << 98 : "\n C++ Class Name: " << stClass.sCppClassName << 99 : "\n DXF Class name: " << stClass.sDXFRecordName << 100 0 : "\n Was a zombie: " << stClass.bWasZombie << 101 0 : "\n Is-an-entity flag: " << stClass.bIsEntity << "\n\n"; 102 : } 103 0 : }