Browse Source

use std::rgex instead boost::regex

merge-requests/365/head
Vadim 10 years ago
parent
commit
6dd5bf8bde
  1. 23
      src/cmake.cc

23
src/cmake.cc

@ -1,18 +1,19 @@
#include "cmake.h" #include "cmake.h"
#include "singletons.h" #include "singletons.h"
#include "filesystem.h" #include "filesystem.h"
#include <boost/regex.hpp>
#include "dialogs.h" #include "dialogs.h"
#include <regex>
#include <iostream> //TODO: remove #include <iostream> //TODO: remove
using namespace std; //TODO: remove 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 boost::regex project_regex("^ *project *\\(.*$"); const std::regex project_regex("^ *project *\\(.*$");
boost::smatch sm; std::smatch sm;
if(boost::regex_match(line, sm, project_regex)) { if(std::regex_match(line, sm, project_regex)) {
return true; return true;
} }
} }
@ -142,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 boost::regex set_regex("^ *set *\\( *([A-Za-z_][A-Za-z_0-9]*) +(.*)\\) *$"); const std::regex set_regex("^ *set *\\( *([A-Za-z_][A-Za-z_0-9]*) +(.*)\\) *$");
boost::smatch sm; std::smatch sm;
if(boost::regex_match(line, sm, set_regex)) { if(std::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();
@ -264,10 +265,10 @@ 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 boost::regex function_regex("^ *"+name+" *\\( *(.*)\\) *$"); const std::regex function_regex("^ *"+name+" *\\( *(.*)\\) *$");
boost::smatch sm; std::smatch sm;
if(boost::regex_match(line, sm, function_regex)) { if(std::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();
auto parameters=get_function_parameters(data); auto parameters=get_function_parameters(data);

Loading…
Cancel
Save