source: filezilla/trunk/fuentes/src/include/misc.h @ 130

Last change on this file since 130 was 130, checked in by jrpelegrina, 3 years ago

First release to xenial

File size: 2.1 KB
Line 
1#ifndef __MISC_H__
2#define __MISC_H__
3
4#include "socket.h"
5
6// Also verifies that it is a correct IPv6 address
7wxString GetIPV6LongForm(wxString short_address);
8
9int DigitHexToDecNum(wxChar c);
10
11bool IsRoutableAddress(const wxString& address, CSocket::address_family family);
12
13bool IsIpAddress(const wxString& address);
14
15// Get a random number uniformly distributed in the closed interval [min, max]
16int GetRandomNumber(int low, int high);
17
18// Under some locales (e.g. Turkish), there is a different
19// relationship between the letters a-z and A-Z.
20// In Turkish for example there are different types of i
21// (dotted and dotless), with i lowercase dotted and I
22// uppercase dotless.
23// If needed, use this function to transform the case manually
24// and locale-independently
25// In addition to the usual A-Z to a-z, the other two i's are
26// transformed to lowercase dotted i as well.
27void MakeLowerAscii(wxString& str);
28void MakeLowerAscii(fzstring& str);
29
30// Strongly typed enum would be nice, but we need to support older compilers still.
31namespace dependency {
32enum type {
33        wxwidgets,
34        gnutls,
35        sqlite,
36        count
37};
38}
39
40wxString GetDependencyName( dependency::type d );
41wxString GetDependencyVersion( dependency::type d );
42
43wxString ListTlsCiphers(const wxString& priority);
44
45// Microsoft, in its insane stupidity, has decided to make GetVersion(Ex) useless, starting with Windows 8.1,
46// this function no longer returns the operating system version but instead some arbitrary and random value depending
47// on the phase of the moon.
48// This function instead returns the actual Windows version. On non-Windows systems, it's equivalent to
49// wxGetOsVersion
50bool GetRealOsVersion( int& major, int& minor );
51
52template<typename Derived, typename Base>
53std::unique_ptr<Derived>
54unique_static_cast(std::unique_ptr<Base>&& p)
55{
56        auto d = static_cast<Derived *>(p.release());
57        return std::unique_ptr<Derived>(d);
58}
59
60// wxGetTranslation does not support 64bit ints on 32bit systems.
61#define wxPLURAL_LL(sing, plur, n) \
62        wxGetTranslation((sing), (plur), (sizeof(unsigned int) < 8 && (n) > 1000000000) ? (1000000000 + (n) % 1000000000) : (n))
63
64#endif //__MISC_H__
Note: See TracBrowser for help on using the repository browser.