Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
cf3b1cf5
Commit
cf3b1cf5
authored
Aug 02, 2015
by
François Cartegnie
🤞
Browse files
demux: adaptative: add tokenizer helper
parent
20375e97
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/demux/adaptative/tools/Helper.cpp
View file @
cf3b1cf5
...
...
@@ -60,3 +60,19 @@ bool Helper::ifind(std::string haystack, std::string needle)
transform
(
needle
.
begin
(),
needle
.
end
(),
needle
.
begin
(),
toupper
);
return
haystack
.
find
(
needle
)
!=
std
::
string
::
npos
;
}
std
::
list
<
std
::
string
>
Helper
::
tokenize
(
const
std
::
string
&
str
,
char
c
)
{
std
::
list
<
std
::
string
>
ret
;
std
::
size_t
prev
=
0
;
std
::
size_t
cur
=
str
.
find_first_of
(
c
,
0
);
while
(
cur
!=
std
::
string
::
npos
)
{
ret
.
push_back
(
str
.
substr
(
prev
,
cur
-
prev
));
prev
=
cur
+
1
;
cur
=
str
.
find_first_of
(
c
,
cur
+
1
);
}
ret
.
push_back
(
str
.
substr
(
prev
));
return
ret
;
}
modules/demux/adaptative/tools/Helper.h
View file @
cf3b1cf5
...
...
@@ -26,6 +26,7 @@
#define HELPER_H_
#include
<string>
#include
<list>
namespace
adaptative
{
...
...
@@ -35,6 +36,7 @@ namespace adaptative
static
std
::
string
combinePaths
(
const
std
::
string
&
path1
,
const
std
::
string
&
path2
);
static
std
::
string
getDirectoryPath
(
const
std
::
string
&
path
);
static
bool
ifind
(
std
::
string
haystack
,
std
::
string
needle
);
static
std
::
list
<
std
::
string
>
tokenize
(
const
std
::
string
&
,
char
);
};
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment