Browse Source

restore boost::regex

merge-requests/365/head
Vadim 10 years ago
parent
commit
8ee7865924
  1. 20
      src/cmake.cc

20
src/cmake.cc

@ -3,7 +3,7 @@
#include "filesystem.h" #include "filesystem.h"
#include "dialogs.h" #include "dialogs.h"
#include <regex> #include <boost/regex.hpp>
#include <iostream> //TODO: remove #include <iostream> //TODO: remove
using namespace std; //TODO: remove using namespace std; //TODO: remove
@ -11,9 +11,9 @@ using namespace std; //TODO: remove
CMake::CMake(const boost::filesystem::path &path) { CMake::CMake(const boost::filesystem::path &path) {
const auto find_cmake_project=[this](const boost::filesystem::path &cmake_path) { const auto find_cmake_project=[this](const boost::filesystem::path &cmake_path) {
for(auto &line: filesystem::read_lines(cmake_path)) { for(auto &line: filesystem::read_lines(cmake_path)) {
const std::regex project_regex("^ *project *\\(.*$"); const boost::regex project_regex("^ *project *\\(.*$");
std::smatch sm; boost::smatch sm;
if(std::regex_match(line, sm, project_regex)) { if(boost::regex_match(line, sm, project_regex)) {
return true; return true;
} }
} }
@ -143,9 +143,9 @@ void CMake::find_variables() {
end_line=file.size(); end_line=file.size();
if(end_line>start_line) { if(end_line>start_line) {
auto line=file.substr(start_line, end_line-start_line); auto line=file.substr(start_line, end_line-start_line);
const std::regex set_regex("^ *set *\\( *([A-Za-z_][A-Za-z_0-9]*) +(.*)\\) *$"); const boost::regex set_regex("^ *set *\\( *([A-Za-z_][A-Za-z_0-9]*) +(.*)\\) *$");
std::smatch sm; boost::smatch sm;
if(std::regex_match(line, sm, set_regex)) { if(boost::regex_match(line, sm, set_regex)) {
auto data=sm[2].str(); auto data=sm[2].str();
while(data.size()>0 && data.back()==' ') while(data.size()>0 && data.back()==' ')
data.pop_back(); data.pop_back();
@ -265,9 +265,9 @@ std::vector<std::pair<boost::filesystem::path, std::vector<std::string> > > CMak
end_line=file.size(); end_line=file.size();
if(end_line>start_line) { if(end_line>start_line) {
auto line=file.substr(start_line, end_line-start_line); auto line=file.substr(start_line, end_line-start_line);
const std::regex function_regex("^ *"+name+" *\\( *(.*)\\) *$"); const boost::regex function_regex("^ *"+name+" *\\( *(.*)\\) *$");
std::smatch sm; boost::smatch sm;
if(std::regex_match(line, sm, function_regex)) { if(boost::regex_match(line, sm, function_regex)) {
auto data=sm[1].str(); auto data=sm[1].str();
while(data.size()>0 && data.back()==' ') while(data.size()>0 && data.back()==' ')
data.pop_back(); data.pop_back();

Loading…
Cancel
Save