Author: dmacvicar Date: Fri Aug 10 16:08:35 2007 New Revision: 6596 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6596&view=rev Log: zypp uses 2 space indentation Modified: trunk/libzypp/zypp/base/Regex.cc trunk/libzypp/zypp/base/Regex.h Modified: trunk/libzypp/zypp/base/Regex.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/Regex.cc?rev=6596&r1=6595&r2=6596&view=diff ============================================================================== --- trunk/libzypp/zypp/base/Regex.cc (original) +++ trunk/libzypp/zypp/base/Regex.cc Fri Aug 10 16:08:35 2007 @@ -20,59 +20,59 @@ regex::regex(const std::string& str, int flags) { - m_valid = true; - if (regcomp(&m_preg, str.c_str(), REG_EXTENDED | flags)) - m_valid = false; + m_valid = true; + if (regcomp(&m_preg, str.c_str(), REG_EXTENDED | flags)) + m_valid = false; } regex::~regex() throw() { - if (m_valid) - regfree(&m_preg); + if (m_valid) + regfree(&m_preg); } bool zypp::str::regex_match(const std::string& s, smatch& matches, const regex& regex) { - bool r = regex.m_valid && !regexec(®ex.m_preg, s.c_str(), 12, &matches.pmatch[0], 0); - if (r) - matches.match_str = s; - return r; + bool r = regex.m_valid && !regexec(®ex.m_preg, s.c_str(), 12, &matches.pmatch[0], 0); + if (r) + matches.match_str = s; + return r; } bool zypp::str::regex_match(const std::string& s, const regex& regex) { - return !regexec(®ex.m_preg, s.c_str(), 0, NULL, 0); + return !regexec(®ex.m_preg, s.c_str(), 0, NULL, 0); } bool zypp::str::regex_search(const std::string& s, smatch& matches, const regex& regex) { - bool r= regex.m_valid && !regexec(®ex.m_preg, s.c_str(), 12, &matches.pmatch[0], 0); - if (r) - matches.match_str = s; - return r; + bool r= regex.m_valid && !regexec(®ex.m_preg, s.c_str(), 12, &matches.pmatch[0], 0); + if (r) + matches.match_str = s; + return r; } smatch::smatch() { - memset(&pmatch, -1, sizeof(pmatch)); + memset(&pmatch, -1, sizeof(pmatch)); } std::string smatch::operator[](unsigned i) const { - if (i < 12 && pmatch[i].rm_so != -1) - return match_str.substr(pmatch[i].rm_so, pmatch[i].rm_eo-pmatch[i].rm_so); - return std::string(); + if (i < 12 && pmatch[i].rm_so != -1) + return match_str.substr(pmatch[i].rm_so, pmatch[i].rm_eo-pmatch[i].rm_so); + return std::string(); } unsigned smatch::size() const { - unsigned matches = 0; - while (matches < 12 && pmatch[matches+1].rm_so != -1) { + unsigned matches = 0; + while (matches < 12 && pmatch[matches+1].rm_so != -1) { // std::cout << "match[" << matches << "]: *" << (*this)[matches // +1] << "*" << std::endl; - matches++; - } + matches++; + } - return matches; + return matches; } Modified: trunk/libzypp/zypp/base/Regex.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/Regex.h?rev=6596&r1=6595&r2=6596&view=diff ============================================================================== --- trunk/libzypp/zypp/base/Regex.h (original) +++ trunk/libzypp/zypp/base/Regex.h Fri Aug 10 16:08:35 2007 @@ -30,34 +30,33 @@ class regex { public: - enum RegFlags { - optimize = 0, - match_extra = 0, - icase = REG_ICASE, - nosubs = REG_NOSUB, - match_extended = REG_EXTENDED - }; - - regex(const std::string& s,int flags = match_extended); - ~regex() throw(); + enum RegFlags { + optimize = 0, + match_extra = 0, + icase = REG_ICASE, + nosubs = REG_NOSUB, + match_extended = REG_EXTENDED + }; + regex(const std::string& s,int flags = match_extended); + ~regex() throw(); public: - regex_t m_preg; - bool m_valid; + regex_t m_preg; + bool m_valid; }; class smatch { public: - smatch(); + smatch(); - std::string operator[](unsigned i) const; + std::string operator[](unsigned i) const; - unsigned size() const; + unsigned size() const; - std::string match_str; - regmatch_t pmatch[12]; + std::string match_str; + regmatch_t pmatch[12]; }; bool regex_match(const std::string& s, str::smatch& matches, const regex& regex); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org