FCDocument/FCDAsset.h

00001 /*
00002     Copyright (C) 2005-2006 Feeling Software Inc.
00003     MIT License: http://www.opensource.org/licenses/mit-license.php
00004 */
00005 
00006 #ifndef _FCD_ASSET_H_
00007 #define _FCD_ASSET_H_
00008 
00009 #include "FCDocument/FCDObject.h"
00010 #include "FUtils/FUDateTime.h"
00011 
00012 class FCDAssetContributor;
00013 
00014 typedef vector<FCDAssetContributor*> FCDAssetContributorList;
00015 
00016 class FCOLLADA_EXPORT FCDAsset : public FCDObject
00017 {
00018 private:
00019     DeclareObjectType;
00020 
00021     FCDAssetContributorList contributors;
00022     FUDateTime creationDateTime;
00023     FUDateTime modifiedDateTime;
00024     fstring keywords;
00025     fstring revision;
00026     fstring subject;
00027     fstring title;
00028     FMVector3 upAxis;
00029 
00030     // <unit>
00031     fstring unitName;
00032     float unitConversionFactor;
00033 
00034 public:
00035     FCDAsset(FCDocument* document);
00036     virtual ~FCDAsset();
00037 
00038     // Direct contributor list access
00039     inline FCDAssetContributorList& GetContributors() { return contributors; }
00040     inline const FCDAssetContributorList& GetContributors() const { return contributors; }
00041     inline size_t GetContributorCount() const { return contributors.size(); }
00042     inline FCDAssetContributor* GetContributor(size_t index) { return index < contributors.size() ? contributors[index] : NULL; }
00043     inline const FCDAssetContributor* GetContributor(size_t index) const { return index < contributors.size() ? contributors[index] : NULL; }
00044     FCDAssetContributor* AddContributor();
00045 
00046     // Direct accessors
00047     inline const FUDateTime& GetCreationDateTime() const { return creationDateTime; }
00048     inline const FUDateTime& GetModifiedDateTime() const { return modifiedDateTime; }
00049     inline const fstring& GetKeywords() const { return keywords; }
00050     inline const fstring& GetRevision() const { return revision; }
00051     inline const fstring& GetSubject() const { return subject; }
00052     inline const fstring& GetTitle() const { return title; }
00053     inline const FMVector3& GetUpAxis() const { return upAxis; }
00054     inline const fstring& GetUnitName() const { return unitName; }
00055     inline float GetUnitConversionFactor() const { return unitConversionFactor; }
00056 
00057     // Direct mutators
00058     inline void SetKeywords(const fstring& _keywords) { keywords = _keywords; }
00059     inline void SetRevision(const fstring& _revision) { revision = _revision; }
00060     inline void SetSubject(const fstring& _subject) { subject = _subject; }
00061     inline void SetTitle(const fstring& _title) { title = _title; }
00062     inline void SetUpAxis(const FMVector3& _upAxis) { upAxis = _upAxis; }
00063     inline void SetUnitName(const fstring& _unitName) { unitName = _unitName; }
00064     inline void SetUnitConversionFactor(float factor) { unitConversionFactor = factor; }
00065 
00066     // Read in the <asset> element from a COLLADA xml document
00067     FUStatus LoadFromXML(xmlNode* assetNode);
00068 
00069     // Write out the <asset> element to a COLLADA xml node tree
00070     // Calling this function will update the 'last modified' timestamp.
00071     xmlNode* WriteToXML(xmlNode* parentNode) const;
00072 };
00073 
00074 // Encapsulates the <asset><contributor> element
00075 class FCOLLADA_EXPORT FCDAssetContributor : public FCDObject
00076 {
00077 private:
00078     DeclareObjectType;
00079 
00080     fstring author;
00081     fstring authoringTool;
00082     fstring comments;
00083     fstring copyright;
00084     fstring sourceData;
00085 
00086 public:
00087     FCDAssetContributor(FCDocument* document);
00088     virtual ~FCDAssetContributor();
00089 
00090     // Direct accessors
00091     inline const fstring& GetAuthor() const { return author; }
00092     inline const fstring& GetAuthoringTool() const { return authoringTool; }
00093     inline const fstring& GetComments() const { return comments; }
00094     inline const fstring& GetCopyright() const { return copyright; }
00095     inline const fstring& GetSourceData() const { return sourceData; }
00096 
00097     // Direct mutators
00098     inline void SetAuthor(const fstring& _author) { author = _author; }
00099     inline void SetAuthoringTool(const fstring& _authoringTool) { authoringTool = _authoringTool; }
00100     inline void SetComments(const fstring& _comments) { comments = _comments; }
00101     inline void SetCopyright(const fstring& _copyright) { copyright = _copyright; }
00102     inline void SetSourceData(const fstring& _sourceData) { sourceData = _sourceData; }
00103 
00104     // Returns whether this contributor element contain any valid data
00105     bool IsEmpty() const;
00106 
00107     // Read in the <asset><contributor> element from a COLLADA xml document
00108     FUStatus LoadFromXML(xmlNode* contributorNode, bool isPreCollada1_4=false);
00109 
00110     // Write out the <asset><contributor> element to a COLLADA xml node tree
00111     xmlNode* WriteToXML(xmlNode* parentNode) const;
00112 };
00113 
00114 #endif // _FCD_ASSET_H_

Generated on Fri May 12 16:44:38 2006 for FCollada by  doxygen 1.4.6-NO