OpenTTD Source 20250205-master-gfd85ab1e2c
stdafx.h File Reference

Definition of base types and functions in a cross-platform compatible way. More...

#include <stdint.h>
#include <algorithm>
#include <array>
#include <bit>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <climits>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cwchar>
#include <deque>
#include <exception>
#include <functional>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <optional>
#include <set>
#include <source_location>
#include <span>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <variant>
#include <vector>

Go to the source code of this file.

Macros

#define __STDC_LIMIT_MACROS
 
#define NOACCESS(args)
 
#define EMPTY_BASES
 
#define PATHSEP   "/"
 
#define PATHSEPCHAR   '/'
 
#define PACK_N(type_dec, n)   type_dec __attribute__((__packed__, aligned(n)))
 
#define PACK(type_dec)   PACK_N(type_dec, 1)
 
#define debug_inline   inline
 
#define PERSONAL_DIR   ""
 
#define M_PI_2   1.57079632679489661923
 
#define M_PI   3.14159265358979323846
 
#define lengthof(array)   (sizeof(ArraySizeHelper(array)))
 Return the length of an fixed size array.
 
#define cpp_sizeof(base, variable)   (sizeof(std::declval<base>().variable))
 Gets the size of a variable within a class.
 
#define GNU_TARGET(x)
 
#define FMT_HEADER_ONLY
 
#define JSON_ASSERT(x)   assert(x)
 
#define MAX_PATH   260
 
#define IGNORE_UNINITIALIZED_WARNING_START
 
#define IGNORE_UNINITIALIZED_WARNING_STOP
 

Typedefs

typedef unsigned int uint
 

Functions

template<typename T >
std::string FS2OTTD (T name)
 
template<typename T >
std::string OTTD2FS (T name)
 
template<typename T , size_t N>
char(& ArraySizeHelper (T(&array)[N]))[N]
 
void NOT_REACHED (const std::source_location location=std::source_location::current())
 
void AssertFailedError (const char *expression, const std::source_location location=std::source_location::current())
 
void free (const void *ptr)
 Version of the standard free that accepts const pointers.
 

Detailed Description

Definition of base types and functions in a cross-platform compatible way.

Definition in file stdafx.h.

Macro Definition Documentation

◆ __STDC_LIMIT_MACROS

#define __STDC_LIMIT_MACROS

Definition at line 32 of file stdafx.h.

◆ cpp_sizeof

#define cpp_sizeof (   base,
  variable 
)    (sizeof(std::declval<base>().variable))

Gets the size of a variable within a class.

Parameters
baseThe class the variable is in.
variableThe variable to get the size of.
Returns
the size of the variable

Definition at line 285 of file stdafx.h.

◆ debug_inline

#define debug_inline   inline

Definition at line 228 of file stdafx.h.

◆ EMPTY_BASES

#define EMPTY_BASES

Definition at line 99 of file stdafx.h.

◆ FMT_HEADER_ONLY

#define FMT_HEADER_ONLY

Definition at line 302 of file stdafx.h.

◆ GNU_TARGET

#define GNU_TARGET (   x)

Definition at line 298 of file stdafx.h.

◆ IGNORE_UNINITIALIZED_WARNING_START

#define IGNORE_UNINITIALIZED_WARNING_START

Definition at line 353 of file stdafx.h.

◆ IGNORE_UNINITIALIZED_WARNING_STOP

#define IGNORE_UNINITIALIZED_WARNING_STOP

Definition at line 354 of file stdafx.h.

◆ JSON_ASSERT

#define JSON_ASSERT (   x)    assert(x)

Definition at line 315 of file stdafx.h.

◆ lengthof

#define lengthof (   array)    (sizeof(ArraySizeHelper(array)))

Return the length of an fixed size array.

Unlike sizeof this function returns the number of elements of the given type.

Parameters
xThe pointer to the first element of the array
Returns
The number of elements

Definition at line 277 of file stdafx.h.

◆ M_PI

#define M_PI   3.14159265358979323846

Definition at line 263 of file stdafx.h.

◆ M_PI_2

#define M_PI_2   1.57079632679489661923

Definition at line 262 of file stdafx.h.

◆ MAX_PATH

#define MAX_PATH   260

Definition at line 324 of file stdafx.h.

◆ NOACCESS

#define NOACCESS (   args)

Definition at line 88 of file stdafx.h.

◆ PACK

#define PACK (   type_dec)    PACK_N(type_dec, 1)

Definition at line 193 of file stdafx.h.

◆ PACK_N

#define PACK_N (   type_dec,
 
)    type_dec __attribute__((__packed__, aligned(n)))

Definition at line 191 of file stdafx.h.

◆ PATHSEP

#define PATHSEP   "/"

Definition at line 181 of file stdafx.h.

◆ PATHSEPCHAR

#define PATHSEPCHAR   '/'

Definition at line 182 of file stdafx.h.

◆ PERSONAL_DIR

#define PERSONAL_DIR   ""

Definition at line 246 of file stdafx.h.

Typedef Documentation

◆ uint

typedef unsigned int uint

Definition at line 242 of file stdafx.h.

Function Documentation

◆ AssertFailedError()

void AssertFailedError ( const char *  expression,
const std::source_location  location = std::source_location::current() 
)

Definition at line 18 of file error.cpp.

◆ free()

◆ FS2OTTD()

template<typename T >
std::string FS2OTTD ( name)

Definition at line 172 of file stdafx.h.

◆ NOT_REACHED()

void NOT_REACHED ( const std::source_location  location = std::source_location::current())

Definition at line 13 of file error.cpp.

◆ OTTD2FS()

template<typename T >
std::string OTTD2FS ( name)

Definition at line 173 of file stdafx.h.