Added ability for ifNextInclude and changed data type on isCaracter to ZString.
This commit is contained in:
parent
3eb1f5954a
commit
f1337c682a
14
ZString.cpp
14
ZString.cpp
@ -268,15 +268,21 @@ namespace coreutils {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZString::isCharacter(char ch, const char *string) {
|
bool ZString::isCharacter(char ch, ZString include) {
|
||||||
int len = strlen(string);
|
for (int ix = 0; ix < include.getLength(); ++ix) {
|
||||||
for (int ix = 0; ix < len; ++ix) {
|
if (ch == include.charAt(ix))
|
||||||
if (ch == string[ix])
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ZString::ifNextInclude(ZString include) {
|
||||||
|
if((cursor <= (data + length)) && isCharacter(*cursor, include))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ZString ZString::getTokenInclude(const char *include) {
|
ZString ZString::getTokenInclude(const char *include) {
|
||||||
char *start = cursor;
|
char *start = cursor;
|
||||||
while ((cursor <= (data + length)) && isCharacter(*cursor, include))
|
while ((cursor <= (data + length)) && isCharacter(*cursor, include))
|
||||||
|
@ -201,6 +201,13 @@ namespace coreutils {
|
|||||||
///
|
///
|
||||||
|
|
||||||
std::vector<ZString> &split(std::string delimiter, size_t maxSize = 0);
|
std::vector<ZString> &split(std::string delimiter, size_t maxSize = 0);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// If ZString cursor is currently pointing to a character in the include
|
||||||
|
/// string then return true.
|
||||||
|
///
|
||||||
|
|
||||||
|
bool ifNextInclude(ZString include);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Use getTokenInclude with a list of character to allow the forwarding
|
/// Use getTokenInclude with a list of character to allow the forwarding
|
||||||
@ -426,7 +433,7 @@ namespace coreutils {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::stack<char *> stack;
|
std::stack<char *> stack;
|
||||||
bool isCharacter(char ch, const char *string);
|
bool isCharacter(char ch, ZString include);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user