1 /*
2  * NodeLdrawDatExport.h
3  *
4  * Copyright (C) 2008 J. "MUFTI" Scheurich
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program (see the file "COPYING" for details); if
18  * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19  * Cambridge, MA 02139, USA.
20  */
21 
22 #pragma once
23 
24 #include "Node.h"
25 #include "ProtoMacros.h"
26 #include "Proto.h"
27 #include "SFMFTypes.h"
28 
29 
30 class ProtoLdrawDatExport : public Proto {
31 public:
32                     ProtoLdrawDatExport(Scene *scene);
33     virtual Node   *create(Scene *scene);
34 
getType()35     virtual int     getType() const { return DUNE_LDRAW_DAT_EXPORT; }
getNodeClass()36     virtual int     getNodeClass() const { return CHILD_NODE; }
37 
isScriptedExternProto(void)38     virtual bool    isScriptedExternProto(void) { return true; }
39 
40     FieldIndex partDescription;
41     FieldIndex author;
42     FieldIndex fileType;
43     FieldIndex license;
44     FieldIndex help;
45     FieldIndex bfc;
46     FieldIndex category;
47     FieldIndex keywords;
48     FieldIndex cmdline;
49     FieldIndex history;
50     FieldIndex commands;
51 };
52 
53 class NodeLdrawDatExport : public Node {
54 public:
55                     NodeLdrawDatExport(Scene *scene, Proto *proto);
56 
getProfile(void)57     virtual int     getProfile(void) const { return PROFILE_INTERCHANGE; }
getX3dVersion(void)58     virtual int     getX3dVersion(void) const { return -1; }
copy()59     virtual Node   *copy() const { return new NodeLdrawDatExport(*this); }
60 
61     virtual int     writeProto(int filedes);
62 
63     virtual bool    validate(void);
64 
canWriteLdrawDat()65     virtual bool    canWriteLdrawDat() { return true; }
66     virtual int     writeLdrawDatHeader(int filedes, const char *filename);
67 
68     bool            checkMissingData(int field, unsigned int limit = 0);
69 
70     fieldMacros(SFString, partDescription, ProtoLdrawDatExport)
71     fieldMacros(SFString, author,          ProtoLdrawDatExport)
72     fieldMacros(SFString, fileType,        ProtoLdrawDatExport)
73     fieldMacros(SFString, license,         ProtoLdrawDatExport)
74     fieldMacros(SFString, bfc,             ProtoLdrawDatExport)
75     fieldMacros(MFString, help,            ProtoLdrawDatExport)
76     fieldMacros(SFString, category,        ProtoLdrawDatExport)
77     fieldMacros(MFString, keywords,        ProtoLdrawDatExport)
78     fieldMacros(SFString, cmdline,         ProtoLdrawDatExport)
79     fieldMacros(MFString, history,         ProtoLdrawDatExport)
80     fieldMacros(MFString, commands,        ProtoLdrawDatExport)
81 };
82