summaryrefslogtreecommitdiff
path: root/lib_dxf/intern/dxfwriter.h
diff options
context:
space:
mode:
authorsaurabhb172020-02-26 16:04:40 +0530
committersaurabhb172020-02-26 16:04:40 +0530
commit039ac92480a09266146fc5b0c9ec67a32a2565ad (patch)
tree7b6cef031a580680690a0f32410db940f7e7d7d5 /lib_dxf/intern/dxfwriter.h
parentaa35045840b78d3f48212db45da59a2e5c69b223 (diff)
downloadKiCad-eSim-039ac92480a09266146fc5b0c9ec67a32a2565ad.tar.gz
KiCad-eSim-039ac92480a09266146fc5b0c9ec67a32a2565ad.tar.bz2
KiCad-eSim-039ac92480a09266146fc5b0c9ec67a32a2565ad.zip
Added secondary files
Diffstat (limited to 'lib_dxf/intern/dxfwriter.h')
-rw-r--r--lib_dxf/intern/dxfwriter.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/lib_dxf/intern/dxfwriter.h b/lib_dxf/intern/dxfwriter.h
new file mode 100644
index 0000000..cd9f0bb
--- /dev/null
+++ b/lib_dxf/intern/dxfwriter.h
@@ -0,0 +1,71 @@
+/******************************************************************************
+** libDXFrw - Library to read/write DXF files (ascii & binary) **
+** **
+** Copyright (C) 2011 Rallaz, rallazz@gmail.com **
+** **
+** This library is free software, licensed under the terms of the GNU **
+** General Public License as published by the Free Software Foundation, **
+** either version 2 of the License, or (at your option) any later version. **
+** You should have received a copy of the GNU General Public License **
+** along with this program. If not, see <http://www.gnu.org/licenses/>. **
+******************************************************************************/
+
+#ifndef DXFWRITER_H
+#define DXFWRITER_H
+
+#include "drw_textcodec.h"
+
+class dxfWriter
+{
+public:
+ dxfWriter( std::ofstream* stream ) { filestr = stream; /*count =0;*/ }
+ virtual ~dxfWriter() {}
+ virtual bool writeString( int code, std::string text ) = 0;
+ bool writeUtf8String( int code, std::string text );
+ bool writeUtf8Caps( int code, std::string text );
+
+ std::string fromUtf8String( std::string t ) { return encoder.fromUtf8( t ); }
+ virtual bool writeInt16( int code, int data ) = 0;
+ virtual bool writeInt32( int code, int data ) = 0;
+ virtual bool writeInt64( int code, unsigned long long int data ) = 0;
+ virtual bool writeDouble( int code, double data ) = 0;
+ virtual bool writeBool( int code, bool data ) = 0;
+
+ void setVersion( std::string* v ) { encoder.setVersion( v ); }
+ void setCodePage( std::string* c ) { encoder.setCodePage( c ); }
+ std::string getCodePage() { return encoder.getCodePage(); }
+
+protected:
+ std::ofstream* filestr;
+
+private:
+ DRW_TextCodec encoder;
+};
+
+class dxfWriterBinary : public dxfWriter
+{
+public:
+ dxfWriterBinary( std::ofstream* stream ) : dxfWriter( stream ) {}
+ virtual ~dxfWriterBinary() {}
+ virtual bool writeString( int code, std::string text );
+ virtual bool writeInt16( int code, int data );
+ virtual bool writeInt32( int code, int data );
+ virtual bool writeInt64( int code, unsigned long long int data );
+ virtual bool writeDouble( int code, double data );
+ virtual bool writeBool( int code, bool data );
+};
+
+class dxfWriterAscii : public dxfWriter
+{
+public:
+ dxfWriterAscii( std::ofstream* stream ) : dxfWriter( stream ) {}
+ virtual ~dxfWriterAscii() {}
+ virtual bool writeString( int code, std::string text );
+ virtual bool writeInt16( int code, int data );
+ virtual bool writeInt32( int code, int data );
+ virtual bool writeInt64( int code, unsigned long long int data );
+ virtual bool writeDouble( int code, double data );
+ virtual bool writeBool( int code, bool data );
+};
+
+#endif // DXFWRITER_H