Tracker: Replace the deprecated std::hash_set with our HashSet.
Change-Id: I7d29f0c905a3ab1a20f6eca252ff1f168218c23f Reviewed-on: https://review.haiku-os.org/c/haiku/+/2322 Reviewed-by: John Scipione <jscipione@gmail.com>
This commit is contained in:
parent
996c9bf0dd
commit
1ba9396139
@ -1905,8 +1905,8 @@ BPoseView::CreatePoses(Model** models, PoseInfo* poseInfoArray, int32 count,
|
||||
Model* model = models[modelIndex];
|
||||
|
||||
// pose adopts model and deletes it when done
|
||||
if (fInsertedNodes.find(*(model->NodeRef())) != fInsertedNodes.end()
|
||||
|| FindZombie(model->NodeRef())) {
|
||||
if (fInsertedNodes.Contains(*(model->NodeRef()))
|
||||
|| FindZombie(model->NodeRef())) {
|
||||
watch_node(model->NodeRef(), B_STOP_WATCHING, this);
|
||||
delete model;
|
||||
if (resultingPoses)
|
||||
@ -1914,7 +1914,7 @@ BPoseView::CreatePoses(Model** models, PoseInfo* poseInfoArray, int32 count,
|
||||
|
||||
continue;
|
||||
} else
|
||||
fInsertedNodes.insert(*(model->NodeRef()));
|
||||
fInsertedNodes.Add(*(model->NodeRef()));
|
||||
|
||||
if ((clipboardMode = FSClipboardFindNodeMode(model, !clipboardLocked,
|
||||
true)) != 0 && !HasPosesInClipboard()) {
|
||||
@ -8067,7 +8067,7 @@ BPoseView::DeletePose(const node_ref* itemNode, BPose* pose, int32 index)
|
||||
pose = fPoseList->FindPose(itemNode, &index);
|
||||
|
||||
if (pose != NULL) {
|
||||
fInsertedNodes.erase(fInsertedNodes.find(*itemNode));
|
||||
fInsertedNodes.Remove(*itemNode);
|
||||
if (pose->TargetModel()->IsSymLink()) {
|
||||
fBrokenLinks->RemoveItem(pose->TargetModel());
|
||||
StopWatchingParentsOf(pose->TargetModel()->EntryRef());
|
||||
@ -8430,7 +8430,7 @@ BPoseView::SwitchDir(const entry_ref* newDirRef, AttributeStreamNode* node)
|
||||
// the new add_poses thread will then set fAddPosesThread to its ID and it
|
||||
// will be allowed to add icons
|
||||
fAddPosesThreads.clear();
|
||||
fInsertedNodes.clear();
|
||||
fInsertedNodes.Clear();
|
||||
|
||||
delete fModel;
|
||||
fModel = model;
|
||||
@ -8511,14 +8511,12 @@ BPoseView::SwitchDir(const entry_ref* newDirRef, AttributeStreamNode* node)
|
||||
void
|
||||
BPoseView::Refresh()
|
||||
{
|
||||
BEntry entry;
|
||||
|
||||
ASSERT(TargetModel());
|
||||
if (TargetModel()->OpenNode() != B_OK)
|
||||
return;
|
||||
|
||||
StopWatching();
|
||||
fInsertedNodes.clear();
|
||||
fInsertedNodes.Clear();
|
||||
ClearPoses();
|
||||
StartWatching();
|
||||
|
||||
|
@ -53,40 +53,17 @@ All rights reserved.
|
||||
|
||||
#include <Directory.h>
|
||||
#include <FilePanel.h>
|
||||
#include <HashSet.h>
|
||||
#include <MessageRunner.h>
|
||||
#include <String.h>
|
||||
#include <ScrollBar.h>
|
||||
#include <View.h>
|
||||
#include <hash_set>
|
||||
#include <set>
|
||||
|
||||
|
||||
class BRefFilter;
|
||||
class BList;
|
||||
|
||||
#if __GNUC__ > 2
|
||||
namespace __gnu_cxx {
|
||||
template<>
|
||||
struct hash<node_ref>
|
||||
#else
|
||||
template<>
|
||||
struct std::hash<node_ref>
|
||||
#endif
|
||||
{
|
||||
size_t
|
||||
operator()(node_ref ref) const
|
||||
{
|
||||
return ref.node;
|
||||
}
|
||||
};
|
||||
#if __GNUC__ > 2
|
||||
} // namespace __gnu_cxx
|
||||
typedef __gnu_cxx::hash_set<node_ref, __gnu_cxx::hash<node_ref> > NodeSet;
|
||||
#else
|
||||
typedef std::hash_set<node_ref, std::hash<node_ref> > NodeSet;
|
||||
#endif
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class BCountView;
|
||||
@ -699,6 +676,35 @@ private:
|
||||
void MoveSelectionOrEntryToTrash(const entry_ref* ref, bool selectNext);
|
||||
void _ResetStartOffset();
|
||||
|
||||
protected:
|
||||
struct node_ref_key {
|
||||
node_ref_key() {}
|
||||
node_ref_key(const node_ref& value) : value(value) {}
|
||||
|
||||
uint32 GetHashCode() const
|
||||
{
|
||||
return (uint32)value.device ^ (uint32)value.node;
|
||||
}
|
||||
|
||||
node_ref_key operator=(const node_ref_key& other)
|
||||
{
|
||||
value = other.value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const node_ref_key& other) const
|
||||
{
|
||||
return (value == other.value);
|
||||
}
|
||||
|
||||
bool operator!=(const node_ref_key& other) const
|
||||
{
|
||||
return (value != other.value);
|
||||
}
|
||||
|
||||
node_ref value;
|
||||
};
|
||||
|
||||
protected:
|
||||
TScrollBar* fHScrollBar;
|
||||
BScrollBar* fVScrollBar;
|
||||
@ -710,7 +716,7 @@ protected:
|
||||
PoseList* fFilteredPoseList;
|
||||
PoseList* fVSPoseList;
|
||||
PoseList* fSelectionList;
|
||||
NodeSet fInsertedNodes;
|
||||
HashSet<node_ref_key> fInsertedNodes;
|
||||
BObjectList<BString> fMimeTypesInSelectionCache;
|
||||
// used for mime string based icon highliting during a drag
|
||||
BObjectList<Model>* fZombieList;
|
||||
|
Loading…
Reference in New Issue
Block a user