Overte C++ Documentation
EntityItemID.h
1 //
2 // EntityItemID.h
3 // libraries/shared/src
4 //
5 // Created by Brad Hefta-Gaub on 12/4/13.
6 // Copyright 2013 High Fidelity, Inc.
7 // Copyright 2023 Overte e.V.
8 //
9 // Distributed under the Apache License, Version 2.0.
10 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
11 // SPDX-License-Identifier: Apache-2.0
12 //
13 
14 #ifndef hifi_EntityItemID_h
15 #define hifi_EntityItemID_h
16 
17 #include <stdint.h>
18 
19 #include <QDebug>
20 #include <QObject>
21 #include <QHash>
22 #include <QtCore/QSharedPointer>
23 #include <QUuid>
24 
25 const QUuid UNKNOWN_ENTITY_ID; // null uuid
26 
28 class EntityItemID : public QUuid {
29 public:
30  EntityItemID();
31  EntityItemID(const QUuid& id);
32  // EntityItemID(const EntityItemID& other);
33  static EntityItemID readEntityItemIDFromBuffer(const unsigned char* data, int bytesLeftToRead);
34 
35  bool isInvalidID() const { return *this == UNKNOWN_ENTITY_ID; }
36 };
37 
38 inline QDebug operator<<(QDebug debug, const EntityItemID& id) {
39  debug << "[entity-id:" << id.toString() << "]";
40  return debug;
41 }
42 
43 Q_DECLARE_METATYPE(EntityItemID);
44 Q_DECLARE_METATYPE(QVector<EntityItemID>);
45 
46 // Allow the use of std::unordered_map with QUuid keys
47 namespace std { template<> struct hash<EntityItemID> { size_t operator()(const EntityItemID& id) const; }; }
48 
49 #endif // hifi_EntityItemID_h
Abstract ID for editing model items. Used in EntityItem JS API.
Definition: EntityItemID.h:28