1//
2// This file is part of the aMule Project.
3//
4// Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5// Copyright (c) 2002-2011 Merkur ( devs@emule-project.net / http://www.emule-project.net )
6//
7// Any parts of this program derived from the xMule, lMule or eMule project,
8// or contributed by third-party developers are copyrighted by their
9// respective authors.
10//
11// This program is free software; you can redistribute it and/or modify
12// it under the terms of the GNU General Public License as published by
13// the Free Software Foundation; either version 2 of the License, or
14// (at your option) any later version.
15//
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program; if not, write to the Free Software
23// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
24//
25
26#ifndef TYPES_H
27#define TYPES_H
28
29#ifndef USE_STD_STRING
30#include <wx/string.h>		// Needed for wxString and wxEmptyString
31#endif
32
33#include <list>			// Needed for std::list
34#include <vector>		// Needed for std::vector
35
36#ifndef _MSC_VER
37	#ifndef __STDC_FORMAT_MACROS
38		#define __STDC_FORMAT_MACROS
39	#endif
40	#include <inttypes.h>
41	#define LONGLONG(x) x##ll
42	#define ULONGLONG(x) x##llu
43#else
44	typedef unsigned __int8 byte;
45	typedef unsigned __int8 uint8_t;
46	typedef unsigned __int16 uint16_t;
47	typedef unsigned __int32 uint32_t;
48	typedef unsigned __int64 uint64_t;
49	typedef signed __int8 int8_t;
50	typedef signed __int16 int16_t;
51	typedef signed __int32 int32_t;
52	typedef signed __int64 int64_t;
53	#define LONGLONG(x) x##i64
54	#define ULONGLONG(x) x##ui64
55#endif
56
57// These are _MSC_VER defines used in eMule. They should
58// not be used in aMule, instead, use this table to
59// find the type to use in order to get the desired
60// effect.
61//////////////////////////////////////////////////
62// Name              // Type To Use In Amule    //
63//////////////////////////////////////////////////
64// BOOL              // bool                    //
65// WORD              // uint16                  //
66// INT               // int32                   //
67// UINT              // uint32                  //
68// UINT_PTR          // uint32*                 //
69// PUINT             // uint32*                 //
70// DWORD             // uint32                  //
71// LONG              // long                    //
72// ULONG             // unsigned long           //
73// LONGLONG          // long long               //
74// ULONGLONG         // unsigned long long      //
75// LPBYTE            // char*                   //
76// VOID              // void                    //
77// PVOID             // void*                   //
78// LPVOID            // void*                   //
79// LPCVOID           // const void*             //
80// CHAR              // char                    //
81// LPSTR             // char*                   //
82// LPCSTR            // const char*             //
83// TCHAR             // char                    //
84// LPTSTR            // char*                   //
85// LPCTSTR           // const char*             //
86// WCHAR             // wchar_t                 //
87// LPWSTR            // wchar_t*                //
88// LPCWSTR           // const wchar_t*          //
89// WPARAM            // uint16                  //
90// LPARAM            // uint32                  //
91// POINT             // wxPoint                 //
92//////////////////////////////////////////////////
93
94/*
95 * Backwards compatibility with emule.
96 * Note that the int* types are indeed unsigned.
97 */
98typedef uint8_t		int8;
99typedef uint8_t		uint8;
100typedef uint16_t	int16;
101typedef uint16_t	uint16;
102typedef uint32_t	int32;
103typedef uint32_t	uint32;
104typedef uint64_t	int64;
105typedef uint64_t	uint64;
106typedef int8_t		sint8;
107typedef int16_t		sint16;
108typedef int32_t		sint32;
109typedef int64_t		sint64;
110typedef uint8_t		byte;
111
112
113class CKnownFile;
114
115//! Various common list-types.
116//@{
117#ifndef USE_STD_STRING
118typedef std::list<wxString> CStringList;
119#endif
120typedef std::list<CKnownFile*> CKnownFilePtrList;
121//@}
122
123typedef std::vector<uint8>  ArrayOfUInts8;
124typedef std::vector<uint16> ArrayOfUInts16;
125typedef std::vector<uint32> ArrayOfUInts32;
126typedef std::vector<uint64> ArrayOfUInts64;
127
128typedef std::list<uint32>	ListOfUInts32;
129
130/* This is the Evil Void String For Returning On Const References From Hell */
131// IT MEANS I WANT TO USE IT EVERYWHERE. DO NOT MOVE IT.
132// THE FACT SOMETHING IS USED IN JUST ONE PLACE DOESN'T MEAN IT HAS
133// TO BE MOVED TO THAT PLACE. I MIGHT NEED IT ELSEWHERE LATER.
134//
135
136#ifndef USE_STD_STRING
137static const wxString EmptyString = wxEmptyString;
138#endif
139
140#ifndef __cplusplus
141	typedef int bool;
142#endif
143
144
145#ifdef _WIN32			// Used in non-wx-apps too (ed2k), so don't use __WXMSW__ here !
146#ifdef _MSC_VER
147	#define NOMINMAX
148	#include <windows.h> // Needed for RECT  // Do_not_auto_remove
149#else
150	#include <windef.h>	// Needed for RECT  // Do_not_auto_remove
151	#include <wingdi.h>	// Do_not_auto_remove
152	#include <winuser.h>	// Do_not_auto_remove
153	#include <winbase.h> // Do_not_auto_remove
154#endif
155	// Windows compilers don't have these constants
156	#ifndef W_OK
157		enum
158		{
159			F_OK = 0,   // test for existence
160			X_OK = 1,   //          execute permission
161			W_OK = 2,   //          write
162			R_OK = 4    //          read
163		};
164	#endif // W_OK
165	#ifdef __WXMSW__
166		#include <wx/msw/winundef.h>	// Do_not_auto_remove
167	#endif
168	#undef GetUserName
169#else // _WIN32
170	typedef struct sRECT {
171	  uint32 left;
172	  uint32 top;
173	  uint32 right;
174	  uint32 bottom;
175	} RECT;
176#endif /* _WIN32 */
177
178
179#endif /* TYPES_H */
180// File_checked_for_headers
181