Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://coin3d.github.io
https://www.kongsberg.com/en/kogt/
SbName.h
1 #ifndef COIN_SBNAME_H
2 #define COIN_SBNAME_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/SbBasic.h>
37 
38 class SbString;
39 
40 class COIN_DLL_API SbName {
41 public:
42  SbName(void);
43  SbName(const char * namestring);
44  SbName(const SbString & str);
45  SbName(const SbName & name);
46  ~SbName();
47 
48  const char * getString(void) const;
49  int getLength(void) const;
50 
51  int operator!(void) const;
52  friend COIN_DLL_API int operator==(const SbName & lhs, const char * rhs);
53  friend COIN_DLL_API int operator==(const char * lhs, const SbName & rhs);
54  friend COIN_DLL_API int operator==(const SbName & lhs, const SbName & rhs);
55  friend COIN_DLL_API int operator!=(const SbName & lhs, const char * rhs);
56  friend COIN_DLL_API int operator!=(const char * lhs, const SbName & rhs);
57  friend COIN_DLL_API int operator!=(const SbName & lhs, const SbName & rhs);
58 
59  operator const char * (void) const;
60 
61  // The following 4 functions shouldn't be in this class, they are
62  // related solely to .iv/.wrl file I/O (and so would likely be
63  // better placed in SoOutput). This is a design flaw, but we can't
64  // fix it without breaking API compatibility with the original SGI
65  // Inventor.
66  static SbBool isIdentStartChar(const char c);
67  static SbBool isIdentChar(const char c);
68  static SbBool isBaseNameStartChar(const char c);
69  static SbBool isBaseNameChar(const char c);
70 
71  static const SbName & empty(void);
72 
73 private:
74  const char * permaaddress;
75 };
76 
77 COIN_DLL_API int operator==(const SbName & lhs, const char * rhs);
78 COIN_DLL_API int operator==(const char * lhs, const SbName & rhs);
79 COIN_DLL_API int operator==(const SbName & lhs, const SbName & rhs);
80 COIN_DLL_API int operator!=(const SbName & lhs, const char * rhs);
81 COIN_DLL_API int operator!=(const char * lhs, const SbName & rhs);
82 COIN_DLL_API int operator!=(const SbName & lhs, const SbName & rhs);
83 
84 #endif // !COIN_SBNAME_H
int operator==(const SbBox2s &b1, const SbBox2s &b2)
Definition: SbBox2s.h:102
int operator!=(const SbBox2s &b1, const SbBox2s &b2)
Definition: SbBox2s.h:106
The SbString class is a string class with convenience functions for string operations.
Definition: SbString.h:52
The SbName class stores strings by reference.
Definition: SbName.h:40