1/****************************************************************************************
2
3 Copyright (C) 2015 Autodesk, Inc.
4 All rights reserved.
5
6 Use of this software is subject to the terms of the Autodesk license agreement
7 provided at the time of installation or download, or which otherwise accompanies
8 this software in either electronic or hard copy form.
9
10****************************************************************************************/
11
12//! \file fbxnamehandler.h
13#ifndef _FBXSDK_UTILS_NAMEHANDLER_H_
14#define _FBXSDK_UTILS_NAMEHANDLER_H_
15
16#include <fbxsdk/fbxsdk_def.h>
17
18#include <fbxsdk/core/base/fbxarray.h>
19#include <fbxsdk/core/base/fbxstring.h>
20
21#include <fbxsdk/fbxsdk_nsbegin.h>
22
23/** A name is a case-sensitive string ID of a property, a node, a node attribute, a texture, etc. The characters constituting a name has no specific limitation.
24 * An initial name is the original name (from importing a file, for example), which is saved up for reversible renaming.
25 * A current name is the name used in FBX.
26 * A namespace is a simple grouping of objects under a given name. Namespaces are primarily used to resolve
27 * name-clash issues in FBX, where a new object has the same name as an existing object.
28 *
29 * For example, Maya only accepts names with letters, digits, or underscores. And when a user import FBX into Maya,
30 * a node whose name contains whitespace will be renamed. But the connections and references to this node in FBX
31 * scene graph still use the original name, so users have to use the initial name to retrieve related information.
32 * \nosubgrouping
33 */
34class FBXSDK_DLL FbxNameHandler
35{
36public:
37 /** Constructor.
38 * \param pInitialName Name string used to initialize both members (initialName and currentName)
39 * of this class.
40 */
41 FbxNameHandler(const char* pInitialName = "");
42
43 /** Copy constructor.
44 * \param pName A FbxNameHandler copied to this one.
45 */
46 FbxNameHandler(FbxNameHandler const& pName);
47
48 // !Destructor
49 ~FbxNameHandler();
50
51 /** Set the initial name.
52 * \param pInitialName New string for the initial name.
53 * \remarks The current name will also be changed to this value.
54 */
55 void SetInitialName(const char* pInitialName);
56
57 /** Get the initial name.
58 * \return Pointer to the InitialName string buffer.
59 */
60 const char* GetInitialName() const;
61
62 /** Set the current name.
63 * \param pNewName New string for the current name.
64 * \remarks The initial name is not affected.
65 */
66 void SetCurrentName(const char* pNewName);
67
68 /** Get the current name.
69 * \return Pointer to the CurrentName string buffer.
70 */
71 const char* GetCurrentName() const;
72
73 /** Set the namespace.
74 * \param pNameSpace New string for the namespace.
75 * \remarks The initial name is not affected.
76 */
77 void SetNameSpace(const char* pNameSpace);
78
79 /** Get the namespace.
80 * \return Pointer to the namespace string buffer.
81 */
82 const char* GetNameSpace() const;
83
84 /** Check if the current name and initial name match.
85 * \return \c true if the current name isn't identical to the initial name.
86 */
87 bool IsRenamed() const;
88
89 /** Assignment operator
90 * \param pName FbxNameHandler assigned to this one.
91 */
92 FbxNameHandler& operator= (FbxNameHandler const& pName);
93
94 /**
95 * \name Private use for the renaming strategies classes.
96 *
97 * Some renaming strategies classes need to store the parent name to successfully apply the renaming algorithms.
98 * The methods in this section allow them to do so.
99 * \remark Because of the very specific use of the mParentName string,
100 * callers of the FbxNameHandler class should never assume that mParentName is correctly initialized
101 * nor contains a meaningful value outside the scope of the renaming strategy class that used it.
102 */
103 //@{
104
105 /** Set the parent name.
106 * \param pParentName New string for the parent name.
107 * \remarks The parent name here could combine several hierarchy name.
108 * The full name should be "ParentName + CurrentName".
109 * A
110 * |_B
111 * |_C
112 * For the above hierarchy, the parent name of C is "AB".
113 * The full name of C is "ABC".
114 */
115 void SetParentName(const char* pParentName);
116
117 /** Get the parent name.
118 * \return Pointer to the ParentName string buffer.
119 */
120 const char* GetParentName() const;
121
122 //@}
123
124 /** Get the namespaces in a string pointer array format.
125 * \return FbxArray<FbxString*> .
126 */
127 FbxArray<FbxString*> GetNameSpaceArray(char identifier);
128
129/*****************************************************************************************************************************
130** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
131*****************************************************************************************************************************/
132#ifndef DOXYGEN_SHOULD_SKIP_THIS
133private:
134 FbxString mParentName;
135 FbxString mInitialName;
136 FbxString mCurrentName;
137 FbxString mNameSpace;
138#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
139};
140
141#include <fbxsdk/fbxsdk_nsend.h>
142
143#endif /* _FBXSDK_UTILS_NAMEHANDLER_H_ */
144