(svn r22411) -Document: another bunch of bits

This commit is contained in:
rubidium
2011-05-02 17:42:12 +00:00
parent 4d5dbf5170
commit fb5ecb9499
34 changed files with 155 additions and 19 deletions

View File

@@ -13,12 +13,16 @@
#define ENDIAN_TYPE_HPP
#if defined(ARM) || defined(__arm__) || defined(__alpha__)
/** The architecture requires aligned access. */
#define OTTD_ALIGNMENT 1
#else
/** The architecture does not require aligned access. */
#define OTTD_ALIGNMENT 0
#endif
/** Little endian builds use this for TTD_ENDIAN. */
#define TTD_LITTLE_ENDIAN 0
/** Big endian builds use this for TTD_ENDIAN. */
#define TTD_BIG_ENDIAN 1
/* Windows has always LITTLE_ENDIAN */

View File

@@ -16,6 +16,10 @@
#include "mem_func.hpp"
#include "pool_type.hpp"
/**
* Helper for defining the method's signature.
* @param type The return type of the method.
*/
#define DEFINE_POOL_METHOD(type) \
template <class Titem, typename Tindex, size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type, bool Tcache, bool Tzero> \
type Pool<Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero>

View File

@@ -35,12 +35,20 @@ protected:
public:
SmallVector() : data(NULL), items(0), capacity(0) { }
/**
* Copy constructor.
* @param other The other vector to copy.
*/
template <uint X>
SmallVector(const SmallVector<T, X> &other) : data(NULL), items(0), capacity(0)
{
MemCpyT<T>(this->Append(other.Length()), other.Begin(), other.Length());
}
/**
* Assignment.
* @param other The new vector that.
*/
template <uint X>
SmallVector &operator=(const SmallVector<T, X> &other)
{
@@ -318,6 +326,6 @@ public:
}
};
typedef AutoFreeSmallVector<char*, 4> StringList;
typedef AutoFreeSmallVector<char*, 4> StringList; ///< Type for a list of strings.
#endif /* SMALLVEC_TYPE_HPP */

View File

@@ -12,7 +12,14 @@
#ifndef STRING_COMPARE_TYPE_HPP
#define STRING_COMPARE_TYPE_HPP
/** Comparator for strings. */
struct StringCompare {
/**
* Compare two strings.
* @param a The first string.
* @param b The second string.
* @return True is the first string is deemed "lower" than the second string.
*/
bool operator () (const char *a, const char *b) const
{
return strcmp(a, b) < 0;