mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
add size_t and a version of rfind that allows specification of where
to scan from. llvm-svn: 82343
This commit is contained in:
parent
f8d05d7ce6
commit
2cdc7b8e76
@ -28,7 +28,8 @@ namespace llvm {
|
|||||||
public:
|
public:
|
||||||
typedef const char *iterator;
|
typedef const char *iterator;
|
||||||
static const size_t npos = ~size_t(0);
|
static const size_t npos = ~size_t(0);
|
||||||
|
typedef size_t size_type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The start of the string, in an external buffer.
|
/// The start of the string, in an external buffer.
|
||||||
const char *Data;
|
const char *Data;
|
||||||
@ -176,14 +177,19 @@ namespace llvm {
|
|||||||
///
|
///
|
||||||
/// \return - The index of the last occurence of \arg C, or npos if not
|
/// \return - The index of the last occurence of \arg C, or npos if not
|
||||||
/// found.
|
/// found.
|
||||||
size_t rfind(char C) const {
|
size_t rfind(char C, size_t From) const {
|
||||||
for (size_t i = Length, e = 0; i != e;) {
|
for (size_t i = From, e = 0; i != e;) {
|
||||||
--i;
|
--i;
|
||||||
if (Data[i] == C)
|
if (Data[i] == C)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t rfind(char C) const {
|
||||||
|
return rfind(C, Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// rfind - Search for the last string \arg Str in the string.
|
/// rfind - Search for the last string \arg Str in the string.
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user