LibreOffice Module vcl (master)  1
dxfblkrd.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 
21 #include "dxfblkrd.hxx"
22 
23 
24 //---------------- DXFBlock --------------------------------------------------
25 
26 
28  : pSucc(nullptr)
29  , nFlags(0)
30 {
31 }
32 
33 
35 {
36 }
37 
38 
40 {
41  m_sName = "";
42  m_sAlsoName = "";
43  aBasePoint.fx=0.0;
44  aBasePoint.fy=0.0;
45  aBasePoint.fz=0.0;
46  nFlags=0;
47  m_sXRef = "";
48 
49  while (rDGR.Read()!=0)
50  {
51  switch (rDGR.GetG())
52  {
53  case 2: m_sName = rDGR.GetS(); break;
54  case 3: m_sAlsoName = rDGR.GetS(); break;
55  case 70: nFlags=rDGR.GetI(); break;
56  case 10: aBasePoint.fx=rDGR.GetF(); break;
57  case 20: aBasePoint.fy=rDGR.GetF(); break;
58  case 30: aBasePoint.fz=rDGR.GetF(); break;
59  case 1: m_sXRef = rDGR.GetS(); break;
60  }
61  }
62  DXFEntities::Read(rDGR);
63 }
64 
65 
66 //---------------- DXFBlocks -------------------------------------------------
67 
68 
70 {
71  pFirst=nullptr;
72 }
73 
74 
76 {
77  Clear();
78 }
79 
80 
82 {
83  DXFBlock * pB, * * ppSucc;
84 
85  ppSucc=&pFirst;
86  while (*ppSucc!=nullptr) ppSucc=&((*ppSucc)->pSucc);
87 
88  for (;;) {
89  while (rDGR.GetG()!=0) rDGR.Read();
90  if (rDGR.GetS() == "ENDSEC" ||
91  rDGR.GetS() == "EOF") break;
92  if (rDGR.GetS() == "BLOCK") {
93  pB=new DXFBlock;
94  pB->Read(rDGR);
95  *ppSucc=pB;
96  ppSucc=&(pB->pSucc);
97  }
98  else rDGR.Read();
99  }
100 }
101 
102 
103 DXFBlock * DXFBlocks::Search(std::string_view rName) const
104 {
105  DXFBlock * pB;
106  for (pB=pFirst; pB!=nullptr; pB=pB->pSucc) {
107  if (rName == pB->m_sName) break;
108  }
109  return pB;
110 }
111 
112 
114 {
115  DXFBlock * ptmp;
116 
117  while (pFirst!=nullptr) {
118  ptmp=pFirst;
119  pFirst=ptmp->pSucc;
120  delete ptmp;
121  }
122 }
123 
124 
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
double fx
Definition: dxfvec.hxx:55
double GetF() const
Definition: dxfgrprd.hxx:102
~DXFBlocks()
Definition: dxfblkrd.cxx:75
OString m_sAlsoName
Definition: dxfblkrd.hxx:42
tools::Long GetI() const
Definition: dxfgrprd.hxx:97
void Clear()
Definition: dxfblkrd.cxx:113
void Read(DXFGroupReader &rDGR)
Definition: dxfblkrd.cxx:81
DXFBlock * Search(std::string_view rName) const
Definition: dxfblkrd.cxx:103
double fz
Definition: dxfvec.hxx:55
sal_uInt16 Read()
Definition: dxfgrprd.cxx:117
DXFBlock * pSucc
Definition: dxfblkrd.hxx:37
tools::Long nFlags
Definition: dxfblkrd.hxx:43
OString m_sXRef
Definition: dxfblkrd.hxx:45
DXFVector aBasePoint
Definition: dxfblkrd.hxx:44
OString m_sName
Definition: dxfblkrd.hxx:41
double fy
Definition: dxfvec.hxx:55
DXFBlock()
Definition: dxfblkrd.cxx:27
sal_uInt16 GetG() const
Definition: dxfgrprd.hxx:92
void Read(DXFGroupReader &rDGR)
Definition: dxfentrd.cxx:794
DXFBlock * pFirst
Definition: dxfblkrd.hxx:61
const OString & GetS() const
Definition: dxfgrprd.hxx:107
void Read(DXFGroupReader &rDGR)
Definition: dxfblkrd.cxx:39
~DXFBlock()
Definition: dxfblkrd.cxx:34