Fix tabs.

This commit is contained in:
Arthur Britto
2012-04-05 23:15:34 -07:00
parent af800ffe14
commit c43917edd1

View File

@@ -29,27 +29,27 @@ section ParseSection(const std::string strInput, const bool bTrim)
// Parse each line. // Parse each line.
BOOST_FOREACH(std::string& strValue, vLines) BOOST_FOREACH(std::string& strValue, vLines)
{ {
if (strValue.empty() || strValue[0] == '#') if (strValue.empty() || strValue[0] == '#')
{ {
// Blank line or comment, do nothing. // Blank line or comment, do nothing.
} }
else if (strValue[0] == '[' && strValue[strValue.length()-1] == ']') { else if (strValue[0] == '[' && strValue[strValue.length()-1] == ']') {
// New section. // New section.
strSection = strValue.substr(1, strValue.length()-2); strSection = strValue.substr(1, strValue.length()-2);
secResult[strSection] = section::mapped_type(); secResult[strSection] = section::mapped_type();
} }
else else
{ {
// Another line in a section. // Another line in a section.
if (bTrim) if (bTrim)
{ {
boost::algorithm::trim_right_if(strValue, boost::algorithm::is_space()); boost::algorithm::trim_right_if(strValue, boost::algorithm::is_space());
boost::algorithm::trim_left_if(strValue, boost::algorithm::is_space()); boost::algorithm::trim_left_if(strValue, boost::algorithm::is_space());
} }
secResult[strSection].push_back(strValue); secResult[strSection].push_back(strValue);
} }
} }
return secResult; return secResult;
@@ -60,11 +60,11 @@ void PrintSection(section secInput)
std::cerr << "PrintSection>" << std::endl; std::cerr << "PrintSection>" << std::endl;
BOOST_FOREACH(section::value_type& pairSection, secInput) BOOST_FOREACH(section::value_type& pairSection, secInput)
{ {
std::cerr << "[" << pairSection.first << "]" << std::endl; std::cerr << "[" << pairSection.first << "]" << std::endl;
BOOST_FOREACH(std::string& value, pairSection.second) BOOST_FOREACH(std::string& value, pairSection.second)
{ {
std::cerr << value << std::endl; std::cerr << value << std::endl;
} }
} }
std::cerr << "PrintSection<" << std::endl; std::cerr << "PrintSection<" << std::endl;
} }
@@ -109,5 +109,4 @@ bool sectionSingleB(section& secSource, std::string strSection, std::string& str
return bSingle; return bSingle;
} }
// vim:ts=4 // vim:ts=4