Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
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
mantidproject
mantid
Commits
7be32455
Commit
7be32455
authored
14 years ago
by
Sofia Antony
Browse files
Options
Downloads
Patches
Plain Diff
re#2155- fix for build failures
parent
80638cfc
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Mantid/Framework/Kernel/inc/MantidKernel/UserStringParser.h
+4
-5
4 additions, 5 deletions
...ntid/Framework/Kernel/inc/MantidKernel/UserStringParser.h
Code/Mantid/Framework/Kernel/src/UserStringParser.cpp
+12
-12
12 additions, 12 deletions
Code/Mantid/Framework/Kernel/src/UserStringParser.cpp
with
16 additions
and
17 deletions
Code/Mantid/Framework/Kernel/inc/MantidKernel/UserStringParser.h
+
4
−
5
View file @
7be32455
...
...
@@ -5,8 +5,7 @@
// Includes
//----------------------------------------------------------------------
#include
"MantidKernel/DLLExport.h"
#include
"MantidKernel/System.h"
#include
"MantidKernel/DllExport.h"
#include
<boost/tokenizer.hpp>
#include
<boost/shared_ptr.hpp>
...
...
@@ -58,12 +57,12 @@ namespace Kernel
//destructor
~
UserStringParser
();
/// parses a given string into a vector of vector of numbers
std
::
vector
<
std
::
vector
<
unsigned
int
>>
parse
(
const
std
::
string
&
userString
);
std
::
vector
<
std
::
vector
<
unsigned
int
>
>
parse
(
const
std
::
string
&
userString
);
private:
///separate a given string to a vector of comma separated strings
std
::
vector
<
std
::
string
>
separateComma
(
const
std
::
string
&
);
/// separates a given string to vector of vector of numbers using colon as the delimeter
std
::
vector
<
std
::
vector
<
unsigned
int
>>
separateColon
(
const
std
::
string
&
input
);
std
::
vector
<
std
::
vector
<
unsigned
int
>
>
separateColon
(
const
std
::
string
&
input
);
///separate delimiter string from input string and return a vector of numbers created from the separated string
std
::
vector
<
unsigned
int
>
separateDelimiters
(
const
std
::
string
&
input
,
const
std
::
string
&
symbol
);
...
...
@@ -76,7 +75,7 @@ namespace Kernel
void
Tokenize
(
const
std
::
string
&
input
,
const
std
::
string
&
separator
,
unsigned
int
&
start
,
unsigned
int
&
end
,
unsigned
int
&
step
);
/// convert the string into numbers
void
convertToNumbers
(
const
std
::
string
&
userString
,
std
::
vector
<
std
::
vector
<
unsigned
int
>>&
numbers
);
void
convertToNumbers
(
const
std
::
string
&
userString
,
std
::
vector
<
std
::
vector
<
unsigned
int
>
>&
numbers
);
};
...
...
This diff is collapsed.
Click to expand it.
Code/Mantid/Framework/Kernel/src/UserStringParser.cpp
+
12
−
12
View file @
7be32455
...
...
@@ -21,9 +21,9 @@ namespace Mantid
*@param userString - the string to parse
*@returns a vector containing vectors of numbers.
*/
std
::
vector
<
std
::
vector
<
unsigned
int
>>
UserStringParser
::
parse
(
const
std
::
string
&
userString
)
std
::
vector
<
std
::
vector
<
unsigned
int
>
>
UserStringParser
::
parse
(
const
std
::
string
&
userString
)
{
std
::
vector
<
std
::
vector
<
unsigned
int
>>
numbers
;
std
::
vector
<
std
::
vector
<
unsigned
int
>
>
numbers
;
//first separate commas
std
::
vector
<
std
::
string
>
commaseparatedstrings
;
if
(
userString
.
find
(
","
)
!=
std
::
string
::
npos
)
...
...
@@ -54,7 +54,7 @@ namespace Mantid
*@param numbers- a vector containing vectors of numbers.
*/
void
UserStringParser
::
convertToNumbers
(
const
std
::
string
&
userString
,
std
::
vector
<
std
::
vector
<
unsigned
int
>>&
numbers
)
std
::
vector
<
std
::
vector
<
unsigned
int
>
>&
numbers
)
{
//look for separators
...
...
@@ -83,8 +83,8 @@ namespace Mantid
}
else
if
(
Contains
(
userString
,
':'
))
{
std
::
vector
<
std
::
vector
<
unsigned
int
>>
colonseparated
=
separateColon
(
userString
);
std
::
vector
<
std
::
vector
<
unsigned
int
>>::
const_iterator
citr1
;
std
::
vector
<
std
::
vector
<
unsigned
int
>
>
colonseparated
=
separateColon
(
userString
);
std
::
vector
<
std
::
vector
<
unsigned
int
>
>::
const_iterator
citr1
;
for
(
citr1
=
colonseparated
.
begin
();
citr1
!=
colonseparated
.
end
();
++
citr1
)
{
numbers
.
push_back
((
*
citr1
));
...
...
@@ -94,9 +94,9 @@ namespace Mantid
}
/** This method checks input string contains character ch
* @input - the input string
* @
input
- character ch to search
* @return - true if the string contains character ch.
* @
param
input - the input string
* @
param ch
- character ch to search
* @return
s
- true if the string contains character ch.
*/
bool
UserStringParser
::
Contains
(
const
std
::
string
&
input
,
char
ch
)
{
...
...
@@ -111,7 +111,7 @@ namespace Mantid
std
::
vector
<
std
::
string
>
UserStringParser
::
separateComma
(
const
std
::
string
&
input
)
{
typedef
boost
::
tokenizer
<
boost
::
char_separator
<
char
>>
tokenizer
;
typedef
boost
::
tokenizer
<
boost
::
char_separator
<
char
>
>
tokenizer
;
boost
::
char_separator
<
char
>
commasep
(
","
);
std
::
vector
<
std
::
string
>
commaseparatedvalues
;
...
...
@@ -128,12 +128,12 @@ namespace Mantid
*@param input - the string to parse
*@returns a vector of vector containing colon separated tokens.
*/
std
::
vector
<
std
::
vector
<
unsigned
int
>>
UserStringParser
::
separateColon
(
const
std
::
string
&
input
)
std
::
vector
<
std
::
vector
<
unsigned
int
>
>
UserStringParser
::
separateColon
(
const
std
::
string
&
input
)
{
unsigned
int
startNum
=
0
;
unsigned
int
endNum
=
0
;
unsigned
int
step
=
1
;
std
::
vector
<
std
::
vector
<
unsigned
int
>>
separatedValues
;
std
::
vector
<
std
::
vector
<
unsigned
int
>
>
separatedValues
;
Tokenize
(
input
,
":"
,
startNum
,
endNum
,
step
);
for
(
unsigned
int
num
=
startNum
;
num
<=
endNum
;
num
+=
step
)
{
...
...
@@ -177,7 +177,7 @@ namespace Mantid
void
UserStringParser
::
Tokenize
(
const
std
::
string
&
input
,
const
std
::
string
&
delimiter
,
unsigned
int
&
start
,
unsigned
int
&
end
,
unsigned
int
&
step
)
{
typedef
boost
::
tokenizer
<
boost
::
char_separator
<
char
>>
tokenizer
;
typedef
boost
::
tokenizer
<
boost
::
char_separator
<
char
>
>
tokenizer
;
boost
::
char_separator
<
char
>
seps
(
delimiter
.
c_str
());
std
::
vector
<
unsigned
int
>
separatedValues
;
...
...
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