Commit 4b085594 authored by ilor's avatar ilor

boost build fix for boost::foreach

parent bfe15c21
......@@ -17,7 +17,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
#ifndef LIBTOKI_LEXICONCLASSIFYLAYER_H
#define LIBTOKI_LEXICONCLASSIFYLAYER_H
#include <libpwrutils/foreach.h>
#include <boost/foreach.hpp>
#include <libtoki/layers/tokenlayer.h>
#include <libtoki/token.h>
......@@ -93,7 +93,7 @@ LexiconClassifyLayer<CMP>::LexiconClassifyLayer(TokenSource *input,
std::string sep(", ");
const std::string& sepstring = props.get<std::string>("lexicon", "");
boost::algorithm::split(v, sepstring, boost::is_any_of(sep));
foreach (const std::string& s, v) {
BOOST_FOREACH (const std::string& s, v) {
if (!s.empty()) {
lex_.insert(UnicodeString::fromUTF8(s).unescape());
}
......
......@@ -14,7 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
See the LICENSE, COPYING.LESSER and COPYING files for more details.
*/
#include <libpwrutils/foreach.h>
#include <boost/foreach.hpp>
#include <libtoki/layers/regexpclassify.h>
#include <libtoki/token.h>
......@@ -28,7 +28,7 @@ RegexpClassifyLayer::RegexpClassifyLayer(TokenSource* input,
const Config::Node& props)
: TokenLayer(input, props)
{
foreach (const Config::Node::value_type &v, props) {
BOOST_FOREACH (const Config::Node::value_type &v, props) {
if (boost::algorithm::starts_with(v.first, "type:")) {
std::string type = v.first.substr(5); //length of "type:"
UErrorCode status = U_ZERO_ERROR;
......@@ -50,7 +50,7 @@ RegexpClassifyLayer::RegexpClassifyLayer(TokenSource* input,
RegexpClassifyLayer::~RegexpClassifyLayer()
{
typedef std::pair<std::string, RegexMatcher*> vt;
foreach (const vt &v, classifiers_) {
BOOST_FOREACH (const vt &v, classifiers_) {
delete v.second;
}
}
......
......@@ -14,7 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
See the LICENSE, COPYING.LESSER and COPYING files for more details.
*/
#include <libpwrutils/foreach.h>
#include <boost/foreach.hpp>
#include <libtoki/layers/init.h>
#include <libtoki/layers/tokenlayer.h>
#include <libtoki/token.h>
......@@ -32,7 +32,7 @@ TokenLayer::TokenLayer(TokenSource* input, const Config::Node& props)
std::vector<std::string> sv;
std::string data = props.get("process_types", "");
boost::algorithm::split(sv, data, boost::algorithm::is_any_of(sep));
foreach (const std::string& s, sv) {
BOOST_FOREACH (const std::string& s, sv) {
if (!s.empty()) {
process_token_types_.insert(s);
}
......@@ -40,7 +40,7 @@ TokenLayer::TokenLayer(TokenSource* input, const Config::Node& props)
std::vector<std::string> sv2;
std::string data2 = props.get("ignore_types", "");
boost::algorithm::split(sv2, data2, boost::algorithm::is_any_of(sep));
foreach (const std::string& s2, sv2) {
BOOST_FOREACH (const std::string& s2, sv2) {
if (!s2.empty()) {
do_not_process_token_types_.insert(s2);
}
......
......@@ -14,7 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
See the LICENSE, COPYING.LESSER and COPYING files for more details.
*/
#include <libpwrutils/foreach.h>
#include <boost/foreach.hpp>
#include <libtoki/util/xmlutil.h>
#include <libtoki/srx/document.h>
......@@ -41,7 +41,7 @@ Document::Document()
Document::~Document()
{
foreach (language_map_t::value_type v, language_map_) {
BOOST_FOREACH (language_map_t::value_type v, language_map_) {
delete v.first;
}
}
......@@ -67,14 +67,14 @@ void Document::load(std::istream &is)
const xmlpp::Node::NodeList lrl =
languagerules->get_children("languagerule");
if (lrl.empty()) throw ParseError("no <languagerule>");
foreach (const xmlpp::Node* n, lrl) {
BOOST_FOREACH (const xmlpp::Node* n, lrl) {
process_languagerule_node(n);
}
const xmlpp::Node* maprules = get_child_or_throw(body, "maprules");
const xmlpp::Node::NodeList mrl =
maprules->get_children("languagemap");
if (mrl.empty()) throw ParseError("no <languagemap>");
foreach (const xmlpp::Node* n, mrl) {
BOOST_FOREACH (const xmlpp::Node* n, mrl) {
process_languagemap_node(n);
}
......@@ -109,7 +109,7 @@ void Document::process_languagerule_node(const xmlpp::Node *n)
"<languagerule> with empty languagerulename attribute");
}
const xmlpp::Node::NodeList lr = n->get_children("rule");
foreach (const xmlpp::Node* n, lr) {
BOOST_FOREACH (const xmlpp::Node* n, lr) {
process_rule_node(name, n);
}
}
......@@ -170,7 +170,7 @@ std::vector<Rule> Document::get_rules_for_lang(
{
UnicodeString ulang = UnicodeString::fromUTF8(lang);
std::vector<Rule> rules;
foreach (language_map_t::value_type v, language_map_) {
BOOST_FOREACH (language_map_t::value_type v, language_map_) {
RegexMatcher& m = *v.first;
m.reset(ulang);
UErrorCode status = U_ZERO_ERROR;
......
......@@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
#include <libtoki/srx/segmenter.h>
#include <libtoki/srx/exception.h>
#include <libpwrutils/foreach.h>
#include <boost/foreach.hpp>
#include <libpwrutils/util.h>
#include <map>
......@@ -35,7 +35,7 @@ Segmenter::~Segmenter()
std::vector<bool> Segmenter::get_break_mask() const {
std::vector<bool> breaks(length_);
foreach (break_map_t::value_type v, break_map_) {
BOOST_FOREACH (break_map_t::value_type v, break_map_) {
breaks[v.first] = v.second;
}
return breaks;
......@@ -43,7 +43,7 @@ std::vector<bool> Segmenter::get_break_mask() const {
std::vector<int> Segmenter::get_break_positions() const {
std::vector<int> breaks;
foreach (break_map_t::value_type v, break_map_) {
BOOST_FOREACH (break_map_t::value_type v, break_map_) {
if (v.second) {
breaks.push_back(v.first);
}
......@@ -65,14 +65,14 @@ NaiveIcuSegmenter::NaiveIcuSegmenter()
NaiveIcuSegmenter::~NaiveIcuSegmenter()
{
foreach (const CompiledRule& cr, crules_) {
BOOST_FOREACH (const CompiledRule& cr, crules_) {
delete cr.matcher;
}
}
void NaiveIcuSegmenter::load_rules(const std::vector<Rule>& rules)
{
foreach (const Rule& r, rules) {
BOOST_FOREACH (const Rule& r, rules) {
UErrorCode status = U_ZERO_ERROR;
CompiledRule cr = r.compile(status);
if (U_SUCCESS(status)) {
......@@ -93,7 +93,7 @@ void NaiveIcuSegmenter::compute_breaks(const UnicodeString& str, int from,
break_map_.clear();
to -= from;
length_ = to;
foreach (const CompiledRule& cr, crules_) {
BOOST_FOREACH (const CompiledRule& cr, crules_) {
UErrorCode ue = U_ZERO_ERROR;
int i = 0;
cr.matcher->reset(str);
......@@ -127,20 +127,20 @@ HxoIcuSegmenter::HxoIcuSegmenter()
HxoIcuSegmenter::~HxoIcuSegmenter()
{
foreach (RegexMatcher* r, nobreak_back_) {
BOOST_FOREACH (RegexMatcher* r, nobreak_back_) {
delete r;
}
foreach (RegexMatcher* r, nobreak_fwd_) {
BOOST_FOREACH (RegexMatcher* r, nobreak_fwd_) {
delete r;
}
foreach (CompiledRule& r, crules_break_) {
BOOST_FOREACH (CompiledRule& r, crules_break_) {
delete r.matcher;
}
}
void HxoIcuSegmenter::load_rules(const std::vector<Rule> &rules)
{
foreach (const Rule& r, rules) {
BOOST_FOREACH (const Rule& r, rules) {
if (r.breaks) {
UErrorCode status = U_ZERO_ERROR;
CompiledRule cr = r.compile(status);
......@@ -251,7 +251,7 @@ NaiveBoostSegmenter::NaiveBoostSegmenter()
void NaiveBoostSegmenter::load_rules(const std::vector<Rule>& rules)
{
std::pair<boost::u32regex, bool> cr;
foreach (const Rule& r, rules) {
BOOST_FOREACH (const Rule& r, rules) {
cr.first = boost::make_u32regex(r.create_pattern());
cr.second = r.breaks;
crules_.push_back(cr);
......@@ -268,7 +268,7 @@ void NaiveBoostSegmenter::compute_breaks(const UnicodeString& str,
length_ = to;
typedef std::pair<boost::u32regex, bool> cr_t;
foreach (const cr_t& cr, crules_) {
BOOST_FOREACH (const cr_t& cr, crules_) {
boost::match_results<const UChar*> what;
const UChar* start = str.getBuffer();
const UChar* end = start + str.length();
......
......@@ -19,7 +19,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
#include <libtoki/layers/tokenlayer.h>
#include <libtoki/tokenizer/layertokenizer.h>
#include <libtoki/tokenizer/whitespacetokenizer.h>
#include <libpwrutils/foreach.h>
#include <boost/foreach.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/foreach.hpp>
......@@ -149,14 +149,14 @@ namespace Toki {
std::vector<std::string> layer_ids;
foreach (const Config::Node::value_type &v, layers_tree) {
BOOST_FOREACH (const Config::Node::value_type &v, layers_tree) {
if (v.first == "layer") {
layer_ids.push_back(v.second.data());
}
}
TokenSource* previous = input_tokenizer_.get();
foreach (const std::string& id, layer_ids) {
BOOST_FOREACH (const std::string& id, layer_ids) {
try {
std::string layer_class;
layer_class = cfg.get("layer:" + id + ".class", "");
......
......@@ -20,7 +20,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
#include <libtoki/util/confignode.h>
#include <libtoki/exception.h>
#include <libpwrutils/foreach.h>
#include <boost/foreach.hpp>
#include <libtoki/parser/loose_ini_paser.h>
#include <boost/algorithm/string.hpp>
......@@ -62,7 +62,7 @@ Node& merge_into(Node& accu, const Node& other)
{
accu.data() = other.data();
using boost::property_tree::ptree;
foreach (const ptree::value_type& in_other, other) {
BOOST_FOREACH (const ptree::value_type& in_other, other) {
boost::optional< ptree& > in_one;
if ((in_one = accu.get_child_optional(in_other.first))) {
if (in_other.second.get("_merge", "") == "override") {
......
......@@ -21,7 +21,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
#endif
#include <libtoki/exception.h>
#include <libpwrutils/foreach.h>
#include <boost/foreach.hpp>
#include <iostream>
......
......@@ -19,7 +19,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
#include <libtoki/util/debug.h>
#include <libpwrutils/util.h>
#include <libtoki/token.h>
#include <libpwrutils/foreach.h>
#include <boost/foreach.hpp>
#include <fstream>
#include <boost/filesystem/fstream.hpp>
......@@ -85,7 +85,7 @@ void test_one_item(const compare_item& c)
cfg = *(c.base_config);
}
foreach (const fs::path& p, c.configs) {
BOOST_FOREACH (const fs::path& p, c.configs) {
Toki::Config::Node additional = Toki::Config::from_file(p.string());
Toki::Config::merge_into(cfg, additional);
}
......@@ -179,7 +179,7 @@ void init_subdir(fs::path dir)
}
global_configs.push_back(boost::shared_ptr<Toki::Config::Node>(cfg));
int count = 0;
foreach (const std::string& s, tests_out) {
BOOST_FOREACH (const std::string& s, tests_out) {
compare_item c;
if (tests_in.find(s) == tests_in.end()) {
if (tests_in.find("main") == tests_in.end()) {
......@@ -202,7 +202,7 @@ void init_subdir(fs::path dir)
BOOST_TEST_MESSAGE("Found " << count << " valid compare test case"
<< (count > 1 ? "s" : "")
<< " in " << dir);
foreach (const fs::path& s, subdirs) {
BOOST_FOREACH (const fs::path& s, subdirs) {
init_subdir(s);
}
}
......@@ -216,7 +216,7 @@ void init_compare_suite(boost::unit_test::test_suite *ts, const std::string& pat
ts->add(BOOST_TEST_CASE(&subdir_exists));
if (!fs::exists(subdir_name)) return;
init_subdir(subdir_name);
foreach (const compare_item& ci, global_compares) {
BOOST_FOREACH (const compare_item& ci, global_compares) {
std::string rel_path = boost::algorithm::replace_first_copy(
ci.out_file.string(), subdir_name, "");
std::string name = "test_compare:" + rel_path;
......
......@@ -16,7 +16,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
#include <libtoki/util/settings.h>
#include <libtoki/exception.h>
#include <libpwrutils/foreach.h>
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE( config )
......@@ -122,7 +122,7 @@ template<typename T>
std::vector<T> all_values(const Toki::Config::Node& c, const std::string& key)
{
std::vector<T> vec;
foreach (const Toki::Config::Node::value_type &v, c) {
BOOST_FOREACH (const Toki::Config::Node::value_type &v, c) {
if (v.first == key) {
vec.push_back(v.second.get_value<T>());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment