From 040a81419dda83d1014e9dc94936a4cb3f027303 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 6 Aug 2013 00:39:13 +0200 Subject: [PATCH] Add node_ref::operator < Moved from VirtualDirectoryManager. Defining the operator static doesn't work with gcc 4 and it's useful to have globally available anyway. --- headers/os/storage/Node.h | 1 + src/kits/storage/Node.cpp | 10 ++++++++++ src/kits/tracker/VirtualDirectoryManager.cpp | 9 --------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/headers/os/storage/Node.h b/headers/os/storage/Node.h index 7643a61597..618d4aec0a 100644 --- a/headers/os/storage/Node.h +++ b/headers/os/storage/Node.h @@ -22,6 +22,7 @@ struct node_ref { bool operator==(const node_ref& ref) const; bool operator!=(const node_ref& ref) const; + bool operator<(const node_ref& ref) const; node_ref& operator=(const node_ref& ref); dev_t device; diff --git a/src/kits/storage/Node.cpp b/src/kits/storage/Node.cpp index 5cce99b1a7..83ce9dc59d 100644 --- a/src/kits/storage/Node.cpp +++ b/src/kits/storage/Node.cpp @@ -68,6 +68,16 @@ node_ref::operator!=(const node_ref &ref) const return !(*this == ref); } + +bool +node_ref::operator<(const node_ref& other) const +{ + if (this->device != other.device) + return this->device < other.device; + return this->node < other.node; +} + + // = node_ref& node_ref::operator=(const node_ref &ref) diff --git a/src/kits/tracker/VirtualDirectoryManager.cpp b/src/kits/tracker/VirtualDirectoryManager.cpp index 40dce3fdb9..e385efde63 100644 --- a/src/kits/tracker/VirtualDirectoryManager.cpp +++ b/src/kits/tracker/VirtualDirectoryManager.cpp @@ -35,15 +35,6 @@ static const char* const kTemporaryDefinitionFileBaseDirectoryPath = "/tmp/tracker/virtual-directories"; -static bool -operator<(const node_ref& a, const node_ref& b) -{ - if (a.device != b.device) - return a.device < b.device; - return a.node < b.node; -} - - // #pragma mark - Info