- Relocated legacy checks from Config.cpp to legacy.cpp.
This commit is contained in:
Paul Beckingham 2011-10-02 18:05:20 -04:00
parent d62ea4e223
commit 6e21cc5b2a
5 changed files with 73 additions and 71 deletions

View file

@ -27,6 +27,7 @@
#define L10N // Localization complete.
#include <sstream>
#include <Context.h>
#include <text.h>
#include <i18n.h>
@ -102,3 +103,69 @@ void legacySortColumnMap (std::string& name)
}
////////////////////////////////////////////////////////////////////////////////
std::string legacyCheckForDeprecatedColor ()
{
std::vector <std::string> deprecated;
std::map <std::string, std::string>::const_iterator it;
for (it = context.config.begin (); it != context.config.end (); ++it)
{
if (it->first.find ("color.") != std::string::npos)
{
std::string value = context.config.get (it->first);
if (value.find ("_") != std::string::npos)
deprecated.push_back (it->first);
}
}
std::stringstream out;
if (deprecated.size ())
{
out << STRING_CONFIG_DEPRECATED_US
<< "\n";
std::vector <std::string>::iterator it2;
for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2)
out << " " << *it2 << "=" << context.config.get (*it2) << "\n";
out << "\n";
}
return out.str ();
}
////////////////////////////////////////////////////////////////////////////////
std::string legacyCheckForDeprecatedColumns ()
{
std::vector <std::string> deprecated;
std::map <std::string, std::string>::const_iterator it;
for (it = context.config.begin (); it != context.config.end (); ++it)
{
if (it->first.find ("report") == 0)
{
std::string value = context.config.get (it->first);
if (value.find ("entry_time") != std::string::npos ||
value.find ("start_time") != std::string::npos ||
value.find ("end_time") != std::string::npos)
deprecated.push_back (it->first);
}
}
std::stringstream out;
out << "\n";
if (deprecated.size ())
{
out << STRING_CONFIG_DEPRECATED_COL
<< "\n";
std::vector <std::string>::iterator it2;
for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2)
out << " " << *it2 << "=" << context.config.get (*it2) << "\n";
out << "\n";
}
return out.str ();
}
////////////////////////////////////////////////////////////////////////////////