vrshoot

view libs/assimp/assimp/metadata.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line source
1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
6 Copyright (c) 2006-2012, assimp team
8 All rights reserved.
10 Redistribution and use of this software in source and binary forms,
11 with or without modification, are permitted provided that the following
12 conditions are met:
14 * Redistributions of source code must retain the above
15 copyright notice, this list of conditions and the
16 following disclaimer.
18 * Redistributions in binary form must reproduce the above
19 copyright notice, this list of conditions and the
20 following disclaimer in the documentation and/or other
21 materials provided with the distribution.
23 * Neither the name of the assimp team, nor the names of its
24 contributors may be used to endorse or promote products
25 derived from this software without specific prior
26 written permission of the assimp team.
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 ---------------------------------------------------------------------------
40 */
42 /** @file metadata.h
43 * @brief Defines the data structures for holding node meta information.
44 */
45 #ifndef __AI_METADATA_H_INC__
46 #define __AI_METADATA_H_INC__
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
52 // -------------------------------------------------------------------------------
53 /**
54 * Container for holding metadata.
55 *
56 * Metadata is a key-value store using string keys and values.
57 */
58 // -------------------------------------------------------------------------------
59 struct aiMetadata
60 {
61 /** Length of the mKeys and mValues arrays, respectively */
62 unsigned int mNumProperties;
64 /** Arrays of keys, may not be NULL. Entries in this array may not be NULL as well. */
65 C_STRUCT aiString** mKeys;
67 /** Arrays of values, may not be NULL. Entries in this array may be NULL if the
68 * corresponding property key has no assigned value. */
69 C_STRUCT aiString** mValues;
71 #ifdef __cplusplus
73 /** Constructor */
74 aiMetadata()
75 {
76 // set all members to zero by default
77 mKeys = NULL;
78 mValues = NULL;
79 mNumProperties = 0;
80 }
83 /** Destructor */
84 ~aiMetadata()
85 {
86 if (mKeys && mValues) {
87 for (unsigned i=0; i<mNumProperties; ++i) {
88 if (mKeys[i]) {
89 delete mKeys[i];
90 }
91 if (mValues[i]) {
92 delete mValues[i];
93 }
94 }
95 delete [] mKeys;
96 delete [] mValues;
97 }
98 }
101 inline bool Get(const aiString& key, aiString& value)
102 {
103 for (unsigned i=0; i<mNumProperties; ++i) {
104 if (mKeys[i] && *mKeys[i]==key) {
105 value=*mValues[i];
106 return true;
107 }
108 }
109 return false;
110 }
111 #endif // __cplusplus
112 };
114 #ifdef __cplusplus
115 } //extern "C" {
116 #endif
118 #endif // __AI_METADATA_H_INC__