ladivic
Loading...
Searching...
No Matches
ldvc_type.hpp
Go to the documentation of this file.
1/*
2 * This file is part of the ladivic library.
3 * Copyright (c) 2024 Nathanne Isip
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23
24/**
25 *
26 * @file ldvc_type.hpp
27 * @brief Defines common types used throughout the library.
28 *
29 * This header file defines several common types used throughout the library,
30 * including integer types, floating-point types, string type, and other aliases.
31 *
32 * @author Nathanne Isip
33 *
34 */
35#ifndef LDVC_TYPE_HPP
36#define LDVC_TYPE_HPP
37
38#include <string>
39#include <cstdint>
40
41/// Alias for std::string
42using string = std::string;
43
44/// Alias for a Unicode character
45using rune = char;
46
47/// Signed integer types
48using i8 = signed char;
49using i16 = short;
50using i32 = int;
51using i64 = long long;
52
53/// Unsigned integer types
54using u8 = unsigned char;
55using u16 = unsigned short;
56using u32 = unsigned int;
57using u64 = unsigned long long;
58
59/// Floating-point type
60using real = double;
61
62/// Unsigned size type
63using usize = size_t;
64
65/// Alias for void pointer
66using any = void*;
67
68#endif
T * ldvc_malloc(usize size)
Allocates memory for an array of elements.
Definition ldvc_mem.hpp:61
size_t usize
Unsigned size type.
Definition ldvc_type.hpp:63
signed char i8
Signed integer types.
Definition ldvc_type.hpp:48
std::string string
Alias for std::string.
Definition ldvc_type.hpp:42
unsigned char u8
Unsigned integer types.
Definition ldvc_type.hpp:54
void * any
Alias for void pointer.
Definition ldvc_type.hpp:66
double real
Floating-point type.
Definition ldvc_type.hpp:60
char rune
Alias for a Unicode character.
Definition ldvc_type.hpp:45