Browse Source

Added getToken() to TokenizeResult.

release/0.19
JustinAJ 9 years ago
parent
commit
99af85f626
  1. 8
      Jupiter/Readable_String.h
  2. 7
      Jupiter/Readable_String_Imp.h
  3. BIN
      Release/Jupiter.lib

8
Jupiter/Readable_String.h

@ -329,6 +329,14 @@ namespace Jupiter
/** Length of 'tokens' array */ /** Length of 'tokens' array */
size_t token_count; size_t token_count;
/**
* @brief A safe accessor method, for fetching tokens.
*
* @param index Index of token to fetch
* @return The token at the specified index if it exists, an empty string otherwise.
*/
const R<T> &getToken(size_t index) const;
/** /**
* @brief Default constructor for the TokenizeResult class. * @brief Default constructor for the TokenizeResult class.
* Note: 'tokens' assigned nullptr, and 'token_count' is assigned 0. * Note: 'tokens' assigned nullptr, and 'token_count' is assigned 0.

7
Jupiter/Readable_String_Imp.h

@ -1346,6 +1346,13 @@ template<typename T> template<template<typename> class R> Jupiter::Readable_Stri
delete[] Jupiter::Readable_String<T>::TokenizeResult<R>::tokens; delete[] Jupiter::Readable_String<T>::TokenizeResult<R>::tokens;
} }
template<typename T> template<template<typename> class R> const R<T> &Jupiter::Readable_String<T>::TokenizeResult<R>::getToken(size_t index) const
{
if (index < Jupiter::Readable_String<T>::TokenizeResult<R>::token_count)
return Jupiter::Readable_String<T>::TokenizeResult<R>::tokens[index];
return R<T>::empty;
}
// tokenize // tokenize
template<typename T> template<template<typename> class R> typename Jupiter::Readable_String<T>::TokenizeResult<R> Jupiter::Readable_String<T>::tokenize(const Jupiter::Readable_String<T> &in, const T &token) template<typename T> template<template<typename> class R> typename Jupiter::Readable_String<T>::TokenizeResult<R> Jupiter::Readable_String<T>::tokenize(const Jupiter::Readable_String<T> &in, const T &token)

BIN
Release/Jupiter.lib

Binary file not shown.
Loading…
Cancel
Save