From 46fb4b43011a4043c7b5ef2e7bd57e1695cd6b7f Mon Sep 17 00:00:00 2001 From: caballero Date: Tue, 9 Jun 2009 16:27:49 +0000 Subject: [PATCH] Added attribute reading functionality. --- src2/creaImageIOGimmick.cpp | 16 ++++++++++++++++ src2/creaImageIOGimmick.h | 6 ++++++ src2/creaImageIOTreeHandlerImageAdder.cpp | 14 ++++++++++++++ src2/creaImageIOTreeHandlerImageAdder.h | 5 +++++ 4 files changed, 41 insertions(+) diff --git a/src2/creaImageIOGimmick.cpp b/src2/creaImageIOGimmick.cpp index 8368083..0dc9796 100644 --- a/src2/creaImageIOGimmick.cpp +++ b/src2/creaImageIOGimmick.cpp @@ -519,6 +519,22 @@ namespace creaImageIO //======================================================================== + void Gimmick::GetAttributes(const std::string& d, + const std::string& filename, + const std::vector& params, + std::vector& results) + { + TreeHandler * handler=GetTreeHandler(d); + mImageAdder.SetCurrentDatabase(d); + mImageAdder.SetTreeHandler(handler); + mImageAdder.SetTimestampHandler(mTimestampDatabase); + mImageAdder.SetSynchronizer(mSynchronizer); + mImageAdder.GetAttributes(params, filename, results); + } + //======================================================================== + + //======================================================================== + void Gimmick::UpdateSetting(const std::string& name, const std::string& value) { mSettings->updateSetting(name,value); diff --git a/src2/creaImageIOGimmick.h b/src2/creaImageIOGimmick.h index 448fc9b..99908d6 100644 --- a/src2/creaImageIOGimmick.h +++ b/src2/creaImageIOGimmick.h @@ -142,6 +142,12 @@ namespace creaImageIO ///Edits the field described by the name and key provided with the value given void EditField(tree::Node* node, const std::string& d, const std::string& name, const std::string& key, const std::string& val); + /// Returns the attributes in results described in params + void GetAttributes(const std::string& d, + const std::string& filename, + const std::vector& params, + std::vector& results); + /// const std::string& GetHomeDirectory(); const std::string& GetUserSettingsDirectory(); diff --git a/src2/creaImageIOTreeHandlerImageAdder.cpp b/src2/creaImageIOTreeHandlerImageAdder.cpp index a6b0737..258cc74 100644 --- a/src2/creaImageIOTreeHandlerImageAdder.cpp +++ b/src2/creaImageIOTreeHandlerImageAdder.cpp @@ -586,5 +586,19 @@ namespace creaImageIO mTreeHandler->SetAttribute(node,key,val); } + //======================================================================= + void TreeHandlerImageAdder::GetAttributes(const std::vector& params, + const std::string& filename, + std::vector& results) + { + std::vector::const_iterator i; + std::string result; + for(i=params.begin();i!=params.end();i++) + { + mTreeHandler->GetAttribute("Image","FullFileName",filename,*i,result); + results.push_back(result); + } + } + } diff --git a/src2/creaImageIOTreeHandlerImageAdder.h b/src2/creaImageIOTreeHandlerImageAdder.h index 2fe9efd..521f0ff 100644 --- a/src2/creaImageIOTreeHandlerImageAdder.h +++ b/src2/creaImageIOTreeHandlerImageAdder.h @@ -142,6 +142,11 @@ namespace creaImageIO void DeleteDriveFromOtherDB(const std::string& drive); ///Edits the given field and sets the new parameters void EditField(tree::Node* node, const std::string& name, const std::string& key, const std::string& val); + ///Returns the demanded attributes for the given file + void GetAttributes(const std::vector& params, + const std::string& filename, + std::vector& results); + -- 2.45.0