LibreOffice Module vcl (master)  1
dxfgrprd.hxx
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 #ifndef INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFGRPRD_HXX
21 #define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFGRPRD_HXX
22 
23 #include <rtl/string.hxx>
24 #include <sal/types.h>
25 #include <tools/long.hxx>
26 
27 class SvStream;
28 
30 {
31 public:
32  explicit DXFGroupReader( SvStream & rIStream );
33 
34  bool GetStatus() const;
35 
36  void SetError();
37 
38  sal_uInt16 Read();
39  // Reads next group and returns the group code.
40  // In case of an error GetStatus() returns sal_False, group code will be set
41  // to 0 and SetS(0,"EOF") will be executed.
42  bool Read(sal_uInt16 nExpectedG) { return Read() == nExpectedG; }
43 
44  sal_uInt16 GetG() const;
45  // Return the last group code (the one the last Read() did return).
46 
47  tools::Long GetI() const;
48  // Returns the integer value of the group which was read earlier with Read().
49  // This read must have returned a group code for datatype Integer.
50  // If not 0 is returned
51 
52  double GetF() const;
53  // Returns the floating point value of the group which was read earlier with Read().
54  // This read must have returned a group code for datatype Floatingpoint.
55  // If not 0 is returned
56 
57  const OString& GetS() const;
58  // Returns the string of the group which was read earlier with Read().
59  // This read must have returned a group code for datatype String.
60  // If not NULL is returned
61 
62  sal_uInt64 remainingSize() const;
63 private:
64 
66  double ReadF();
67  void ReadS();
68 
70  bool bStatus;
71  sal_uInt16 nLastG;
72 
73  OString S;
74  union {
75  double F;
77  };
78 };
79 
80 
81 inline bool DXFGroupReader::GetStatus() const
82 {
83  return bStatus;
84 }
85 
86 
88 {
89  bStatus=false;
90 }
91 
92 inline sal_uInt16 DXFGroupReader::GetG() const
93 {
94  return nLastG;
95 }
96 
98 {
99  return I;
100 }
101 
102 inline double DXFGroupReader::GetF() const
103 {
104  return F;
105 }
106 
107 inline const OString& DXFGroupReader::GetS() const
108 {
109  return S;
110 }
111 
112 #endif
113 
114 
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
double GetF() const
Definition: dxfgrprd.hxx:102
tools::Long GetI() const
Definition: dxfgrprd.hxx:97
long Long
sal_uInt16 Read()
Definition: dxfgrprd.cxx:117
sal_uInt16 nLastG
Definition: dxfgrprd.hxx:71
tools::Long I
Definition: dxfgrprd.hxx:76
DXFGroupReader(SvStream &rIStream)
Definition: dxfgrprd.cxx:108
SvStream & rIS
Definition: dxfgrprd.hxx:69
bool GetStatus() const
Definition: dxfgrprd.hxx:81
double ReadF()
Definition: dxfgrprd.cxx:188
sal_uInt16 GetG() const
Definition: dxfgrprd.hxx:92
void SetError()
Definition: dxfgrprd.hxx:87
const OString & GetS() const
Definition: dxfgrprd.hxx:107
sal_uInt64 remainingSize() const
Definition: dxfgrprd.cxx:207
bool Read(sal_uInt16 nExpectedG)
Definition: dxfgrprd.hxx:42
tools::Long ReadI()
Definition: dxfgrprd.cxx:157