From b52ccce5db9a2947ae919493da1bb97dedee12d2 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Wed, 21 Sep 2016 10:33:51 +0200 Subject: [PATCH] rgw: add RGWPostObj_ObjStore::get_part_str method. Signed-off-by: Radoslaw Zarzynski --- src/rgw/rgw_rest.cc | 13 +++++++++++++ src/rgw/rgw_rest.h | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index 7d3d321c831a4..666cac2f963fb 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -1504,6 +1504,19 @@ bool RGWPostObj_ObjStore::part_str(parts_collection_t& parts, return true; } +std::string RGWPostObj_ObjStore::get_part_str(parts_collection_t& parts, + const std::string& name, + const std::string& def_val) +{ + std::string val; + + if (part_str(parts, name, &val)) { + return val; + } else { + return rgw_trim_whitespace(def_val); + } +} + bool RGWPostObj_ObjStore::part_bl(parts_collection_t& parts, const std::string& name, ceph::bufferlist* pbl) diff --git a/src/rgw/rgw_rest.h b/src/rgw/rgw_rest.h index 7034ff7511ab3..79d78b9209eb0 100644 --- a/src/rgw/rgw_rest.h +++ b/src/rgw/rgw_rest.h @@ -272,6 +272,10 @@ protected: const std::string& name, std::string *val); + static std::string get_part_str(parts_collection_t& parts, + const std::string& name, + const std::string& def_val = std::string()); + static bool part_bl(parts_collection_t& parts, const std::string& name, ceph::bufferlist *pbl); -- 2.39.5