QCAD
Open Source 2D CAD
dl_writer_ascii.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2013 RibbonSoft, GmbH. All rights reserved.
3 ** Copyright (C) 2001 Robert J. Campbell Jr.
4 **
5 ** This file is part of the dxflib project.
6 **
7 ** This file is free software; you can redistribute it and/or modify
8 ** it under the terms of the GNU General Public License as published by
9 ** the Free Software Foundation; either version 2 of the License, or
10 ** (at your option) any later version.
11 **
12 ** Licensees holding valid dxflib Professional Edition licenses may use
13 ** this file in accordance with the dxflib Commercial License
14 ** Agreement provided with the Software.
15 **
16 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
17 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 **
19 ** See http://www.ribbonsoft.com for further details.
20 **
21 ** Contact [email protected] if any conditions of this licensing are
22 ** not clear to you.
23 **
24 **********************************************************************/
25 
26 #ifndef DL_WRITER_ASCII_H
27 #define DL_WRITER_ASCII_H
28 
29 #include "dl_global.h"
30 
31 #if _MSC_VER > 1000
32 #pragma once
33 #endif // _MSC_VER > 1000
34 
35 #include "dl_writer.h"
36 #include <fstream>
37 #include <string>
38 
50 public:
52  : DL_Writer(version), m_ofile(fname) {}
53  virtual ~DL_WriterA() {}
54 
55  bool openFailed() const;
56  void close() const;
57  void dxfReal(int gc, double value) const;
58  void dxfInt(int gc, int value) const;
59  void dxfHex(int gc, int value) const;
60  void dxfString(int gc, const char* value) const;
61  void dxfString(int gc, const std::string& value) const;
62 
63  static void strReplace(char* str, char src, char dest);
64 
65 private:
69  mutable std::ofstream m_ofile;
70 
71 };
72 
73 #endif
74 
DL_Codes::version
version
Version numbers for the DXF Format.
Definition: dl_codes.h:96
DL_Writer::DL_Writer
DL_Writer(DL_Codes::version version)
Definition: dl_writer.h:86
dl_global.h
DL_WriterA
Implements functions defined in DL_Writer for writing low level DXF constructs to an ASCII format DXF...
Definition: dl_writer_ascii.h:49
DL_Writer
Defines interface for writing low level DXF constructs to a file.
Definition: dl_writer.h:58
version
void version()
Prints version information.
Definition: autostart.js:54
DL_Writer::dxfHex
virtual void dxfHex(int gc, int value) const =0
Must be overwritten by the implementing class to write an int value (hex) to the file.
DL_Writer::dxfReal
virtual void dxfReal(int gc, double value) const =0
Must be overwritten by the implementing class to write a real value to the file.
DXFLIB_EXPORT
#define DXFLIB_EXPORT
Definition: dl_global.h:12
DL_VERSION_2000
#define DL_VERSION_2000
Definition: dl_codes.h:378
DL_Writer::dxfInt
virtual void dxfInt(int gc, int value) const =0
Must be overwritten by the implementing class to write an int value to the file.
DL_Writer::dxfString
virtual void dxfString(int gc, const char *value) const =0
Must be overwritten by the implementing class to write a string to the file.
dl_writer.h