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 fbxcharptrset.h
13#ifndef _FBXSDK_CORE_BASE_CHARPTRSET_H_
14#define _FBXSDK_CORE_BASE_CHARPTRSET_H_
15
16#include <fbxsdk/fbxsdk_def.h>
17
18#include <fbxsdk/fbxsdk_nsbegin.h>
19
20/** This class contains the data structure support for char pointer set.
21 */
22class FBXSDK_DLL FbxCharPtrSet
23{
24public:
25 /** Class constructor
26 * \param pItemPerBlock Number of item per block. Default is 20. */
27 FbxCharPtrSet(int pItemPerBlock=20);
28
29 //! Class destructor
30 ~FbxCharPtrSet();
31
32 /** Add a new item.
33 * \param pReference char pointer reference to the item.
34 * \param pItem FbxHandle to the item. */
35 void Add(const char* pReference, FbxHandle pItem);
36
37 /** Removes an item.
38 * \param pReference char reference to the item.
39 * \return true if successful. */
40 bool Remove(const char* pReference);
41
42 /** Get an item's reference.
43 * \param pReference char reference to the item.
44 * \param PIndex index to the item.
45 * \return FbxHandle to the item, NULL if fails. */
46 FbxHandle Get(const char* pReference, int* PIndex=NULL);
47
48 /** Get an item's reference from index.
49 * \param pIndex index to the item.
50 * \return FbxHandle to the item, NULL if fails. */
51 FbxHandle& operator[](int pIndex);
52
53 /** Get an item's reference from index.
54 * \param pIndex index to the item.
55 * \param pReference char reference to the item.
56 * \return FbxHandle to the item, NULL if fails. */
57 FbxHandle GetFromIndex(int pIndex, const char** pReference=NULL);
58
59 /** Removes an item by index.
60 * \param pIndex index to the item. */
61 void RemoveFromIndex(int pIndex);
62
63 /** Get the number of item in the array.
64 * \return the number of element in the set. */
65 inline int GetCount() const { return mCharPtrSetCount; }
66
67 //! Sorts the array.
68 void Sort();
69
70 //! Clears the array.
71 void Clear();
72
73/*****************************************************************************************************************************
74** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
75*****************************************************************************************************************************/
76#ifndef DOXYGEN_SHOULD_SKIP_THIS
77 struct CharPtrSet;
78
79 inline void SetCaseSensitive(bool pIsCaseSensitive){ mIsCaseSensitive = pIsCaseSensitive; }
80
81private:
82 CharPtrSet* FindEqual(const char* pReference) const;
83
84 CharPtrSet* mCharPtrSetArray;
85 int mCharPtrSetCount;
86 int mBlockCount;
87 int mItemPerBlock;
88 bool mIsChanged;
89 bool mIsCaseSensitive;
90#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
91};
92
93#include <fbxsdk/fbxsdk_nsend.h>
94
95#endif /* _FBXSDK_CORE_BASE_CHARPTRSET_H_ */
96