~ubuntu-branches/ubuntu/wily/opencollada/wily-proposed

« back to all changes in this revision

Viewing changes to dae2ma/include/DAE2MAExtraDataCallbackHandler.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2008-2009 NetAllied Systems GmbH
 
3
 
 
4
    This file is part of DAE2MA.
 
5
 
 
6
    Licensed under the MIT Open Source License, 
 
7
    for details please see LICENSE file or the website
 
8
    http://www.opensource.org/licenses/mit-license.php
 
9
*/
 
10
 
 
11
#ifndef __DAE2MA_EXTRADATACALLBACKHANDLER_H__
 
12
#define __DAE2MA_EXTRADATACALLBACKHANDLER_H__
 
13
 
 
14
#include "DAE2MAPrerequisites.h"
 
15
 
 
16
#include "COLLADASaxFWLIExtraDataCallbackHandler.h"
 
17
 
 
18
 
 
19
namespace DAE2MA
 
20
{
 
21
 
 
22
    class ExtraInfo
 
23
    { 
 
24
    private:
 
25
 
 
26
        /** The hash value of the currently parsed extra data element. */
 
27
        StringHash mElementHash; 
 
28
 
 
29
        /** The uniqueId of the currently parsed extra data element. */
 
30
        COLLADAFW::UniqueId mUniqueId;
 
31
 
 
32
        /** The text value of the current original maya id. */
 
33
        String mOriginalMayaId;
 
34
 
 
35
    public:
 
36
 
 
37
        /** Constructor. */
 
38
        ExtraInfo () {}
 
39
 
 
40
        /** Destructor. */
 
41
        virtual ~ExtraInfo () {}
 
42
 
 
43
        /** The hash value of the currently parsed extra data element. */
 
44
        const StringHash& getElementHash () const { return mElementHash; }
 
45
        void setElementHash ( const StringHash& val ) { mElementHash = val; }
 
46
 
 
47
        /** The uniqueId of the currently parsed extra data element. */
 
48
        const COLLADAFW::UniqueId& getUniqueId () const { return mUniqueId; }
 
49
        void setUniqueId ( const COLLADAFW::UniqueId& val ) { mUniqueId = val; }
 
50
 
 
51
        /** The text value of the current original maya id. */
 
52
        const String& getOriginalMayaId () const { return mOriginalMayaId; }
 
53
        void setOriginalMayaId ( const String& val ) { mOriginalMayaId = val; }
 
54
        void setOriginalMayaId ( const GeneratedSaxParser::ParserChar* text, size_t textLength ) 
 
55
        { 
 
56
            mOriginalMayaId.assign ( text, textLength ); 
 
57
        }
 
58
 
 
59
    };
 
60
 
 
61
    /** Implementation of an extra data callback handler with the callback handler interface. */
 
62
        class ExtraDataCallbackHandler : public COLLADASaxFWL::IExtraDataCallbackHandler
 
63
    {
 
64
    private:
 
65
 
 
66
        typedef std::map<COLLADAFW::UniqueId, std::vector<ExtraInfo> > ExtraInfosMap;
 
67
 
 
68
        private:
 
69
        
 
70
        /** True, if the current text field is the original id field. */
 
71
        bool mIsOriginalIdField;
 
72
 
 
73
        ExtraInfo mCurrentExtraInfo;
 
74
 
 
75
        ExtraInfosMap mExtraInfos;
 
76
 
 
77
        public:
 
78
 
 
79
        /** Constructor. */
 
80
                ExtraDataCallbackHandler();
 
81
 
 
82
        /** Destructor. */
 
83
                virtual ~ExtraDataCallbackHandler();
 
84
 
 
85
        /** Returns the extra info with the searched id and hash string value. */
 
86
        const ExtraInfo* findExtraInfo ( 
 
87
            const COLLADAFW::UniqueId& uniqueId, 
 
88
            const StringHash& hashElement ) const;
 
89
 
 
90
        /** Method to ask, if the current callback handler want to read the data of the given extra element. */
 
91
        virtual bool parseElement ( 
 
92
            const GeneratedSaxParser::ParserChar* profileName, 
 
93
            const StringHash& elementHash, 
 
94
            const COLLADAFW::UniqueId& uniqueId,
 
95
                        COLLADAFW::Object* object);
 
96
 
 
97
        /** The methods to get the extra data tags to the registered callback handlers. */
 
98
        virtual bool elementBegin( const GeneratedSaxParser::ParserChar* elementName, const GeneratedSaxParser::xmlChar** attributes);
 
99
        virtual bool elementEnd(const GeneratedSaxParser::ParserChar* elementName );
 
100
        virtual bool textData(const GeneratedSaxParser::ParserChar* text, size_t textLength);
 
101
 
 
102
        private:
 
103
 
 
104
        /** Disable default copy ctor. */
 
105
                ExtraDataCallbackHandler( const ExtraDataCallbackHandler& pre );
 
106
 
 
107
        /** Disable default assignment operator. */
 
108
                const ExtraDataCallbackHandler& operator= ( const ExtraDataCallbackHandler& pre );
 
109
 
 
110
        };
 
111
 
 
112
} // namespace DAE2MA
 
113
 
 
114
#endif // __DAE2MA_EXTRADATACALLBACKHANDLER_H__