dime  0.9.1
Portable DXF file library
Loading...
Searching...
No Matches
Output.h
1/**************************************************************************\
2 * Copyright (c) Kongsberg Oil & Gas Technologies AS
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * Neither the name of the copyright holder nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31\**************************************************************************/
32
33#ifndef DIME_OUTPUT_H
34#define DIME_OUTPUT_H
35
36#include <dime/Basic.h>
37#include <stdio.h>
38
39class dimeModel;
40
41class DIME_DLL_API dimeOutput
42{
43public:
44 dimeOutput();
46
47 void setCallback(const int numrecords,
48 int (*cb)(float, void *), void *cbdata);
49 bool setFileHandle(FILE *fp);
50 bool setFilename(const char * const filename);
51 void setBinary(const bool state = true);
52 bool isBinary() const;
53
54 bool writeHeader() {return true;}
55 bool writeGroupCode(const int groupcode);
56 bool writeInt8(const int8 val);
57 bool writeInt16(const int16 val);
58 bool writeInt32(const int32 val);
59 bool writeFloat(const float val);
60 bool writeDouble(const dxfdouble val);
61 bool writeString(const char * const str);
62
63 int getUniqueHandleId();
64
65private:
66 friend class dimeModel;
67 dimeModel *model;
68 FILE *fp;
69 bool binary;
70
71 int (*callback)(float, void*);
72 void *callbackdata;
73 int numrecords;
74 int numwrites;
75 bool aborted;
76 bool didOpenFile;
77
78}; // class dimeOutput
79
80#endif // ! DIME_OUTPUT_H
81
The dimeModel class organizes a model.
Definition Model.h:55
The dimeOutput class handles writing of DXF and DXB files.
Definition Output.h:42
bool writeHeader()
Definition Output.h:54