mirror of
https://github.com/overte-org/overte.git
synced 2025-07-10 17:38:39 +02:00
55 lines
No EOL
1.4 KiB
C++
55 lines
No EOL
1.4 KiB
C++
//
|
|
// Selection.h
|
|
// render/src/render
|
|
//
|
|
// Created by Sam Gateau on 4/4/2017.
|
|
// Copyright 2017 High Fidelity, Inc.
|
|
// Copyright 2024 Overte e.V.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
|
|
#ifndef hifi_render_Selection_h
|
|
#define hifi_render_Selection_h
|
|
|
|
#include "Item.h"
|
|
|
|
namespace render {
|
|
|
|
class Selection {
|
|
public:
|
|
using Name = std::string;
|
|
|
|
~Selection();
|
|
Selection();
|
|
Selection(const Selection& selection);
|
|
Selection& operator = (const Selection& selection);
|
|
Selection(Selection&& selection);
|
|
Selection& operator = (Selection&& selection);
|
|
|
|
Selection(const Name& name, const ItemIDs& items);
|
|
|
|
const Name& getName() const { return _name; }
|
|
|
|
const ItemIDs& getItems() const { return _items; }
|
|
|
|
bool isEmpty() const { return _items.empty(); }
|
|
|
|
// Test if the ID is in the selection, return the index or -1 if not present
|
|
static const int NOT_FOUND{ -1 };
|
|
|
|
void add(ItemID id) { _items.push_back(id); }
|
|
int find(ItemID id) const;
|
|
bool contains(ItemID id) const { return find(id) > NOT_FOUND; }
|
|
|
|
protected:
|
|
Name _name;
|
|
ItemIDs _items;
|
|
};
|
|
|
|
using SelectionMap = std::unordered_map<Selection::Name, Selection>;
|
|
|
|
}
|
|
|
|
#endif |