summaryrefslogtreecommitdiffstats
path: root/src/common/ceph_argparse.h
diff options
context:
space:
mode:
authorDmitry Yatsushkevich <dyatsushkevich@mirantis.com>2015-03-27 23:34:24 +0100
committerDmitry Yatsushkevich <dyatsushkevich@mirantis.com>2015-03-31 21:13:55 +0200
commitaa77a4661c5e486b181c6246ac65a6fe322ebfb1 (patch)
tree5d2054094d056ae56ae7d8ef30d7f1a4c0068578 /src/common/ceph_argparse.h
parentrbd cli: remove erroneous arg for ceph_argparse_witharg (diff)
downloadceph-aa77a4661c5e486b181c6246ac65a6fe322ebfb1.tar.xz
ceph-aa77a4661c5e486b181c6246ac65a6fe322ebfb1.zip
ceph_argparse: generalize ceph_argparse_with* routines
Remove code duplication by generalizing ceph_argparse_with{int,float,longlong} routines - make one template function for those cases. Signed-off-by: Dmitry Yatsushkevich <dyatsushkevich@mirantis.com>
Diffstat (limited to 'src/common/ceph_argparse.h')
-rw-r--r--src/common/ceph_argparse.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/common/ceph_argparse.h b/src/common/ceph_argparse.h
index 3ef0251abeb..41a4cb4609d 100644
--- a/src/common/ceph_argparse.h
+++ b/src/common/ceph_argparse.h
@@ -57,21 +57,16 @@ bool ceph_argparse_flag(std::vector<const char*> &args,
std::vector<const char*>::iterator &i, ...);
bool ceph_argparse_witharg(std::vector<const char*> &args,
std::vector<const char*>::iterator &i, std::string *ret, ...);
+template<class T>
+bool ceph_argparse_witharg(std::vector<const char*> &args,
+ std::vector<const char*>::iterator &i, T *ret,
+ std::ostream *oss, ...);
bool ceph_argparse_binary_flag(std::vector<const char*> &args,
std::vector<const char*>::iterator &i, int *ret,
std::ostream *oss, ...);
extern CephInitParameters ceph_argparse_early_args
(std::vector<const char*>& args, uint32_t module_type, int flags,
std::string *cluster, std::string *conf_file_list);
-extern bool ceph_argparse_withint(std::vector<const char*> &args,
- std::vector<const char*>::iterator &i, int *ret,
- std::ostream *oss, ...);
-extern bool ceph_argparse_withfloat(std::vector<const char*> &args,
- std::vector<const char*>::iterator &i, float *ret,
- std::ostream *oss, ...);
-extern bool ceph_argparse_withlonglong(std::vector<const char*> &args,
- std::vector<const char*>::iterator &i, long long *ret,
- std::ostream *oss, ...);
extern void generic_server_usage();
extern void generic_client_usage();