Browse Source

Some optimizations

Forgot to update copyright year in previous commit.
release/0.19
JustinAJ 9 years ago
parent
commit
6cc2a14859
  1. 4
      Jupiter/ArrayList.h
  2. 2
      Jupiter/IRC.h
  3. 53
      Jupiter/Readable_String_Imp.h
  4. BIN
      Release/Jupiter.lib

4
Jupiter/ArrayList.h

@ -182,8 +182,8 @@ template<typename T> void Jupiter::ArrayList<T>::empty()
template<typename T> void Jupiter::ArrayList<T>::emptyAndDelete()
{
for (size_t i = 0; i < Jupiter::List<T>::length; i++) delete Jupiter::ArrayList<T>::data[i];
Jupiter::List<T>::length = 0;
while (Jupiter::List<T>::length != 0)
delete Jupiter::ArrayList<T>::data[--Jupiter::List<T>::length];
}
template<> struct _Jupiter_DataBuffer_partial_specialization_impl<Jupiter::ArrayList>

2
Jupiter/IRC.h

@ -1,5 +1,5 @@
/**
* Copyright (C) 2013-2014 Justin James.
* Copyright (C) 2013-2015 Justin James.
*
* This license must be preserved.
* Any applications, libraries, or code which make any use of any

53
Jupiter/Readable_String_Imp.h

@ -1117,27 +1117,48 @@ template<typename T> template<template<typename> class R> R<T> Jupiter::Readable
template<typename T> template<template<typename> class R> R<T> Jupiter::Readable_String<T>::getWord(const T *in, size_t pos, const T *whitespace)
{
unsigned int x = 0;
unsigned int y = 1;
for (unsigned int i = 0; i < pos || y == 1; x++)
{
if (in[x] == 0) return R<T>();
if (Jupiter::strpbrk<T>(whitespace, in[x]) != nullptr)
{
if (y != 1)
if (*in == 0)
return R<T>();
while (Jupiter::strpbrk<T>(whitespace, *in) != nullptr)
if (*++in == 0)
return R<T>();
if (pos == 0)
{
y = 1;
i++;
}
do
++in, ++pos;
while (*in != 0 && Jupiter::strpbrk<T>(whitespace, *in) == nullptr);
in -= pos;
return R<T>::substring(in, 0, pos);
}
else
loop_start:
{
if (i >= pos) break;
y = 0;
if (Jupiter::strpbrk<T>(whitespace, *in) != nullptr)
{
do
if (*++in == 0)
return R<T>();
while (Jupiter::strpbrk<T>(whitespace, *in) != nullptr);
if (--pos == 0)
goto loop_end;
}
if (++in == 0)
return R<T>();
goto loop_start;
}
for (y = x; in[y] != 0 && Jupiter::strpbrk<T>(whitespace, in[y]) == nullptr; y++);
return R<T>::substring(in, x, y - x);
loop_end:
do
++in, ++pos;
while (*in != 0 && Jupiter::strpbrk<T>(whitespace, *in) == nullptr);
in -= pos;
return R<T>::substring(in, 0, pos);
}
// getToken

BIN
Release/Jupiter.lib

Binary file not shown.
Loading…
Cancel
Save