Browse Source

core: rename Array::Append() to Array::Push() for brevity and arbitrary

personal taste.
legacy
Sam Hocevar sam 12 years ago
parent
commit
0315413285
3 changed files with 29 additions and 29 deletions
  1. +12
    -12
      src/array.h
  2. +8
    -8
      test/tutorial/02_cube.cpp
  3. +9
    -9
      test/unit/array.cpp

+ 12
- 12
src/array.h View File

@@ -80,7 +80,7 @@ public:
return *this;
}

inline void Append(T const &x)
inline void Push(T const &x)
{
*this << x;
}
@@ -187,8 +187,8 @@ template<typename T1, typename T2 = void, typename T3 = void,
class Array : public ArrayBase<ArrayElement<T1, T2, T3, T4, T5, T6, T7, T8> >
{
public:
inline void Append(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4,
T5 const &m5, T6 const &m6, T7 const &m7, T8 const &m8)
inline void Push(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4,
T5 const &m5, T6 const &m6, T7 const &m7, T8 const &m8)
{
if (this->m_count >= this->m_reserved)
{
@@ -225,8 +225,8 @@ class Array<T1, T2, T3, T4, T5, T6, T7, void>
: public ArrayBase<ArrayElement<T1, T2, T3, T4, T5, T6, T7, void> >
{
public:
inline void Append(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4,
T5 const &m5, T6 const &m6, T7 const &m7)
inline void Push(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4,
T5 const &m5, T6 const &m6, T7 const &m7)
{
if (this->m_count >= this->m_reserved)
{
@@ -261,8 +261,8 @@ class Array<T1, T2, T3, T4, T5, T6, void, void>
: public ArrayBase<ArrayElement<T1, T2, T3, T4, T5, T6, void, void> >
{
public:
inline void Append(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4,
T5 const &m5, T6 const &m6)
inline void Push(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4,
T5 const &m5, T6 const &m6)
{
if (this->m_count >= this->m_reserved)
{
@@ -294,8 +294,8 @@ class Array<T1, T2, T3, T4, T5, void, void, void>
: public ArrayBase<ArrayElement<T1, T2, T3, T4, T5, void, void, void> >
{
public:
inline void Append(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4,
T5 const &m5)
inline void Push(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4,
T5 const &m5)
{
if (this->m_count >= this->m_reserved)
{
@@ -325,7 +325,7 @@ class Array<T1, T2, T3, T4, void, void, void, void>
: public ArrayBase<ArrayElement<T1, T2, T3, T4, void, void, void, void> >
{
public:
inline void Append(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4)
inline void Push(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4)
{
if (this->m_count >= this->m_reserved)
{
@@ -352,7 +352,7 @@ class Array<T1, T2, T3, void, void, void, void, void>
: public ArrayBase<ArrayElement<T1, T2, T3, void, void, void, void, void> >
{
public:
inline void Append(T1 const &m1, T2 const &m2, T3 const &m3)
inline void Push(T1 const &m1, T2 const &m2, T3 const &m3)
{
if (this->m_count >= this->m_reserved)
{
@@ -377,7 +377,7 @@ class Array<T1, T2, void, void, void, void, void, void>
: public ArrayBase<ArrayElement<T1, T2, void, void, void, void, void, void> >
{
public:
inline void Append(T1 const &m1, T2 const &m2)
inline void Push(T1 const &m1, T2 const &m2)
{
if (this->m_count >= this->m_reserved)
{


+ 8
- 8
test/tutorial/02_cube.cpp View File

@@ -35,15 +35,15 @@ public:
m_angle = 0;

/* Front vertices/colors */
m_mesh.Append(vec3(-1.0, -1.0, 1.0), vec3(1.0, 0.0, 1.0));
m_mesh.Append(vec3( 1.0, -1.0, 1.0), vec3(0.0, 1.0, 0.0));
m_mesh.Append(vec3( 1.0, 1.0, 1.0), vec3(1.0, 0.5, 0.0));
m_mesh.Append(vec3(-1.0, 1.0, 1.0), vec3(1.0, 1.0, 0.0));
m_mesh.Push(vec3(-1.0, -1.0, 1.0), vec3(1.0, 0.0, 1.0));
m_mesh.Push(vec3( 1.0, -1.0, 1.0), vec3(0.0, 1.0, 0.0));
m_mesh.Push(vec3( 1.0, 1.0, 1.0), vec3(1.0, 0.5, 0.0));
m_mesh.Push(vec3(-1.0, 1.0, 1.0), vec3(1.0, 1.0, 0.0));
/* Back */
m_mesh.Append(vec3(-1.0, -1.0, -1.0), vec3(1.0, 0.0, 0.0));
m_mesh.Append(vec3( 1.0, -1.0, -1.0), vec3(0.0, 0.5, 0.0));
m_mesh.Append(vec3( 1.0, 1.0, -1.0), vec3(0.0, 0.5, 1.0));
m_mesh.Append(vec3(-1.0, 1.0, -1.0), vec3(0.0, 0.0, 1.0));
m_mesh.Push(vec3(-1.0, -1.0, -1.0), vec3(1.0, 0.0, 0.0));
m_mesh.Push(vec3( 1.0, -1.0, -1.0), vec3(0.0, 0.5, 0.0));
m_mesh.Push(vec3( 1.0, 1.0, -1.0), vec3(0.0, 0.5, 1.0));
m_mesh.Push(vec3(-1.0, 1.0, -1.0), vec3(0.0, 0.0, 1.0));

m_indices << i16vec3(0, 1, 2);
m_indices << i16vec3(2, 3, 0);


+ 9
- 9
test/unit/array.cpp View File

@@ -27,10 +27,10 @@ LOLUNIT_FIXTURE(ArrayTest)
LOLUNIT_TEST(ArrayFill)
{
Array<int> a;
a.Append(0);
a.Append(1);
a.Append(2);
a.Append(3);
a.Push(0);
a.Push(1);
a.Push(2);
a.Push(3);

LOLUNIT_ASSERT_EQUAL(a[0], 0);
LOLUNIT_ASSERT_EQUAL(a[1], 1);
@@ -41,10 +41,10 @@ LOLUNIT_FIXTURE(ArrayTest)
LOLUNIT_TEST(ArrayCopy)
{
Array<int> a;
a.Append(0);
a.Append(1);
a.Append(2);
a.Append(3);
a.Push(0);
a.Push(1);
a.Push(2);
a.Push(3);

Array<int> b = a;

@@ -57,7 +57,7 @@ LOLUNIT_FIXTURE(ArrayTest)
LOLUNIT_TEST(EightElements)
{
Array<int, long, float, double, unsigned, char, bool, void *> a;
a.Append(1, 2, 3.f, 4.0, 5, 'a', true, 0);
a.Push(1, 2, 3.f, 4.0, 5, 'a', true, 0);

LOLUNIT_ASSERT_EQUAL(a[0].m1, 1);
LOLUNIT_ASSERT_EQUAL(a[0].m2, 2);


Loading…
Cancel
Save