source: NonGTP/FCollada/FCDocument/FCDAsset.h @ 964

Revision 964, 4.3 KB checked in by igarcia, 19 years ago (diff)
Line 
1/*
2        Copyright (C) 2005-2006 Feeling Software Inc.
3        MIT License: http://www.opensource.org/licenses/mit-license.php
4*/
5
6#ifndef _FCD_ASSET_H_
7#define _FCD_ASSET_H_
8
9#include "FCDocument/FCDObject.h"
10#include "FUtils/FUDateTime.h"
11
12class FCDAssetContributor;
13
14typedef vector<FCDAssetContributor*> FCDAssetContributorList;
15
16class FCOLLADA_EXPORT FCDAsset : public FCDObject
17{
18private:
19        DeclareObjectType;
20
21        FCDAssetContributorList contributors;
22        FUDateTime creationDateTime;
23        FUDateTime modifiedDateTime;
24        fstring keywords;
25        fstring revision;
26        fstring subject;
27        fstring title;
28        FMVector3 upAxis;
29
30        // <unit>
31        fstring unitName;
32        float unitConversionFactor;
33
34public:
35        FCDAsset(FCDocument* document);
36        virtual ~FCDAsset();
37
38        // Direct contributor list access
39        inline FCDAssetContributorList& GetContributors() { return contributors; }
40        inline const FCDAssetContributorList& GetContributors() const { return contributors; }
41        inline size_t GetContributorCount() const { return contributors.size(); }
42        inline FCDAssetContributor* GetContributor(size_t index) { return index < contributors.size() ? contributors[index] : NULL; }
43        inline const FCDAssetContributor* GetContributor(size_t index) const { return index < contributors.size() ? contributors[index] : NULL; }
44        FCDAssetContributor* AddContributor();
45
46        // Direct accessors
47        inline const FUDateTime& GetCreationDateTime() const { return creationDateTime; }
48        inline const FUDateTime& GetModifiedDateTime() const { return modifiedDateTime; }
49        inline const fstring& GetKeywords() const { return keywords; }
50        inline const fstring& GetRevision() const { return revision; }
51        inline const fstring& GetSubject() const { return subject; }
52        inline const fstring& GetTitle() const { return title; }
53        inline const FMVector3& GetUpAxis() const { return upAxis; }
54        inline const fstring& GetUnitName() const { return unitName; }
55        inline float GetUnitConversionFactor() const { return unitConversionFactor; }
56
57        // Direct mutators
58        inline void SetKeywords(const fstring& _keywords) { keywords = _keywords; }
59        inline void SetRevision(const fstring& _revision) { revision = _revision; }
60        inline void SetSubject(const fstring& _subject) { subject = _subject; }
61        inline void SetTitle(const fstring& _title) { title = _title; }
62        inline void SetUpAxis(const FMVector3& _upAxis) { upAxis = _upAxis; }
63        inline void SetUnitName(const fstring& _unitName) { unitName = _unitName; }
64        inline void SetUnitConversionFactor(float factor) { unitConversionFactor = factor; }
65
66        // Read in the <asset> element from a COLLADA xml document
67        FUStatus LoadFromXML(xmlNode* assetNode);
68
69        // Write out the <asset> element to a COLLADA xml node tree
70        // Calling this function will update the 'last modified' timestamp.
71        xmlNode* WriteToXML(xmlNode* parentNode) const;
72};
73
74// Encapsulates the <asset><contributor> element
75class FCOLLADA_EXPORT FCDAssetContributor : public FCDObject
76{
77private:
78        DeclareObjectType;
79
80        fstring author;
81        fstring authoringTool;
82        fstring comments;
83        fstring copyright;
84        fstring sourceData;
85
86public:
87        FCDAssetContributor(FCDocument* document);
88        virtual ~FCDAssetContributor();
89
90        // Direct accessors
91        inline const fstring& GetAuthor() const { return author; }
92        inline const fstring& GetAuthoringTool() const { return authoringTool; }
93        inline const fstring& GetComments() const { return comments; }
94        inline const fstring& GetCopyright() const { return copyright; }
95        inline const fstring& GetSourceData() const { return sourceData; }
96
97        // Direct mutators
98        inline void SetAuthor(const fstring& _author) { author = _author; }
99        inline void SetAuthoringTool(const fstring& _authoringTool) { authoringTool = _authoringTool; }
100        inline void SetComments(const fstring& _comments) { comments = _comments; }
101        inline void SetCopyright(const fstring& _copyright) { copyright = _copyright; }
102        inline void SetSourceData(const fstring& _sourceData) { sourceData = _sourceData; }
103
104        // Returns whether this contributor element contain any valid data
105        bool IsEmpty() const;
106
107        // Read in the <asset><contributor> element from a COLLADA xml document
108        FUStatus LoadFromXML(xmlNode* contributorNode, bool isPreCollada1_4=false);
109
110        // Write out the <asset><contributor> element to a COLLADA xml node tree
111        xmlNode* WriteToXML(xmlNode* parentNode) const;
112};
113
114#endif // _FCD_ASSET_H_
Note: See TracBrowser for help on using the repository browser.