aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-24 14:14:22 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-24 14:14:22 +0000
commit98b8136f9e9374dac4cf860c0a1e504c6ec7ff3e (patch)
tree45f8b6eaf24858fc5702726f5e5c09a0766ed405 /src
parent88e66f89fd170cfe378ec8801ced9e99422663a5 (diff)
downloadpaludis-98b8136f9e9374dac4cf860c0a1e504c6ec7ff3e.tar.gz
paludis-98b8136f9e9374dac4cf860c0a1e504c6ec7ff3e.tar.xz
New improved tokeniser
Diffstat (limited to 'src')
-rw-r--r--src/clients/adjutrix/downgrade_check.cc2
-rw-r--r--src/clients/contrarius/stage.cc2
-rw-r--r--src/clients/contrarius/target_config.cc4
-rw-r--r--src/clients/reconcilio/broken_linkage_finder/configuration.cc24
-rw-r--r--src/clients/reconcilio/broken_linkage_finder/libtool_linkage_checker.cc3
-rw-r--r--src/output/console_query_task.cc2
6 files changed, 17 insertions, 20 deletions
diff --git a/src/clients/adjutrix/downgrade_check.cc b/src/clients/adjutrix/downgrade_check.cc
index 6c01db7..56a3540 100644
--- a/src/clients/adjutrix/downgrade_check.cc
+++ b/src/clients/adjutrix/downgrade_check.cc
@@ -109,7 +109,7 @@ namespace
while (std::getline(f, s))
{
std::vector<std::string> tokens;
- WhitespaceTokeniser::tokenise(s, std::back_inserter(tokens));
+ tokenise_whitespace(s, std::back_inserter(tokens));
if (tokens.size() != 3)
throw ConfigurationError("Bad line '" + s + "'");
diff --git a/src/clients/contrarius/stage.cc b/src/clients/contrarius/stage.cc
index 61b3b3d..5467ea9 100644
--- a/src/clients/contrarius/stage.cc
+++ b/src/clients/contrarius/stage.cc
@@ -45,7 +45,7 @@ bool
AuxiliaryStage::is_rebuild() const
{
std::list<std::string> packages;
- WhitespaceTokeniser::tokenise(TargetConfig::get_instance()->aux(), std::back_inserter(packages));
+ tokenise_whitespace(TargetConfig::get_instance()->aux(), std::back_inserter(packages));
for (std::list<std::string>::const_iterator p(packages.begin()), p_end(packages.end()) ;
p != p_end ; ++p)
diff --git a/src/clients/contrarius/target_config.cc b/src/clients/contrarius/target_config.cc
index 910fbe5..7bd38c0 100644
--- a/src/clients/contrarius/target_config.cc
+++ b/src/clients/contrarius/target_config.cc
@@ -47,7 +47,7 @@ TargetConfig::_parse_defaults()
{
Context c2("While parsing line '" + *l + "'");
std::vector<std::string> tokens;
- WhitespaceTokeniser::tokenise(*l, std::back_inserter(tokens));
+ tokenise_whitespace(*l, std::back_inserter(tokens));
SpecEntryList * list(&_binutils_list);
if ((("aux" == tokens[1]) || "headers" == tokens[1]) && (2 == std::distance(tokens.begin(), tokens.end())))
@@ -86,7 +86,7 @@ TargetConfig::_find_match(SpecEntryList & list)
i != i_end ; ++i)
{
tokens.clear();
- Tokeniser<delim_kind::AnyOfTag>::tokenise(i->first, "-", std::back_inserter(tokens));
+ tokenise<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(i->first, "-", "", std::back_inserter(tokens));
for (unsigned index(0) ; index < 4 ; ++index)
{
diff --git a/src/clients/reconcilio/broken_linkage_finder/configuration.cc b/src/clients/reconcilio/broken_linkage_finder/configuration.cc
index da4189c..a14805e 100644
--- a/src/clients/reconcilio/broken_linkage_finder/configuration.cc
+++ b/src/clients/reconcilio/broken_linkage_finder/configuration.cc
@@ -73,16 +73,16 @@ namespace
}
};
- template <typename Tokeniser_, typename T_>
+ template <typename T_>
void
- from_string(const tr1::function<std::string (const std::string &)> & source,
- const std::string & varname, std::vector<T_> & vec, const std::string & delims)
+ from_colon_string(const tr1::function<std::string (const std::string &)> & source,
+ const std::string & varname, std::vector<T_> & vec)
{
std::string str(source.operator() (varname)); /* silly 4.3 ICE */
if (! str.empty())
{
Log::get_instance()->message(ll_debug, lc_context, "Got " + varname + "=\"" + str + "\"");
- Tokeniser_::tokenise(str, delims, std::back_inserter(vec));
+ tokenise<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(str, ":", "", std::back_inserter(vec));
}
}
@@ -95,7 +95,7 @@ namespace
if (! str.empty())
{
Log::get_instance()->message(ll_debug, lc_context, "Got " + varname + "=\"" + str + "\"");
- WhitespaceTokeniser::tokenise(str, std::back_inserter(vec));
+ tokenise_whitespace(str, std::back_inserter(vec));
}
}
@@ -238,14 +238,12 @@ Implementation<Configuration>::load_from_etc_profile_env(const FSEntry & root)
opts += kvcfo_ignore_export;
KeyValueConfigFile kvs(etc_profile_env, opts);
- typedef Tokeniser<delim_kind::AnyOfTag> Tokeniser;
- const std::string delims(":");
tr1::function<std::string (const std::string &)> fromfile(
tr1::bind(&KeyValueConfigFile::get, tr1::cref(kvs), _1));
- from_string<Tokeniser>(fromfile, "PATH", search_dirs, delims);
- from_string<Tokeniser>(fromfile, "ROOTPATH", search_dirs, delims);
+ from_colon_string(fromfile, "PATH", search_dirs);
+ from_colon_string(fromfile, "ROOTPATH", search_dirs);
}
else if (etc_profile_env.exists())
Log::get_instance()->message(ll_warning, lc_context, "'" + stringify(etc_profile_env) + "' exists but is not a regular file");
@@ -288,19 +286,19 @@ Implementation<Configuration>::add_defaults()
static const std::string default_ld_so_conf("/lib /usr/lib");
Log::get_instance()->message(ll_debug, lc_context, "Got LD_LIBRARY_MASK=\"" + default_ld_library_mask + "\"");
- WhitespaceTokeniser::tokenise(
+ tokenise_whitespace(
default_ld_library_mask, std::back_inserter(ld_library_mask));
Log::get_instance()->message(ll_debug, lc_context, "Got SEARCH_DIRS=\"" + default_search_dirs + "\"");
- WhitespaceTokeniser::tokenise(
+ tokenise_whitespace(
default_search_dirs, std::back_inserter(search_dirs));
Log::get_instance()->message(ll_debug, lc_context, "Got SEARCH_DIRS_MASK=\"" + default_search_dirs_mask + "\"");
- WhitespaceTokeniser::tokenise(
+ tokenise_whitespace(
default_search_dirs_mask, std::back_inserter(search_dirs_mask));
Log::get_instance()->message(ll_debug, lc_context, "Default ld.so.conf contents is \"" + default_ld_so_conf + "\"");
- WhitespaceTokeniser::tokenise(
+ tokenise_whitespace(
default_ld_so_conf, std::back_inserter(ld_so_conf));
}
diff --git a/src/clients/reconcilio/broken_linkage_finder/libtool_linkage_checker.cc b/src/clients/reconcilio/broken_linkage_finder/libtool_linkage_checker.cc
index 6561525..d5ce47b 100644
--- a/src/clients/reconcilio/broken_linkage_finder/libtool_linkage_checker.cc
+++ b/src/clients/reconcilio/broken_linkage_finder/libtool_linkage_checker.cc
@@ -102,8 +102,7 @@ LibtoolLinkageChecker::check_file(const FSEntry & file)
try
{
KeyValueConfigFile kvs(stream, opts);
- WhitespaceTokeniser::tokenise(
- kvs.get("dependency_libs"), std::back_inserter(deps));
+ tokenise_whitespace(kvs.get("dependency_libs"), std::back_inserter(deps));
}
catch (const ConfigFileError & ex)
{
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index f11f69e..b4a01bc 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -660,7 +660,7 @@ namespace
std::string normalise(const std::string & s)
{
std::list<std::string> w;
- WhitespaceTokeniser::tokenise(s, std::back_inserter(w));
+ tokenise_whitespace(s, std::back_inserter(w));
return join(w.begin(), w.end(), " ");
}
}