From: Radoslaw Zarzynski Date: Wed, 21 Sep 2016 08:33:51 +0000 (+0200) Subject: rgw: add RGWPostObj_ObjStore::get_part_str method. X-Git-Tag: v12.0.3~99^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b52ccce5db9a2947ae919493da1bb97dedee12d2;p=ceph.git rgw: add RGWPostObj_ObjStore::get_part_str method. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index 7d3d321c831a..666cac2f963f 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 7034ff7511ab..79d78b9209eb 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);