Bladeren bron

base: add a simple tuple implementation.

undefined
Sam Hocevar 10 jaren geleden
bovenliggende
commit
7cf72fd16e
6 gewijzigde bestanden met toevoegingen van 96 en 2 verwijderingen
  1. +1
    -1
      src/Makefile.am
  2. +1
    -0
      src/lol/base/all.h
  3. +89
    -0
      src/lol/base/tuple.h
  4. +1
    -0
      src/lolcore.vcxproj
  5. +3
    -0
      src/lolcore.vcxproj.filters
  6. +1
    -1
      tools/vimlol/vimlol.vim

+ 1
- 1
src/Makefile.am Bestand weergeven

@@ -36,7 +36,7 @@ liblolcore_headers = \
lol/unit.h \
\
lol/base/all.h \
lol/base/features.h lol/base/array.h lol/base/types.h lol/base/array.h \
lol/base/features.h lol/base/tuple.h lol/base/types.h lol/base/array.h \
lol/base/assert.h lol/base/string.h lol/base/hash.h lol/base/map.h \
lol/base/enum.h lol/base/log.h \
\


+ 1
- 0
src/lol/base/all.h Bestand weergeven

@@ -15,6 +15,7 @@
#include <lol/base/types.h>
#include <lol/base/log.h>
#include <lol/base/assert.h>
#include <lol/base/tuple.h>
#include <lol/base/array.h>
#include <lol/base/string.h>
#include <lol/base/hash.h>


+ 89
- 0
src/lol/base/tuple.h Bestand weergeven

@@ -0,0 +1,89 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net>
// (c) 2013-2014 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://www.wtfpl.net/ for more details.
//

//
// The tuple class
// ---------------
// A very simple tuple class.
//

#if !defined __LOL_BASE_TUPLE_H__
#define __LOL_BASE_TUPLE_H__

#include <lol/base/assert.h>

namespace lol
{

template<typename T1, typename T2 = void, typename T3 = void,
typename T4 = void, typename T5 = void, typename T6 = void,
typename T7 = void, typename T8 = void>
class tuple
{
public:
T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8;
};

template<typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7>
class tuple<T1, T2, T3, T4, T5, T6, T7, void>
{
public:
T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7;
};

template<typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6>
class tuple<T1, T2, T3, T4, T5, T6, void, void>
{
public:
T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6;
};

template<typename T1, typename T2, typename T3, typename T4, typename T5>
class tuple<T1, T2, T3, T4, T5, void, void, void>
{
public:
T1 m1; T2 m2; T3 m3; T4 m4; T5 m5;
};

template<typename T1, typename T2, typename T3, typename T4>
class tuple<T1, T2, T3, T4, void, void, void, void>
{
public:
T1 m1; T2 m2; T3 m3; T4 m4;
};

template<typename T1, typename T2, typename T3>
class tuple<T1, T2, T3, void, void, void, void, void>
{
public:
T1 m1; T2 m2; T3 m3;
};

template<typename T1, typename T2>
class tuple<T1, T2, void, void, void, void, void, void>
{
public:
T1 m1; T2 m2;
};

template<typename T1>
class tuple<T1, void, void, void, void, void, void, void>
{
public:
T1 m1;
};

} /* namespace lol */

#endif // __LOL_BASE_TUPLE_H__


+ 1
- 0
src/lolcore.vcxproj Bestand weergeven

@@ -300,6 +300,7 @@
<ClInclude Include="lol\base\map.h" />
<ClInclude Include="lol\base\string.h" />
<ClInclude Include="lol\base\types.h" />
<ClInclude Include="lol\base\tuple.h" />
<ClInclude Include="lol\debug\all.h" />
<ClInclude Include="lol\debug\lines.h" />
<ClInclude Include="lol\engine.h" />


+ 3
- 0
src/lolcore.vcxproj.filters Bestand weergeven

@@ -633,6 +633,9 @@
<ClInclude Include="lol\base\types.h">
<Filter>lol\base</Filter>
</ClInclude>
<ClInclude Include="lol\base\tuple.h">
<Filter>lol\base</Filter>
</ClInclude>
<ClInclude Include="lol\math\array2d.h">
<Filter>lol\base</Filter>
</ClInclude>


+ 1
- 1
tools/vimlol/vimlol.vim Bestand weergeven

@@ -18,7 +18,7 @@ au Syntax cpp
" Some custom container types
au Syntax cpp
\ syn keyword cType
\ array array2d array3d hash map
\ tuple array array2d array3d hash map

" GLSL types and the Lol Engine extensions
au Syntax cpp


Laden…
Annuleren
Opslaan