uLib  User mode C/C++ extended API library for Win32 programmers.
LargeInt.h
Go to the documentation of this file.
1 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 // Project: uLib - User mode library.
3 // Module: Class wrap for LARGE_INTEGER.
4 // Author: Copyright (c) Love Nystrom
5 // License: NNOSL (BSD descendant, see NNOSL.txt in the base directory).
6 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 
8 #ifdef __cplusplus
9 #ifndef __uLib_LargeInt_h_incl__
10 #define __uLib_LargeInt_h_incl__
11 
12 #include <uLib/Common.h>
13 
15 
16 
25 
26 class LargeInt {
27 protected:
29  LARGE_INTEGER _val; // Has, rather than is, since unions can't be inherited.
31 public:
32  LargeInt( const INT64 Val = 0 );
33  LargeInt( const DWORD Lo, const LONG Hi );
34  LargeInt( const LARGE_INTEGER& Val );
35  LargeInt( const FILETIME& Val );
36  LargeInt( const LUID& Val );
37  LargeInt( const LargeInt& Val );
38 
39  LargeInt& Set( DWORD Lo, LONG Hi );
40 
41  operator LARGE_INTEGER() const;
42  operator PLARGE_INTEGER() const;
43  operator ULARGE_INTEGER() const;
44  operator PULARGE_INTEGER() const;
45  operator INT64() const;
46  operator INT32() const;
47  operator UINT64() const;
48  operator UINT32() const;
49  operator LUID() const;
50  operator FILETIME() const;
51 
52  INT32 High() { return _val.HighPart; }
53 
54  LargeInt& operator = ( const INT64 rhs );
55  LargeInt& operator = ( const LARGE_INTEGER& rhs );
56  LargeInt& operator = ( const LUID& rhs );
57  LargeInt& operator = ( const FILETIME& rhs );
58 
59  LargeInt& operator += ( const INT64 rhs );
60  LargeInt& operator -= ( const INT64 rhs );
61  LargeInt& operator *= ( const INT64 rhs );
62  LargeInt& operator /= ( const INT64 rhs );
63  LargeInt& operator %= ( const INT64 rhs );
64  LargeInt& operator &= ( const INT64 rhs );
65  LargeInt& operator |= ( const INT64 rhs );
66  LargeInt& operator ^= ( const INT64 rhs );
67 
68  LargeInt& operator += ( const LARGE_INTEGER& rhs );
69  LargeInt& operator -= ( const LARGE_INTEGER& rhs );
70  LargeInt& operator *= ( const LARGE_INTEGER& rhs );
71  LargeInt& operator /= ( const LARGE_INTEGER& rhs );
72  LargeInt& operator %= ( const LARGE_INTEGER& rhs );
73  LargeInt& operator &= ( const LARGE_INTEGER& rhs );
74  LargeInt& operator |= ( const LARGE_INTEGER& rhs );
75  LargeInt& operator ^= ( const LARGE_INTEGER& rhs );
76 
77  LargeInt& operator >>= ( const BYTE nbits );
78  LargeInt& operator <<= ( const BYTE nbits );
79 
80  LargeInt operator ++ ();
81  LargeInt operator -- ();
82  LargeInt operator ++ (int);
83  LargeInt operator -- (int);
84 
85  LargeInt operator - () const;
86 
87  LargeInt operator + ( const INT64 rhs ) const;
88  LargeInt operator - ( const INT64 rhs ) const;
89  LargeInt operator * ( const INT64 rhs ) const;
90  LargeInt operator / ( const INT64 rhs ) const;
91  LargeInt operator % ( const INT64 rhs ) const;
92  LargeInt operator & ( const INT64 rhs ) const;
93  LargeInt operator | ( const INT64 rhs ) const;
94  LargeInt operator ^ ( const INT64 rhs ) const;
95 
96  LargeInt operator >> ( const BYTE nbits ) const;
97  LargeInt operator << ( const BYTE nbits ) const;
98 
99  LargeInt operator + ( const LARGE_INTEGER& rhs ) const;
100  LargeInt operator - ( const LARGE_INTEGER& rhs ) const;
101  LargeInt operator * ( const LARGE_INTEGER& rhs ) const;
102  LargeInt operator / ( const LARGE_INTEGER& rhs ) const;
103  LargeInt operator % ( const LARGE_INTEGER& rhs ) const;
104  LargeInt operator & ( const LARGE_INTEGER& rhs ) const;
105  LargeInt operator | ( const LARGE_INTEGER& rhs ) const;
106  LargeInt operator ^ ( const LARGE_INTEGER& rhs ) const;
107 };
108 
111 #endif//ndef __uLib_LargeInt_h_incl__
112 #endif//def __cplusplus
113 // EOF
unsigned long DWORD
Definition: Common.h:414
#define END_NAMESPACE(name)
Definition: Common.h:225
Definition: DynArray.h:18
signed __int64 INT64
Definition: Common.h:401
unsigned __int64 UINT64
Definition: Common.h:400
#define BEGIN_NAMESPACE(name)
Definition: Common.h:224
Common include; Added types, small "ubiquitous" utilities, et c.
INT32 High()
Definition: LargeInt.h:52
unsigned char BYTE
Definition: Common.h:412