Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
adf41255
Commit
adf41255
authored
Feb 06, 2015
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace boost_regex by std::regex !
parent
d12298e1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
25 deletions
+22
-25
CMakeLists.txt
CMakeLists.txt
+0
-3
include/Utils/shaderMutator.h
include/Utils/shaderMutator.h
+0
-1
src/Utils/shaderMutator.cpp
src/Utils/shaderMutator.cpp
+22
-21
No files found.
CMakeLists.txt
View file @
adf41255
...
...
@@ -89,7 +89,6 @@ IF(WIN32)
ENDIF
(
WIN32
)
find_package
(
OpenGL REQUIRED
)
find_package
(
Boost COMPONENTS regex REQUIRED
)
find_package
(
ZLIB REQUIRED
)
find_package
(
GLEW REQUIRED
)
...
...
@@ -130,7 +129,6 @@ SET (CGoGN_EXT_INCLUDES
${
OPENGL_INCLUDE_DIR
}
${
GLEW_INCLUDE_DIRS
}
${
ZLIB_INCLUDE_DIRS
}
${
Boost_INCLUDE_DIRS
}
)
# define libs for external libs
...
...
@@ -139,7 +137,6 @@ SET (CGoGN_EXT_LIBS
${
OPENGL_LIBRARY
}
${
GLEW_LIBRARIES
}
${
ZLIB_LIBRARIES
}
${
Boost_REGEX_LIBRARY
}
tinyxml2
)
...
...
include/Utils/shaderMutator.h
View file @
adf41255
...
...
@@ -29,7 +29,6 @@
#undef toupper
#include "Utils/cgognStream.h"
#include <boost/regex.hpp>
#include <string>
#include <sstream>
...
...
src/Utils/shaderMutator.cpp
View file @
adf41255
...
...
@@ -23,6 +23,7 @@
*******************************************************************************/
#include "Utils/shaderMutator.h"
#include <regex>
namespace
CGoGN
{
...
...
@@ -451,15 +452,15 @@ bool ShaderMutator::srcContainsVariableDeclaration(const std::string& variableNa
{
// Regular expression for variable declaration
// <',' OR white-space[1 or more times]> <variableName> <',' OR ';' OR white-space>
boost
::
regex
var_re
(
"(,|
\\
s+)"
+
variableName
+
"(,|;|
\\
s)"
);
std
::
regex
var_re
(
"(,|
\\
s+)"
+
variableName
+
"(,|;|
\\
s)"
);
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
src
.
begin
();
std
::
string
::
iterator
end
=
src
.
end
();
while
(
regex_search
(
start
,
end
,
matches
,
var_re
,
boost
::
format_first_only
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
var_re
,
std
::
regex_constants
::
format_first_only
))
{
// Start position of the match
size_t
startPosition
=
std
::
distance
(
src
.
begin
(),
matches
[
0
].
first
);
...
...
@@ -480,10 +481,10 @@ bool ShaderMutator::srcSetMinShadingLanguageVersion(int version, std::string& mo
{
// Regular expression for shading language version
// <#version> <white-space>[1 or more times] <digit>[1 or more times]
boost
::
regex
version_re
(
"#version
\\
s+(
\\
d+)"
);
std
::
regex
version_re
(
"#version
\\
s+(
\\
d+)"
);
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Build the version string
std
::
string
versionStr
;
...
...
@@ -494,7 +495,7 @@ bool ShaderMutator::srcSetMinShadingLanguageVersion(int version, std::string& mo
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
while
(
regex_search
(
start
,
end
,
matches
,
version_re
,
boost
::
format_first_only
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
version_re
,
std
::
regex_constants
::
format_first_only
))
{
// Start position of the match
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
...
...
@@ -535,10 +536,10 @@ bool ShaderMutator::srcChangeIntConstantValue(int newVal, const std::string& con
{
// Regular expression for constant expression
// <#define> <white-space>[1 or more times] <constant name> <white-space>[1 or more times] <digit>[1 or more times]
boost
::
regex
const_re
(
"#define
\\
s+"
+
constantName
+
"
\\
s+(
\\
d+)"
);
std
::
regex
const_re
(
"#define
\\
s+"
+
constantName
+
"
\\
s+(
\\
d+)"
);
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Build the constant value string
std
::
string
newValStr
;
...
...
@@ -549,7 +550,7 @@ bool ShaderMutator::srcChangeIntConstantValue(int newVal, const std::string& con
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
while
(
regex_search
(
start
,
end
,
matches
,
const_re
,
boost
::
format_first_only
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
const_re
,
std
::
regex_constants
::
format_first_only
))
{
// Start position of the match
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
...
...
@@ -582,10 +583,10 @@ bool ShaderMutator::srcChangeFloatConstantValue(float newVal, const std::string&
// Regular expression for constant expression
// <#define> <white-space>[1 or more times] <constant name> <white-space>[1 or more times]
// <digit>[1 or more times] <.>[0 or 1 time] <digit>[0 or more times]
boost
::
regex
const_re
(
"#define
\\
s+"
+
constantName
+
"
\\
s+(
\\
d+
\\
.?
\\
d*)"
);
std
::
regex
const_re
(
"#define
\\
s+"
+
constantName
+
"
\\
s+(
\\
d+
\\
.?
\\
d*)"
);
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Build the constant value string
std
::
string
newValStr
;
...
...
@@ -596,7 +597,7 @@ bool ShaderMutator::srcChangeFloatConstantValue(float newVal, const std::string&
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
while
(
regex_search
(
start
,
end
,
matches
,
const_re
,
boost
::
format_first_only
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
const_re
,
std
::
regex_constants
::
format_first_only
))
{
// Start position of the match
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
...
...
@@ -628,15 +629,15 @@ bool ShaderMutator::srcInsertCodeBeforeMainFunction(const std::string& insertedC
{
// Regular expression for main function
// <void> <white-space>[1 or more times] <main> <white-space>[0 or more times] <'('>
boost
::
regex
main_re
(
"(void)
\\
s+(main)
\\
s*
\\
("
);
std
::
regex
main_re
(
"(void)
\\
s+(main)
\\
s*
\\
("
);
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
while
(
regex_search
(
start
,
end
,
matches
,
main_re
,
boost
::
format_first_only
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
main_re
,
std
::
regex_constants
::
format_first_only
))
{
// Start position of the match
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
...
...
@@ -664,15 +665,15 @@ bool ShaderMutator::srcInsertCodeAtMainFunctionBeginning(const std::string& inse
// <void> <white-space>[1 or more times] <main> <white-space>[0 or more times]
// <'('> <white-space>[0 or more times] <')'>
// <white-space>[0 or more times] <'{'>
boost
::
regex
main_re
(
"(void)
\\
s+(main)
\\
s*
\\
(
\\
s*
\\
)
\\
s*
\\
{"
);
std
::
regex
main_re
(
"(void)
\\
s+(main)
\\
s*
\\
(
\\
s*
\\
)
\\
s*
\\
{"
);
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
while
(
regex_search
(
start
,
end
,
matches
,
main_re
,
boost
::
format_first_only
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
main_re
,
std
::
regex_constants
::
format_first_only
))
{
// Start position of the match
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
...
...
@@ -703,16 +704,16 @@ bool ShaderMutator::srcInsertCodeAtMainFunctionEnd(const std::string& insertedCo
// <void> <white-space>[1 or more times] <main> <white-space>[0 or more times]
// <'('> <white-space>[0 or more times] <')'>
// <white-space>[0 or more times] <'{'>
boost
::
regex
main_re
(
"(void)
\\
s+(main)
\\
s*
\\
(
\\
s*
\\
)
\\
s*
\\
{"
);
std
::
regex
main_re
(
"(void)
\\
s+(main)
\\
s*
\\
(
\\
s*
\\
)
\\
s*
\\
{"
);
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
size_t
mainFirstBracePos
=
0
;
// The aim is first to find this position
while
(
regex_search
(
start
,
end
,
matches
,
main_re
,
boost
::
format_first_only
)
&&
(
mainFirstBracePos
==
0
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
main_re
,
std
::
regex_constants
::
format_first_only
)
&&
(
mainFirstBracePos
==
0
))
{
// Start position of the match
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment