ufe 7.0
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
pathComponent.h
Go to the documentation of this file.
1#line 1 "D:/Jenkins/workspace/EMS/ECG/ufe/full/ufe-full-python3.13-windows/ufe/include/pathComponent.h"
2#ifndef UFE_PATHCOMPONENT_H
3#define UFE_PATHCOMPONENT_H
4
5// ===========================================================================
6// Copyright 2025 Autodesk, Inc. All rights reserved.
7//
8// The use of this software is subject to the Autodesk Terms of Use or other
9// license agreement provided at the time of installation or download, or
10// which otherwise accompanies this software.
11// ===========================================================================
12
13#include "common/ufeExport.h"
14#include <string>
15#include <memory>
16#include <vector>
17#include <cstdint>
18
20
36public:
37 class Data;
38
44 static bool exists(const std::string& aString);
45
51 static std::vector<PathComponent> toComponents(const std::vector<std::string>& strings);
52
54 static std::size_t tableSize();
55
58 PathComponent(const std::string& aString);
59
62
65
67 operator bool() const;
68
71 PathComponent(const PathComponent&) = default;
74
76 bool operator==(const PathComponent& rhs) const;
78 bool operator!=(const PathComponent& rhs) const;
79
81 const std::string& string() const;
83 std::int64_t id() const;
84
85private:
87
88 std::shared_ptr<Data> fData;
89};
90
91}
92
93// Hashing support.
94namespace std {
95template<> struct hash<Ufe::PathComponent> {
96 std::size_t operator()(const Ufe::PathComponent& c) const {
97 // Use the ID as the hash value. If the PathComponent is empty, id() returns -1,
98 // which the static_cast to size_t will turn into the largeset positive value that
99 // size_t can hold. Which is fine for a hash value since you would probably never
100 // have an empty PathComponent in a hash table.
101 return static_cast<std::size_t>(c.id());
102 }
103};
104}
105
106#endif /* UFE_PATHCOMPONENT_H */
Constant string representation with fixed space and O(1) comparison.
Definition: pathComponent.h:35
PathComponent()
Constructor to create a null PathComponent.
static std::size_t tableSize()
static std::vector< PathComponent > toComponents(const std::vector< std::string > &strings)
const std::string & string() const
Access the underlying shared string, and its ID. A null PathComponent has an empty string and an ID o...
bool operator!=(const PathComponent &rhs) const
Not equal operator overload.
PathComponent(const std::string &aString)
bool operator==(const PathComponent &rhs) const
Equal operator overload.
std::int64_t id() const
Access the underlying shared string, and its ID. A null PathComponent has an empty string and an ID o...
static bool exists(const std::string &aString)
PathComponent & operator=(const PathComponent &)
~PathComponent()
Destructor.
PathComponent(const PathComponent &)=default
std::shared_ptr< Data > fData
Definition: pathComponent.h:88
std::string string(const Path &path)
Definition: array.h:24
Definition: path.h:202
std::size_t operator()(const Ufe::PathComponent &c) const
Definition: pathComponent.h:96
#define UFE_NS_DEF
Definition: ufe.h:36
Definition of macros for symbol visibility.
#define UFE_SDK_DECL
Definition: ufeExport.h:35