Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitri Naumov
ogs
Commits
f030650a
Commit
f030650a
authored
9 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[BL] Use boost for case insensitive comparison.
parent
011bb250
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
BaseLib/FileTools.cpp
+2
-4
2 additions, 4 deletions
BaseLib/FileTools.cpp
BaseLib/FileTools.h
+1
-2
1 addition, 2 deletions
BaseLib/FileTools.h
BaseLib/StringTools.cpp
+0
-7
0 additions, 7 deletions
BaseLib/StringTools.cpp
BaseLib/StringTools.h
+0
-8
0 additions, 8 deletions
BaseLib/StringTools.h
with
3 additions
and
21 deletions
BaseLib/FileTools.cpp
+
2
−
4
View file @
f030650a
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include
<sys/stat.h>
#include
<sys/stat.h>
#include
<boost/filesystem.hpp>
#include
<boost/filesystem.hpp>
#include
<boost/algorithm/string.hpp>
namespace
BaseLib
namespace
BaseLib
{
{
...
@@ -116,10 +117,7 @@ std::string getFileExtension(const std::string &path)
...
@@ -116,10 +117,7 @@ std::string getFileExtension(const std::string &path)
bool
hasFileExtension
(
std
::
string
const
&
extension
,
std
::
string
const
&
filename
)
bool
hasFileExtension
(
std
::
string
const
&
extension
,
std
::
string
const
&
filename
)
{
{
std
::
string
ext
=
stringToUpper
(
extension
);
// Copy for modification.
return
boost
::
iequals
(
extension
,
getFileExtension
(
filename
));
std
::
string
file_ext
=
stringToUpper
(
getFileExtension
(
filename
));
return
ext
==
file_ext
;
}
}
std
::
string
copyPathToFileName
(
const
std
::
string
&
file_name
,
std
::
string
copyPathToFileName
(
const
std
::
string
&
file_name
,
...
...
This diff is collapsed.
Click to expand it.
BaseLib/FileTools.h
+
1
−
2
View file @
f030650a
...
@@ -129,8 +129,7 @@ std::string getFileExtension(std::string const& filename);
...
@@ -129,8 +129,7 @@ std::string getFileExtension(std::string const& filename);
/**
/**
* Compares filename's extension with query extension. The comparison is case
* Compares filename's extension with query extension. The comparison is case
* insensitive done by converting to upper case with the std::toupper()
* insensitive.
* function.
*/
*/
bool
hasFileExtension
(
std
::
string
const
&
extension
,
bool
hasFileExtension
(
std
::
string
const
&
extension
,
std
::
string
const
&
filename
);
std
::
string
const
&
filename
);
...
...
This diff is collapsed.
Click to expand it.
BaseLib/StringTools.cpp
+
0
−
7
View file @
f030650a
...
@@ -72,13 +72,6 @@ void simplify(std::string &str)
...
@@ -72,13 +72,6 @@ void simplify(std::string &str)
);
);
}
}
std
::
string
stringToUpper
(
std
::
string
const
&
str
)
{
std
::
string
s
=
str
;
std
::
transform
(
s
.
begin
(),
s
.
end
(),
s
.
begin
(),
(
int
(
*
)(
int
))
std
::
toupper
);
return
s
;
}
std
::
string
padLeft
(
std
::
string
const
&
str
,
int
maxlen
,
char
ch
)
std
::
string
padLeft
(
std
::
string
const
&
str
,
int
maxlen
,
char
ch
)
{
{
std
::
stringstream
ss
(
str
);
std
::
stringstream
ss
(
str
);
...
...
This diff is collapsed.
Click to expand it.
BaseLib/StringTools.h
+
0
−
8
View file @
f030650a
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
#include
<sstream>
#include
<sstream>
#include
<fstream>
#include
<fstream>
#include
<iostream>
#include
<iostream>
#include
<ctype.h>
namespace
BaseLib
{
namespace
BaseLib
{
...
@@ -69,13 +68,6 @@ void trim(std::string &str, char ch=' ');
...
@@ -69,13 +68,6 @@ void trim(std::string &str, char ch=' ');
*/
*/
void
simplify
(
std
::
string
&
str
);
void
simplify
(
std
::
string
&
str
);
/**
* Returns same string with all characters in upper case.
*
* This uses std::toupper() function, and does not care about unicode.
*/
std
::
string
stringToUpper
(
std
::
string
const
&
str
);
/**
/**
* Returns the string which is right aligned with padding on the left.
* Returns the string which is right aligned with padding on the left.
*/
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment