]> Shamusworld >> Repos - architektonas/blob - dxflib/src/dl_writer_ascii.h
Initial import
[architektonas] / dxflib / src / dl_writer_ascii.h
1 /****************************************************************************
2 ** $Id: dl_writer_ascii.h 242 2004-04-12 22:39:43Z andrew $
3 **
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
5 ** Copyright (C) 2001 Robert J. Campbell Jr.
6 **
7 ** This file is part of the dxflib project.
8 **
9 ** This file may be distributed and/or modified under the terms of the
10 ** GNU General Public License version 2 as published by the Free Software
11 ** Foundation and appearing in the file LICENSE.GPL included in the
12 ** packaging of this file.
13 **
14 ** Licensees holding valid dxflib Professional Edition licenses may use 
15 ** this file in accordance with the dxflib Commercial License
16 ** Agreement provided with the Software.
17 **
18 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
19 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 **
21 ** See http://www.ribbonsoft.com for further details.
22 **
23 ** Contact info@ribbonsoft.com if any conditions of this licensing are
24 ** not clear to you.
25 **
26 **********************************************************************/
27
28 #ifndef DL_WRITER_ASCII_H
29 #define DL_WRITER_ASCII_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 using std::string;
39
40 /**
41  * Implements functions defined in DL_Writer for writing low
42  *   level DXF constructs to an ASCII format DXF file.
43  * 
44  * @para fname File name of the file to be created.
45  * @para version DXF version. Defaults to VER_2002.
46  *
47  * @todo What if \c fname is NULL?  Or \c fname can't be opened for
48  * another reason?
49  */
50 class DL_WriterA : public DL_Writer {
51 public:
52     DL_WriterA(char* fname, DL_Codes::version version=VER_2000)
53             : DL_Writer(version), m_ofile(fname) {}
54     virtual ~DL_WriterA() {}
55
56         bool openFailed() const;
57     void close() const;
58     void dxfReal(int gc, double value) const;
59     void dxfInt(int gc, int value) const;
60     void dxfHex(int gc, int value) const;
61     void dxfString(int gc, const char* value) const;
62     void dxfString(int gc, const string& value) const;
63
64         static void strReplace(char* str, char src, char dest);
65
66 private:
67     /**
68      * DXF file to be created.
69      */
70     mutable std::ofstream m_ofile;
71
72 };
73
74 #endif
75