1 ////////////////////////////////////////////////////////////////////////////////
2 //    Scorched3D (c) 2000-2011
3 //
4 //    This file is part of Scorched3D.
5 //
6 //    Scorched3D 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 //    Scorched3D 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 along
17 //    with this program; if not, write to the Free Software Foundation, Inc.,
18 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ////////////////////////////////////////////////////////////////////////////////
20 
21 #if !defined(__INCLUDE_ModelIDh_INCLUDE__)
22 #define __INCLUDE_ModelIDh_INCLUDE__
23 
24 #include <string>
25 
26 class NetBuffer;
27 class NetBufferReader;
28 class XMLNode;
29 class ModelID
30 {
31 public:
32 	ModelID();
33 	ModelID(const ModelID &other);
34 	virtual ~ModelID();
35 
36 	ModelID &operator=(const ModelID &other);
37 
38 	bool initFromNode(XMLNode *modelNode);
39 
40 	bool initFromString(
41 		const char *type,
42 		const char *meshName,
43 		const char *skinName);
44 
45 	// Not very generic but it will do for now!!
46 	const char *getStringHash();
getSkinName()47 	const char *getSkinName() { return skinName_.c_str(); }
getMeshName()48 	const char *getMeshName() { return meshName_.c_str(); }
getType()49 	const char *getType() { return type_.c_str(); }
modelValid()50 	bool modelValid() { return !type_.empty(); }
51 
52 	// Serialize
53 	virtual bool writeModelID(NetBuffer &buffer);
54 	virtual bool readModelID(NetBufferReader &reader);
55 
56 protected:
57 	std::string type_;
58 	std::string meshName_;
59 	std::string skinName_;
60 	std::string hash_;
61 };
62 
63 #endif
64