Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cStrPathTree.h
Go to the documentation of this file.
1 //
4 //
5 #ifndef _INC_cStrPathTree_H
6 #define _INC_cStrPathTree_H
7 #ifndef NO_PRAGMA_ONCE
8 #pragma once
9 #endif
10 
11 #include "../GrayLibBase.h"
14 
15 namespace GrayLib
16 {
18  class cStrPathNode;
20 
22  {
26  private:
27  cStrPathNodePtr m_pParent;
28  HASHCODE32_t m_nHashCode;
29  cString m_sVal;
30  cRefPtr<> m_pUserData;
31 
32  public:
33  cStrPathNode(HASHCODE32_t nHashCode, cString sVal) noexcept
34  : m_nHashCode(nHashCode)
35  , m_sVal(sVal)
36  {
37  }
38  HASHCODE32_t get_HashCode() const noexcept
39  {
40  return m_nHashCode;
41  }
42  cString get_Name() const
43  {
44  return m_sVal;
45  }
46  cString get_Path() const; // Construct the full path back to the root.
47  };
48 
50  {
53  public:
54  cStrPathTree(void);
55  ~cStrPathTree(void);
56 
57  cStrPathNodePtr FindPathNode(const GChar_t* pszPath) const;
58  HRESULT AddPath(const GChar_t* pszPath, cRefPtr<> pUserData);
60 
62 
63  public:
64  cStrPathNodePtr m_pRoot; // Root of the tree. Name sorted.
65  cHashTableRef<cStrPathNode> m_aHash; // Has sorted array of nodes.
66  };
67 }
68 #endif
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cStrPathTree.h:22
cString get_Path() const
HASHCODE32_t get_HashCode() const noexcept
Definition: cStrPathTree.h:38
cString get_Name() const
Definition: cStrPathTree.h:42
cStrPathNode(HASHCODE32_t nHashCode, cString sVal) noexcept
Definition: cStrPathTree.h:33
Definition: cStrPathTree.h:50
cHashTableRef< cStrPathNode > m_aHash
Definition: cStrPathTree.h:65
HRESULT RemovePathNode(cStrPathNode *pNode)
UNITTEST_FRIEND(cStrPathTree)
cStrPathNodePtr FindPathNode(const GChar_t *pszPath) const
HRESULT AddPath(const GChar_t *pszPath, cRefPtr<> pUserData)
cStrPathNodePtr m_pRoot
Definition: cStrPathTree.h:64
Definition: cHashTable.h:191
Definition: cRefPtr.h:22
Definition: cMesh.h:22
UNITTEST2_PREDEF(cQuadtree)
cRefPtr< cStrPathNode > cStrPathNodePtr
Definition: cStrPathTree.h:18
UINT32 HASHCODE32_t
always 32 bits.
Definition: GrayCore.h:117
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26