]>
git.proxmox.com Git - ceph.git/blob - ceph/src/common/str_list.cc
016155e98b7332262a30183f816802d1f042dc29
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2009-2010 Dreamhost
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #include "include/str_list.h"
21 using ceph::for_each_substr
;
23 void get_str_list(const string
& str
, const char *delims
, list
<string
>& str_list
)
26 for_each_substr(str
, delims
, [&str_list
] (auto token
) {
27 str_list
.emplace_back(token
.begin(), token
.end());
31 void get_str_list(const string
& str
, list
<string
>& str_list
)
33 const char *delims
= ";,= \t";
34 get_str_list(str
, delims
, str_list
);
37 list
<string
> get_str_list(const string
& str
, const char *delims
)
40 get_str_list(str
, delims
, result
);
44 void get_str_vec(const string
& str
, const char *delims
, vector
<string
>& str_vec
)
47 for_each_substr(str
, delims
, [&str_vec
] (auto token
) {
48 str_vec
.emplace_back(token
.begin(), token
.end());
52 void get_str_vec(const string
& str
, vector
<string
>& str_vec
)
54 const char *delims
= ";,= \t";
55 get_str_vec(str
, delims
, str_vec
);
58 vector
<string
> get_str_vec(const string
& str
, const char *delims
)
60 vector
<string
> result
;
61 get_str_vec(str
, delims
, result
);