Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
SoNodekitCatalog.h
1 #ifndef COIN_SONODEKITCATALOG_H
2 #define COIN_SONODEKITCATALOG_H
3 
4 /**************************************************************************\
5  * Copyright (c) Kongsberg Oil & Gas Technologies AS
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from
21  * this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 \**************************************************************************/
35 
36 #include <Inventor/SoType.h>
37 #include <Inventor/lists/SbList.h>
38 
39 class SbName;
40 
41 
42 #define SO_CATALOG_NAME_NOT_FOUND -1
43 
44 
45 class COIN_DLL_API SoNodekitCatalog {
46 public:
47  static void initClass(void);
48 
49  SoNodekitCatalog(void);
51 
52  int getNumEntries(void) const;
53  int getPartNumber(const SbName & name) const;
54  const SbName & getName(int part) const;
55 
56  SoType getType(int part) const;
57  SoType getType(const SbName & name) const;
58  SoType getDefaultType(int part) const;
59  SoType getDefaultType(const SbName & name) const;
60  SbBool isNullByDefault(int part) const;
61  SbBool isNullByDefault(const SbName & name) const;
62 
63  SbBool isLeaf(int part) const;
64  SbBool isLeaf(const SbName & name) const;
65  const SbName & getParentName(int part) const;
66  const SbName & getParentName(const SbName & name) const;
67  int getParentPartNumber(int part) const;
68  int getParentPartNumber(const SbName & name) const;
69  const SbName & getRightSiblingName(int part) const;
70  const SbName & getRightSiblingName(const SbName & name) const;
71  int getRightSiblingPartNumber(int part) const;
72  int getRightSiblingPartNumber(const SbName & name) const;
73 
74  SbBool isList(int part) const;
75  SbBool isList(const SbName & name) const;
76  SoType getListContainerType(int part) const;
77  SoType getListContainerType(const SbName & name) const;
78  const SoTypeList & getListItemTypes(int part) const;
79  const SoTypeList & getListItemTypes(const SbName & name) const;
80 
81  SbBool isPublic(int part) const;
82  SbBool isPublic(const SbName & name) const;
83 
84  SoNodekitCatalog * clone(SoType type) const;
85 
86  SbBool addEntry(const SbName & name, SoType type, SoType defaulttype,
87  SbBool isdefaultnull, const SbName & parent,
88  const SbName & rightsibling, SbBool islist,
89  SoType listcontainertype, SoType listitemtype,
90  SbBool ispublic);
91  void addListItemType(int part, SoType type);
92  void addListItemType(const SbName & name, SoType type);
93 
94  void narrowTypes(const SbName & name, SoType newtype, SoType newdefaulttype);
95  void setNullByDefault(const SbName & name, SbBool nullbydefault);
96 
97  SbBool recursiveSearch(int part, const SbName & name,
98  SoTypeList * checked) const;
99 
100  void printCheck(void) const;
101 
102 private:
103  SbBool hasEntry(const SbName & name) const;
104  SbBool hasListItemType(const SbName & name, SoType type) const;
105  SbBool reallyAddEntry(class CatalogItem * newitem);
106 
107  int getPartNumber(const SbList<class CatalogItem *> & l,
108  const SbName & name) const;
109  void addListItemType(const SbList<class CatalogItem *> & l,
110  int part, SoType type);
111  SbBool addListItemType(const SbList<class CatalogItem *> & l,
112  const SbName & name, SoType type);
113 
115  SbList<class CatalogItem *> delayeditems;
116 };
117 
118 #endif // !COIN_SONODEKITCATALOG_H
The SbList class is a template container class for lists.
Definition: SoType.h:55
The SoNodekitCatalog class is a container for nodekit layouts.
Definition: SoNodekitCatalog.h:45
The SoTypeList class is a container class for arrays of SoType objects.
Definition: SoTypeList.h:39
The SoType class is the basis for the run-time type system in Coin.
Definition: SoType.h:59
The SbName class stores strings by reference.
Definition: SbName.h:40