tokenizer.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <string>
3 #include <vector>
4 
5 #include <boost/bind.hpp>
6 #include <boost/function.hpp>
7 #include <boost/algorithm/string.hpp>
8 #include <boost/foreach.hpp>
9 
10 void
11 _delimeter_tokenizer (std::string &data, std::vector<std::string> &tokens,
12  std::string delimeter)
13 {
14  boost::split(tokens, data, boost::is_any_of(delimeter));
15 }
16 
17 typedef boost::function<void(std::string&,std::vector<std::string>&)> TokenizerType;
18 
19 int main(void) {
20  std::string data = "a\rb\rc\r";
21  std::vector<std::string> tokens;
22  std::string delimeter = "\r";
23 
24  TokenizerType f = boost::bind(_delimeter_tokenizer, _1, _2, delimeter);
25  f(data, tokens);
26 
27  BOOST_FOREACH(std::string token, tokens)
28  std::cout << token << std::endl;
29 
30  return 0;
31 }
_delimeter_tokenizer
void _delimeter_tokenizer(std::string &data, std::vector< std::string > &tokens, std::string delimeter)
Definition: tokenizer.cc:11
TokenizerType
boost::function< void(std::string &, std::vector< std::string > &)> TokenizerType
Definition: tokenizer.cc:17
data
data
f
f
upgrade_firmware.token
token
Definition: upgrade_firmware.py:65
main
int main(void)
Definition: tokenizer.cc:19


ubiquity_motor
Author(s):
autogenerated on Thu Nov 16 2023 03:30:56