AceLinux 2.0
A library of wicked convenience functions for Linux.
Ace.h
Go to the documentation of this file.
1#pragma once
2#include <stdio.h>
3#include <stdarg.h>
4#include <cctype>
5#include <cmath>
6#include <iostream>
7#include <sstream>
8#include <vector>
9#include <algorithm>
10#include <time.h>
11#include <random>
12#include <math.h>
13#include <fenv.h>
14#include <errno.h>
15#include <Windows.h>
16#include <strsafe.h>
17#include <wingdi.h>
18#include <codecvt>
19#include <locale>
20#include <sys/stat.h>
21
22#ifndef BYTE_ALIGNMENT
23static const size_t BYTE_ALIGNMENT = 2 << 3;
24#endif
25
26#ifndef MAX_SEEDS
27static const size_t MAX_SEEDS = 200;
28#endif
29
30#ifndef MAX_STRING_BUFFER_SIZE
31static const size_t MAX_STRING_BUFFER_SIZE = 4 << 20;
32#endif
33
34#ifndef PI
35static const double PI = 3.1415926535897932384626433832795;
36#endif
37
38#ifndef S_ISDIR
39#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
40#endif
41
42#ifndef S_ISREG
43#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
44#endif
45
46using namespace std;
47
48class Ace
49{
50public:
51 static void* _Aligned_Malloc(const size_t& size, const size_t& alignment = BYTE_ALIGNMENT);
52 static void* _Aligned_Calloc(const size_t& size, const size_t& alignment = BYTE_ALIGNMENT);
53 static double AbsoluteValue(const double& num);
54 static float AbsoluteValue(const float& num);
55 static int AbsoluteValue(const int& num);
56 static long AbsoluteValue(const long& num);
57 static char* AllocateAndCopyString(const char* strToCopy);
58 static wchar_t* AllocateAndCopyString(const wchar_t* wideStrToCopy);
59 static double ArcCos(const double& numInRadians);
60 static float ArcCos(const float& numInRadians);
61 static int ArcCos(const int& numInRadians);
62 static long ArcCos(const long& numInRadians);
63 static double ArcCosH(const double& numInRadians);
64 static float ArcCosH(const float& numInRadians);
65 static int ArcCosH(const int& numInRadians);
66 static long ArcCosH(const long& numInRadians);
67 static double ArcSin(const double& numInRadians);
68 static float ArcSin(const float& numInRadians);
69 static int ArcSin(const int& numInRadians);
70 static long ArcSin(const long& numInRadians);
71 static double ArcSinH(const double& numInRadians);
72 static float ArcSinH(const float& numInRadians);
73 static int ArcSinH(const int& numInRadians);
74 static long ArcSinH(const long& numInRadians);
75 static double ArcTan(const double& numInRadians);
76 static float ArcTan(const float& numInRadians);
77 static int ArcTan(const int& numInRadians);
78 static long ArcTan(const long& numInRadians);
79 static double ArcTanH(const double& numInRadians);
80 static float ArcTanH(const float& numInRadians);
81 static int ArcTanH(const int& numInRadians);
82 static long ArcTanH(const long& numInRadians);
83 static double ArcTan2(const double& yInRadians, const double& xInRadians);
84 static float ArcTan2(const float& yInRadians, const float& xInRadians);
85 static int ArcTan2(const int& yInRadians, const int& xInRadians);
86 static long ArcTan2(const long& yInRadians, const long& xInRadians);
87 static void CalculateAspectRatio(const int& newWidth, const int& newHeight, const int& originalWidth, const int& originalHeight, int& outAdjustedWidth, int& outAdjustedHeight);
88 static LONGLONG CalculateFileSize(const char* theFilePath);
89 static LONGLONG CalculateFileSize(const wchar_t* theFilePath);
90 static int CalculateNumLength(const int& num);
91 static long CalculateNumLength(const long& num);
92 static double Ceiling(const double& num);
93 static float Ceiling(const float& num);
94 static int Ceiling(const int& num);
95 static long Ceiling(const long& num);
96 static bool ChangeWindowsConsoleFont(const wchar_t* fontName, const wchar_t* locale, const UINT& fontFamily, const UINT& fontWeight, const SHORT& fontWidth, const SHORT& fontHeight, const DWORD& fontIndex = 0);
97 static char CharAt(const char* str, const int& index);
98 static wchar_t CharAt(const wchar_t* str, const int& index);
99 static int Clamp(const int& numToClamp, const int& min, const int& max);
100 static long Clamp(const long& numToClamp, const long& min, const long& max);
101 static double Clamp(const double& numToClamp, const double& min, const double& max);
102 static float Clamp(const float& numToClamp, const float& min, const float& max);
103 static double ComplementaryErrorFunction(const double& num);
104 static float ComplementaryErrorFunction(const float& num);
105 static int ComplementaryErrorFunction(const int& num);
106 static long ComplementaryErrorFunction(const long& num);
107 static char* ConcatenateStrings(const int& numStrings, char** stringArray);
108 static wchar_t* ConcatenateStrings(const int& numStrings, wchar_t** stringArray);
109 static char* ConcatenateStrings(const vector<const char*>& stringVectorArray);
110 static wchar_t* ConcatenateStrings(const vector<const wchar_t*>& stringVectorArray);
111 static bool ConcatenateStrings(char* destination, const int& numStrings, const char** stringArray);
112 static bool ConcatenateStrings(wchar_t* destination, const int& numStrings, const wchar_t** stringArray);
113 static bool ConcatenateStrings(char* destination, const vector<const char*>& stringVectorArray);
114 static bool ConcatenateStrings(wchar_t* destination, const vector<const wchar_t*>& stringVectorArray);
115 static char* Concatenate(int numStrings, ...);
116 static wchar_t* ConcatenateW(int numWideStrings, ...);
117 static bool Concatenate(char* destination, int numStrings, ...);
118 static bool ConcatenateW(wchar_t* destination, int numWideStrings, ...);
119 static bool Contains(const char* strToSearch, const char* strToLookFor);
120 static bool Contains(const wchar_t* strToSearch, const wchar_t* strToLookFor);
121 static bool ContainsIgnoreCase(const char* strToSearch, const char* strToLookFor);
122 static bool ContainsIgnoreCase(const wchar_t* strToSearch, const wchar_t* strToLookFor);
123 static bool ConvertDoubleToBool(const double& num);
124 static bool ConvertFloatToBool(const float& num);
125 static bool ConvertIntToBool(const int& num);
126 static char* ConvertIntToString(const int& integerToConvert);
127 static wchar_t* ConvertIntToWideString(const int& integerToConvert);
128 static bool ConvertLongToBool(const long& num);
129 static char* ConvertLongToString(const long& longToConvert);
130 static wchar_t* ConvertLongToWideString(const long& longToConvert);
131 static vector<char*> ConvertStringArrayToStringVectorArray(char** stringArray);
132 static vector<wchar_t*> ConvertStringArrayToStringVectorArray(wchar_t** stringArray);
133 static char* ConvertStringFullWidthToHalfWidth(const char* fullWidthStr);
134 static wchar_t* ConvertStringFullWidthToHalfWidth(const wchar_t* fullWidthStr);
135 static bool ConvertStringFullWidthToHalfWidth(const char* fullWidthStr, char* outHalfWidthStr);
136 static bool ConvertStringFullWidthToHalfWidth(const wchar_t* fullWidthStr, wchar_t* outHalfWidthStr);
137 static char* ConvertStringHalfWidthToFullWidth(const char* halfWidthStr);
138 static wchar_t* ConvertStringHalfWidthToFullWidth(const wchar_t* halfWidthStr);
139 static bool ConvertStringHalfWidthToFullWidth(const char* halfWidthStr, char* outFullWidthStr);
140 static bool ConvertStringHalfWidthToFullWidth(const wchar_t* halfWidthStr, wchar_t* outFullWidthStr);
141 static bool ConvertStringToBool(const char* str);
142 static bool ConvertStringToBool(const wchar_t* str);
143 static float* ConvertStringToFloatArray(const char* strToConvert, const char* delimiter, int& outNumItems);
144 static float* ConvertStringToFloatArray(const wchar_t* strToConvert, const wchar_t* delimiter, int& outNumItems);
145 static unsigned int ConvertStringToHex(const char* str);
146 static unsigned int ConvertStringToHex(const wchar_t* str);
147 static double ConvertStringToDouble(const char* str);
148 static double ConvertStringToDouble(const wchar_t* str);
149 static float ConvertStringToFloat(const char* str);
150 static float ConvertStringToFloat(const wchar_t* str);
151 static int ConvertStringToInteger(const char* str);
152 static int ConvertStringToInteger(const wchar_t* str);
153 static long ConvertStringToLong(const char* str);
154 static long ConvertStringToLong(const wchar_t* str);
155 static char* ConvertStringToOneLine(const char* strToConvert);
156 static wchar_t* ConvertStringToOneLine(const wchar_t* strToConvert);
157 static void ConvertStringToOneLineInPlace(char* strToConvert);
158 static void ConvertStringToOneLineInPlace(wchar_t* strToConvert);
159 static wchar_t* ConvertStringToWCharString(const char* strToConvert);
160 static char** ConvertStringVectorArrayToStringArray(const vector<const char*>& stringVectorArray, int& outStringArrayLength);
161 static wchar_t** ConvertStringVectorArrayToStringArray(const vector<const wchar_t*>& stringVectorArray, int& outStringArrayLength);
162 static bool ConvertStringVectorArrayToStringArray(char** destinationStrArray, const vector<const char*>& stringVectorArray, int& outStringArrayLength);
163 static bool ConvertStringVectorArrayToStringArray(wchar_t** destinationStrArray, const vector<const wchar_t*>& stringVectorArray, int& outStringArrayLength);
164 static char ConvertToLowerCase(const char& character);
165 static wchar_t ConvertToLowerCase(const wchar_t& character);
166 static char ConvertToUpperCase(const char& character);
167 static wchar_t ConvertToUpperCase(const wchar_t& character);
168 static char* ConvertToLowerCase(const char* str);
169 static wchar_t* ConvertToLowerCase(const wchar_t* str);
170 static void ConvertToLowerCaseInPlace(char* str);
171 static void ConvertToLowerCaseInPlace(wchar_t* str);
172 static char* ConvertToUpperCase(const char* str);
173 static wchar_t* ConvertToUpperCase(const wchar_t* str);
174 static void ConvertToUpperCaseInPlace(char* str);
175 static void ConvertToUpperCaseInPlace(wchar_t* str);
176 static double Cos(const double& numInRadians);
177 static float Cos(const float& numInRadians);
178 static int Cos(const int& numInRadians);
179 static long Cos(const long& numInRadians);
180 static double CosH(const double& numInRadians);
181 static float CosH(const float& numInRadians);
182 static int CosH(const int& numInRadians);
183 static long CosH(const long& numInRadians);
184 static int CountNumOccurrences(const char* strToSearch, const char& charToLookFor);
185 static int CountNumOccurrences(const wchar_t* strToSearch, const wchar_t& charToLookFor);
186 static int CountNumOccurrences(const char* strToSearch, const char* strToLookFor);
187 static int CountNumOccurrences(const wchar_t* strToSearch, const wchar_t* strToLookFor);
188 static double CubeRoot(const double& num);
189 static float CubeRoot(const float& num);
190 static int CubeRoot(const int& num);
191 static long CubeRoot(const long& num);
192 static double DegreesToRadians(const double& degrees);
193 static float DegreesToRadians(const float& degrees);
194 static int DegreesToRadians(const int& degrees);
195 static long DegreesToRadians(const long& degrees);
196 static bool DoesFileExist(const char* fullFilePathWithNameAndExt);
197 static bool DoesFileExist(const wchar_t* fullFilePathWithNameAndExt);
198 static double ErrorFunction(const double& num);
199 static float ErrorFunction(const float& num);
200 static int ErrorFunction(const int& num);
201 static long ErrorFunction(const long& num);
202 static bool Equals(const char* strToCompOne, const char* strToCompTwo);
203 static bool Equals(const wchar_t* strToCompOne, const wchar_t* strToCompTwo);
204 static bool EqualsIgnoreCase(const char* strToCompOne, const char* strToCompTwo);
205 static bool EqualsIgnoreCase(const wchar_t* strToCompOne, const wchar_t* strToCompTwo);
206 static double EToTheXPower(const double& power);
207 static float EToTheXPower(const float& power);
208 static int EToTheXPower(const int& power);
209 static long EToTheXPower(const long& power);
210 static double EToTheXPowerMinusOne(const double& power);
211 static float EToTheXPowerMinusOne(const float& power);
212 static int EToTheXPowerMinusOne(const int& power);
213 static long EToTheXPowerMinusOne(const long& power);
214 static char FirstChar(const char* str);
215 static wchar_t FirstChar(const wchar_t* str);
216 static double Floor(const double& num);
217 static float Floor(const float& num);
218 static int Floor(const int& num);
219 static long Floor(const long& num);
220 static double GammaFunction(const double& num);
221 static float GammaFunction(const float& num);
222 static int GammaFunction(const int& num);
223 static long GammaFunction(const long& num);
224 static double GenerateRandomNum(const double& min, const double& max);
225 static float GenerateRandomNum(const float& min, const float& max);
226 static int GenerateRandomNum(const int& min, const int& max);
227 static long GenerateRandomNum(const long& min, const long& max);
228 static char* GetHResultDescription(const HRESULT& result);
229 static wchar_t* GetHResultDescriptionW(const HRESULT& result);
230 static void GetImageSize(const char* fileName, int* outWidth, int* outHeight);
231 static void GetImageSizeW(const wchar_t* fileName, int* outWidth, int* outHeight);
232 static void GetLastWindowsError(wchar_t* outLastWindowsErrorMessage);
233 static double Hypotenuse(const double& x, const double& y);
234 static float Hypotenuse(const float& x, const float& y);
235 static int Hypotenuse(const int& x, const int& y);
236 static long Hypotenuse(const long& x, const long& y);
237 static int IndexOf(const char* strToSearch, const char& charToLookFor);
238 static int IndexOf(const wchar_t* strToSearch, const wchar_t& charToLookFor);
239 static int IndexOf(const char* strToSearch, const char* strToLookFor);
240 static int IndexOf(const wchar_t* strToSearch, const wchar_t* strToLookFor);
241 static int IndexOfFirstLetter(const char* strToSearch);
242 static int IndexOfFirstLetter(const wchar_t* strToSearch);
243 static int IndexOfIgnoreCase(const char* strToSearch, const char& charToLookFor);
244 static int IndexOfIgnoreCase(const wchar_t* strToSearch, const wchar_t& charToLookFor);
245 static int IndexOfIgnoreCase(const char* strToSearch, const char* strToLookFor);
246 static int IndexOfIgnoreCase(const wchar_t* strToSearch, const wchar_t* strToLookFor);
247 static char* InsertString(const char* strToReceive, const char* strToInsert, const int& startIndex);
248 static wchar_t* InsertString(const wchar_t* strToReceive, const wchar_t* strToInsert, const int& startIndex);
249 static bool InsertString(char* destination, const char* strToReceive, const char* strToInsert, const int& startIndex);
250 static bool InsertString(wchar_t* destination, const wchar_t* strToReceive, const wchar_t* strToInsert, const int& startIndex);
251 static bool IsAlphabetic(const char& character);
252 static bool IsAlphabetic(const wchar_t& character);
253 static bool IsDigit(const char& character);
254 static bool IsDigit(const wchar_t& character);
255 static bool IsEmpty(const char* str);
256 static bool IsEmpty(const wchar_t* str);
257 static bool IsFile(const char* str);
258 static bool IsFile(const wchar_t* str);
259 static bool IsFolder(const char* str);
260 static bool IsFolder(const wchar_t* str);
261 static bool IsNumber(const char* str);
262 static bool IsNumber(const wchar_t* str);
263 static bool IsPathADevice(const char* path);
264 static bool IsPathADevice(const wchar_t* path);
265 static bool IsWhitespace(const char& character);
266 static bool IsWhitespace(const wchar_t& character);
267 static double Largest(const double& numOne, const double& numTwo);
268 static float Largest(const float& numOne, const float& numTwo);
269 static int Largest(const int& numOne, const int& numTwo);
270 static long Largest(const long& numOne, const long& numTwo);
271 static char LastChar(const char* str);
272 static wchar_t LastChar(const wchar_t* str);
273 static int LastIndexOf(const char* strToSearch, const char* strToLookFor);
274 static int LastIndexOf(const wchar_t* strToSearch, const wchar_t* strToLookFor);
275 static double LogBaseTen(const double& num);
276 static float LogBaseTen(const float& num);
277 static int LogBaseTen(const int& num);
278 static long LogBaseTen(const long& num);
279 static double LogBaseTwo(const double& num);
280 static float LogBaseTwo(const float& num);
281 static int LogBaseTwo(const int& num);
282 static long LogBaseTwo(const long& num);
283 static double Mod(const double& numerator, const double& denominator);
284 static float Mod(const float& numerator, const float& denominator);
285 static int Mod(const int& numerator, const int& denominator);
286 static long Mod(const long& numerator, const long& denominator);
287 static double MultiplyThenAdd(const double& multOne, const double& multTwo, const double& add);
288 static float MultiplyThenAdd(const float& multOne, const float& multTwo, const float& add);
289 static int MultiplyThenAdd(const int& multOne, const int& multTwo, const int& add);
290 static long MultiplyThenAdd(const long& multOne, const long& multTwo, const long& add);
291 static double NaturalLog(const double& num);
292 static float NaturalLog(const float& num);
293 static int NaturalLog(const int& num);
294 static long NaturalLog(const long& num);
295 static double NaturalLogGammaFunction(const double& num);
296 static float NaturalLogGammaFunction(const float& num);
297 static int NaturalLogGammaFunction(const int& num);
298 static long NaturalLogGammaFunction(const long& num);
299 static int NextIndexOf(const char* strToSearch, const char& charToLookFor, const int& startIndex);
300 static int NextIndexOf(const wchar_t* strToSearch, const wchar_t& charToLookFor, const int& startIndex);
301 static int NextIndexOf(const char* strToSearch, const char* strToLookFor, const int& startIndex);
302 static int NextIndexOf(const wchar_t* strToSearch, const wchar_t* strToLookFor, const int& startIndex);
303 static double NumTimesTwoToTheXPower(const double& num, const double& power);
304 static float NumTimesTwoToTheXPower(const float& num, const float& power);
305 static int NumTimesTwoToTheXPower(const int& num, const int& power);
306 static long NumTimesTwoToTheXPower(const long& num, const long& power);
307 static double PositiveDifference(const double& numOne, const double& numTwo);
308 static float PositiveDifference(const float& numOne, const float& numTwo);
309 static int PositiveDifference(const int& numOne, const int& numTwo);
310 static long PositiveDifference(const long& numOne, const long& numTwo);
311 static double Power(const double& base, const double& exponent);
312 static float Power(const float& base, const float& exponent);
313 static int Power(const int& base, const int& exponent);
314 static long Power(const long& base, const long& exponent);
315 static double RadiansToDegrees(const double& radians);
316 static float RadiansToDegrees(const float& radians);
317 static int RadiansToDegrees(const int& radians);
318 static long RadiansToDegrees(const long& radians);
319 static double Range(const double& inValue, const double& minInRange, const double& maxInRange, const double& minOutRange, const double& maxOutRange);
320 static float Range(const float& inValue, const float& minInRange, const float& maxInRange, const float& minOutRange, const float& maxOutRange);
321 static int Range(const int& inValue, const int& minInRange, const int& maxInRange, const int& minOutRange, const int& maxOutRange);
322 static long Range(const long& inValue, const long& minInRange, const long& maxInRange, const long& minOutRange, const long& maxOutRange);
323 static char* ReadTextFile(const char* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const char* mode = "r", const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
324 static wchar_t* ReadTextFileW(const wchar_t* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const wchar_t* mode = L"r, ccs=UTF-8", const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
325 static void* ReadBinaryFile(const char* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const char* mode = "rb", const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
326 static void* ReadBinaryFileW(const wchar_t* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const wchar_t* mode = L"rb, ccs=UTF-8", const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
327 static bool ReadTextFile(char* destination, const char* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const char* mode = "r", const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
328 static bool ReadTextFileW(wchar_t* destination, const wchar_t* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const wchar_t* mode = L"r, ccs=UTF-8", const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
329 static bool ReadBinaryFile(void* destination, const char* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const char* mode = "rb", const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
330 static bool ReadBinaryFileW(void* destination, const wchar_t* filePath, const size_t& numBytesToRead = 0, const size_t& maxBufferSize = MAX_STRING_BUFFER_SIZE, const wchar_t* mode = L"rb, ccs=UTF-8", const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
331 static double Remainder(const double& numerator, const double& denominator);
332 static float Remainder(const float& numerator, const float& denominator);
333 static int Remainder(const int& numerator, const int& denominator);
334 static long Remainder(const long& numerator, const long& denominator);
335 static double RemainderWithQuotient(const double& numerator, const double& denominator, int* outQuotient);
336 static float RemainderWithQuotient(const float& numerator, const float& denominator, int* outQuotient);
337 static int RemainderWithQuotient(const int& numerator, const int& denominator, int* outQuotient);
338 static long RemainderWithQuotient(const long& numerator, const long& denominator, int* outQuotient);
339 static char* RemoveAllWhitespace(const char* str);
340 static wchar_t* RemoveAllWhitespace(const wchar_t* str);
341 static void RemoveAllWhitespaceInPlace(char* str);
342 static void RemoveAllWhitespaceInPlace(wchar_t* str);
343 static char* RemoveCharactersFromString(const char* strToRemoveFrom, const char& charToRemove);
344 static wchar_t* RemoveCharactersFromString(const wchar_t* strToRemoveFrom, const wchar_t& charToRemove);
345 static void RemoveCharactersFromStringInPlace(char* strToRemoveFrom, const char& charToRemove);
346 static void RemoveCharactersFromStringInPlace(wchar_t* strToRemoveFrom, const wchar_t& charToRemove);
347 static char* RemoveStringFromString(const char* strToRemoveFrom, const char* strToRemove, const bool& removeOnlyFirstOccurrence = false);
348 static wchar_t* RemoveStringFromString(const wchar_t* strToRemoveFrom, const wchar_t* strToRemove, const bool& removeOnlyFirstOccurrence = false);
349 static void RemoveStringFromStringInPlace(char* strToRemoveFrom, const char* strToRemove, const bool& removeOnlyFirstOccurrence = false);
350 static void RemoveStringFromStringInPlace(wchar_t* strToRemoveFrom, const wchar_t* strToRemove, const bool& removeOnlyFirstOccurrence = false);
351 static char* ReplaceString(const char* strToSearch, const char* strToLookFor, const char* strToReplaceWith, const bool& removeOnlyFirstOccurrence = false);
352 static wchar_t* ReplaceString(const wchar_t* strToSearch, const wchar_t* strToLookFor, const wchar_t* strToReplaceWith, const bool& removeOnlyFirstOccurrence = false);
353 static bool ReplaceString(char* destination, const int& destinationLength, const char* strToSearch, const char* strToLookFor, const char* strToReplaceWith, const bool& removeOnlyFirstOccurrence = false);
354 static bool ReplaceString(wchar_t* destination, const int& destinationLength, const wchar_t* strToSearch, const wchar_t* strToLookFor, const wchar_t* strToReplaceWith, const bool& removeOnlyFirstOccurrence = false);
355 static char* RetrieveDataBetweenTags(const char* fileData, const char* startTag, const char* endTag);
356 static wchar_t* RetrieveDataBetweenTags(const wchar_t* fileData, const wchar_t* startTag, const wchar_t* endTag);
357 static char* RetrieveDataBetweenTags(const char* fileData, const int& startTagIndex, const int& endTagIndex);
358 static wchar_t* RetrieveDataBetweenTags(const wchar_t* fileData, const int& startTagIndex, const int& endTagIndex);
359 static bool RetrieveDataBetweenTags(char* destination, const char* fileData, const char* startTag, const char* endTag);
360 static bool RetrieveDataBetweenTags(wchar_t* destination, const wchar_t* fileData, const wchar_t* startTag, const wchar_t* endTag);
361 static bool RetrieveDataBetweenTags(char* destination, const char* fileData, const int& startTagIndex, const int& endTagIndex);
362 static bool RetrieveDataBetweenTags(wchar_t* destination, const wchar_t* fileData, const int& startTagIndex, const int& endTagIndex);
363 static char** RetrieveDataChunksBetweenTags(const char* fileData, const char* startTag, const char* endTag, int& outFinalBufferSize);
364 static wchar_t** RetrieveDataChunksBetweenTags(const wchar_t* fileData, const wchar_t* startTag, const wchar_t* endTag, int& outFinalBufferSize);
365 static bool RetrieveDataChunksBetweenTags(char** destination, const char* fileData, const char* startTag, const char* endTag);
366 static bool RetrieveDataChunksBetweenTags(wchar_t** destination, const wchar_t* fileData, const wchar_t* startTag, const wchar_t* endTag);
367 static vector<char*> RetrieveFileNames(const char* fullFilePath);
368 static vector<wchar_t*> RetrieveFileNames(const wchar_t* fullFilePath);
369 static vector<char*> RetrieveFolderNames(const char* fullFilePath);
370 static vector<wchar_t*> RetrieveFolderNames(const wchar_t* fullFilePath);
371 static bool RetrieveFileNames(vector<WIN32_FIND_DATAA>& destination, const char* fullFilePath);
372 static bool RetrieveFileNames(vector<WIN32_FIND_DATAW>& destination, const wchar_t* fullFilePath);
373 static bool RetrieveFolderNames(vector<WIN32_FIND_DATAA>& destination, const char* fullFilePath);
374 static bool RetrieveFolderNames(vector<WIN32_FIND_DATAW>& destination, const wchar_t* fullFilePath);
375 static char* ReverseString(const char* strToReverse);
376 static wchar_t* ReverseString(const wchar_t* strToReverse);
377 static void ReverseStringInPlace(char* strToReverse);
378 static void ReverseStringInPlace(wchar_t* strToReverse);
379 static long RoundToNearestInteger(const double& num);
380 static long RoundToNearestInteger(const float& num);
381 static long RoundToNearestInteger(const int& num);
382 static long RoundToNearestInteger(const long& num);
383 static long RoundUp(const double& num);
384 static long RoundUp(const float& num);
385 static long RoundUp(const int& num);
386 static long RoundUp(const long& num);
387 static void ShowMessageBox(const HWND& hWindow, const char* message, const char* title = "Error");
388 static void ShowMessageBox(const HWND& hWindow, const wchar_t* message, const wchar_t* title = L"Error");
389 static double Sin(const double& numInRadians);
390 static float Sin(const float& numInRadians);
391 static int Sin(const int& numInRadians);
392 static long Sin(const long& numInRadians);
393 static double SinH(const double& numInRadians);
394 static float SinH(const float& numInRadians);
395 static int SinH(const int& numInRadians);
396 static long SinH(const long& numInRadians);
397 static double Smallest(const double& numOne, const double& numTwo);
398 static float Smallest(const float& numOne, const float& numTwo);
399 static int Smallest(const int& numOne, const int& numTwo);
400 static long Smallest(const long& numOne, const long& numTwo);
401 static double SquareRoot(const double& num);
402 static float SquareRoot(const float& num);
403 static int SquareRoot(const int& num);
404 static long SquareRoot(const long& num);
405 static char* SubString(const char* str, const int& startIndex, const int& upToButNotIncludingIndex = INT_MAX);
406 static wchar_t* SubString(const wchar_t* str, const int& startIndex, const int& upToButNotIncludingIndex = INT_MAX);
407 static bool SubString(char* destination, const char* str, const int& startIndex, const int& upToButNotIncludingIndex = INT_MAX);
408 static bool SubString(wchar_t* destination, const wchar_t* str, const int& startIndex, const int& upToButNotIncludingIndex = INT_MAX);
409 static double Tan(const double& numInRadians);
410 static float Tan(const float& numInRadians);
411 static int Tan(const int& numInRadians);
412 static long Tan(const long& numInRadians);
413 static double TanH(const double& numInRadians);
414 static float TanH(const float& numInRadians);
415 static int TanH(const int& numInRadians);
416 static long TanH(const long& numInRadians);
417 static char** Tokenize(const char* strToTokenize, const char* delimiter, int& outNumTokensFound);
418 static wchar_t** Tokenize(const wchar_t* strToTokenize, const wchar_t* delimiter, int& outNumTokensFound);
419 static bool Tokenize(char** destination, const char* strToTokenize, const char* delimiter, int& outNumTokensFound);
420 static bool Tokenize(wchar_t** destination, const wchar_t* strToTokenize, const wchar_t* delimiter, int& outNumTokensFound);
421 static double Truncate(const double& num);
422 static float Truncate(const float& num);
423 static double TwoToTheXPower(const double& power);
424 static float TwoToTheXPower(const float& power);
425 static int TwoToTheXPower(const int& power);
426 static long TwoToTheXPower(const long& power);
427 static bool Validate(const HWND& hWnd, const HRESULT& result, const char* message, const char* title = "ERROR");
428 static bool Validate(const HWND& hWnd, const HRESULT& result, const wchar_t* message, const wchar_t* title = L"ERROR");
429 static size_t WriteTextFile(const char* filePath, const void* bufferToWrite, const size_t& bufferSize, const char* mode = "w", const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
430 static size_t WriteTextFileW(const wchar_t* filePath, const void* bufferToWrite, const size_t& bufferSize, const wchar_t* mode = L"w, ccs=UTF-8", const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
431 static size_t WriteBinaryFile(const char* filePath, const void* bufferToWrite, const size_t& bufferSize, const char* mode = "wb", const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
432 static size_t WriteBinaryFileW(const wchar_t* filePath, const void* bufferToWrite, const size_t& bufferSize, const wchar_t* mode = L"wb, ccs=UTF-8", const int& seekOffset = 0, const int& seekOrigin = SEEK_SET, long* outEndCursorPos = NULL);
433 static bool ZeroOutMemory(void* bufferToZero, const size_t& sizeOfBufferInBytes);
434};
static const size_t MAX_STRING_BUFFER_SIZE
Definition: Ace.h:31
static const size_t MAX_SEEDS
Definition: Ace.h:27
static const double PI
Definition: Ace.h:35
static const size_t BYTE_ALIGNMENT
Definition: Ace.h:23
Definition: Ace.h:49
static bool EqualsIgnoreCase(const char *strToCompOne, const char *strToCompTwo)
Compares two traditional strings together but ignores upper/lower case.
Definition: Ace.cpp:9232
static double Truncate(const double &num)
Removes everything after the decimal point.
Definition: Ace.cpp:24240
static double CosH(const double &numInRadians)
Calculates the CosH in compliance with CERT Coding Standard.
Definition: Ace.cpp:7978
static void ConvertToLowerCaseInPlace(char *str)
Directly modifies str to have all its letters converted to lower case.
Definition: Ace.cpp:7478
static char * GetHResultDescription(const HRESULT &result)
Gets the corresponding detailed description of the HRESULT.
Definition: Ace.cpp:10618
static float * ConvertStringToFloatArray(const char *strToConvert, const char *delimiter, int &outNumItems)
Converts a tokenized string (a string with commas separating numbers for example) to an array of floa...
Definition: Ace.cpp:6156
static bool IsFolder(const char *str)
Searches for a given folder path and checks if the file path is (points to) a folder or not.
Definition: Ace.cpp:12744
static bool IsEmpty(const char *str)
Searches a given string to see if it is all empty.
Definition: Ace.cpp:12560
static char * ReverseString(const char *strToReverse)
Creates a new string containing all the characters from strToReverse in reverse order.
Definition: Ace.cpp:21236
static bool Validate(const HWND &hWnd, const HRESULT &result, const char *message, const char *title="ERROR")
Returns false and displays an error window if result is an error (i.e.
Definition: Ace.cpp:24592
static bool IsPathADevice(const char *path)
Returns true if the provided path leads to a device rather than a file.
Definition: Ace.cpp:12968
static unsigned int ConvertStringToHex(const char *str)
Converts a string to its hex value.
Definition: Ace.cpp:6321
static void * _Aligned_Calloc(const size_t &size, const size_t &alignment=BYTE_ALIGNMENT)
Allocates a memory aligned buffer of specified size and zeros it out.
Definition: Ace.cpp:83
static wchar_t * ConvertLongToWideString(const long &longToConvert)
Returns a buffer containing the result of swprintf() using longToConvert.
Definition: Ace.cpp:5046
static long RoundToNearestInteger(const double &num)
Rounds the floating-point argument num to an integer value, using the current rounding mode.
Definition: Ace.cpp:21488
static void GetImageSize(const char *fileName, int *outWidth, int *outHeight)
Gets the pixel dimensions of the provided image (filePath).
Definition: Ace.cpp:10760
static double TanH(const double &numInRadians)
Calculates The Hyperbolic Tangent (TanH) of numInRadians in compliance with CERT Coding Standard.
Definition: Ace.cpp:23436
static wchar_t * GetHResultDescriptionW(const HRESULT &result)
Gets the corresponding detailed description of the HRESULT.
Definition: Ace.cpp:10687
static double LogBaseTen(const double &num)
Calculates the logarithm (log) base 10 of num in compliance with CERT Coding Standard.
Definition: Ace.cpp:13537
static double Hypotenuse(const double &x, const double &y)
Solves for c in Pythagoras theorem (a^2 + b^2 = c^2); i.e square root of (x^2 + y^2).
Definition: Ace.cpp:11190
static double Floor(const double &num)
Calculates the largest integer value not greater than num.
Definition: Ace.cpp:9863
static char * ReadTextFile(const char *filePath, const size_t &numBytesToRead=0, const size_t &maxBufferSize=MAX_STRING_BUFFER_SIZE, const char *mode="r", const int &seekOffset=0, const int &seekOrigin=SEEK_SET, long *outEndCursorPos=NULL)
Opens a file for reading and returns a char buffer containing some or all of the data in the file.
Definition: Ace.cpp:16420
static bool IsFile(const char *str)
Searches for a given file path and checks if the file path is (points to) a file or not.
Definition: Ace.cpp:12642
static double NumTimesTwoToTheXPower(const double &num, const double &power)
Calculates num * 2^power in compliance with CERT Coding Standard.
Definition: Ace.cpp:15423
static int ConvertStringToInteger(const char *str)
Converts a string to its integer value.
Definition: Ace.cpp:6504
static size_t WriteBinaryFileW(const wchar_t *filePath, const void *bufferToWrite, const size_t &bufferSize, const wchar_t *mode=L"wb, ccs=UTF-8", const int &seekOffset=0, const int &seekOrigin=SEEK_SET, long *outEndCursorPos=NULL)
Opens a file for writing and returns the number of items/elements written to the file.
Definition: Ace.cpp:25017
static char FirstChar(const char *str)
Returns the first character in str.
Definition: Ace.cpp:9782
static double GenerateRandomNum(const double &min, const double &max)
Some might think this is all unnecessary but I think it's important to seed the RandomNumberGenerator...
Definition: Ace.cpp:10361
static bool Contains(const char *strToSearch, const char *strToLookFor)
Searches strToSearch for the first occurrence of strToLookFor and returns true if found.
Definition: Ace.cpp:4481
static bool ConvertIntToBool(const int &num)
By definition, false is equal to 0 and true is equal to anything but 0.
Definition: Ace.cpp:4781
static double Tan(const double &numInRadians)
Calculates the Tangent (Tan) of numInRadians in compliance with CERT Coding Standard.
Definition: Ace.cpp:23196
static double Largest(const double &numOne, const double &numTwo)
Returns the larger of the two values.
Definition: Ace.cpp:13143
static double EToTheXPowerMinusOne(const double &power)
Calculates (e^x) - 1 in compliance with CERT Coding Standard.
Definition: Ace.cpp:9553
static char * ConvertStringHalfWidthToFullWidth(const char *halfWidthStr)
Converts a string containing "half width" characters to the corresponding "full width" characters.
Definition: Ace.cpp:5640
static vector< char * > RetrieveFolderNames(const char *fullFilePath)
Returns all the names of the sub-folder(s) in a folder.
Definition: Ace.cpp:20593
static int IndexOf(const char *strToSearch, const char &charToLookFor)
Searches strToSearch for the first occurrence of charToLookFor and returns the (0 based) index of its...
Definition: Ace.cpp:11431
static bool ConvertStringToBool(const char *str)
Converts a given string to a bool, If str is a string like "False", "FALSE", or "tRuE",...
Definition: Ace.cpp:5984
static char ** Tokenize(const char *strToTokenize, const char *delimiter, int &outNumTokensFound)
Breaks up a string and returns an array of all the strings between each delimiter.
Definition: Ace.cpp:23696
static void ConvertStringToOneLineInPlace(char *strToConvert)
Converts a traditional string to a traditional string that is all on one line, In other words; this f...
Definition: Ace.cpp:6752
static wchar_t * ReadTextFileW(const wchar_t *filePath, const size_t &numBytesToRead=0, const size_t &maxBufferSize=MAX_STRING_BUFFER_SIZE, const wchar_t *mode=L"r, ccs=UTF-8", const int &seekOffset=0, const int &seekOrigin=SEEK_SET, long *outEndCursorPos=NULL)
Opens a file for reading and returns a wide char buffer containing some or all of the data in the fil...
Definition: Ace.cpp:16481
static LONGLONG CalculateFileSize(const char *theFilePath)
Uses fseek() to calculate the size of the file by moving the file pointer to the end.
Definition: Ace.cpp:2286
static double Range(const double &inValue, const double &minInRange, const double &maxInRange, const double &minOutRange, const double &maxOutRange)
Takes the provided inValue with a range of minInRange to maxInRange, and maps the converted value bet...
Definition: Ace.cpp:16277
static void ConvertToUpperCaseInPlace(char *str)
Directly modifies str to have all its letters converted to upper case.
Definition: Ace.cpp:7650
static size_t WriteBinaryFile(const char *filePath, const void *bufferToWrite, const size_t &bufferSize, const char *mode="wb", const int &seekOffset=0, const int &seekOrigin=SEEK_SET, long *outEndCursorPos=NULL)
Opens a file for writing and returns the number of items/elements written to the file.
Definition: Ace.cpp:24931
static void GetLastWindowsError(wchar_t *outLastWindowsErrorMessage)
Definition: Ace.cpp:11121
static char * ConvertLongToString(const long &longToConvert)
Returns a buffer containing the result of snprintf() using integerToConvert.
Definition: Ace.cpp:4980
static double RemainderWithQuotient(const double &numerator, const double &denominator, int *outQuotient)
Calculates the floating-point remainder of the division operation numerator/denominator the same way ...
Definition: Ace.cpp:17495
static bool IsAlphabetic(const char &character)
Returns true if a character is a letter from either a to z or A to Z.
Definition: Ace.cpp:12417
static char * Concatenate(int numStrings,...)
Appends a series of strings together.
Definition: Ace.cpp:4233
static double Smallest(const double &numOne, const double &numTwo)
Calculates the smaller of the two values and returns the smaller one.
Definition: Ace.cpp:22510
static double NaturalLogGammaFunction(const double &num)
Calculates The Natural Log (ln) of The Gamma Function (ln | (0)integral(Inf)[t^num-1 * e^-t dt] |).
Definition: Ace.cpp:14860
static double TwoToTheXPower(const double &power)
Calculates 2^power in compliance with CERT Coding Standard.
Definition: Ace.cpp:24355
static double RadiansToDegrees(const double &radians)
Converts a number from radians to degrees.
Definition: Ace.cpp:16175
static double SinH(const double &numInRadians)
Calculates the SinH in compliance with CERT Coding Standard.
Definition: Ace.cpp:22275
static bool DoesFileExist(const char *fullFilePathWithNameAndExt)
Returns true if the specified file exists, false otherwise.
Definition: Ace.cpp:8843
static char * RemoveCharactersFromString(const char *strToRemoveFrom, const char &charToRemove)
Removes any occurrence of charToRemove from strToRemoveFrom.
Definition: Ace.cpp:18017
static void CalculateAspectRatio(const int &newWidth, const int &newHeight, const int &originalWidth, const int &originalHeight, int &outAdjustedWidth, int &outAdjustedHeight)
Adjusts the resolution to the correct aspect ratio for the destination.
Definition: Ace.cpp:2245
static void RemoveStringFromStringInPlace(char *strToRemoveFrom, const char *strToRemove, const bool &removeOnlyFirstOccurrence=false)
Removes the specified string (strToLookFor) by directly modifying strToSearch.
Definition: Ace.cpp:18411
static bool ChangeWindowsConsoleFont(const wchar_t *fontName, const wchar_t *locale, const UINT &fontFamily, const UINT &fontWeight, const SHORT &fontWidth, const SHORT &fontHeight, const DWORD &fontIndex=0)
Definition: Ace.cpp:2798
static bool IsNumber(const char *str)
Returns true if all characters are a digit.
Definition: Ace.cpp:12856
static double PositiveDifference(const double &numOne, const double &numTwo)
Calculates the difference between numOne and numTwo only if numOne > numTwo.
Definition: Ace.cpp:15662
static double Sin(const double &numInRadians)
Calculates the Sin in compliance with CERT Coding Standard.
Definition: Ace.cpp:22039
static double DegreesToRadians(const double &degrees)
Converts a number from degrees to radians.
Definition: Ace.cpp:8737
static double Power(const double &base, const double &exponent)
Takes the provided base and raises it to the exponent (power).
Definition: Ace.cpp:15905
static double ConvertStringToDouble(const char *str)
Converts a string to its double value.
Definition: Ace.cpp:6377
static double ArcCosH(const double &numInRadians)
Calculates the ArcCosH in compliance with CERT Coding Standard.
Definition: Ace.cpp:660
static size_t WriteTextFile(const char *filePath, const void *bufferToWrite, const size_t &bufferSize, const char *mode="w", const int &seekOffset=0, const int &seekOrigin=SEEK_SET, long *outEndCursorPos=NULL)
Opens a file for writing and returns the number of items/elements written to the file.
Definition: Ace.cpp:24696
static void ShowMessageBox(const HWND &hWindow, const char *message, const char *title="Error")
Displays a standard message box with a message, title, and an OK button.
Definition: Ace.cpp:21970
static char LastChar(const char *str)
Returns the last character in str.
Definition: Ace.cpp:13243
static int CountNumOccurrences(const char *strToSearch, const char &charToLookFor)
Counts the number of times charToLookFor appears in strToSearch.
Definition: Ace.cpp:8214
static double ArcTanH(const double &numInRadians)
Calculates the ArcTanH in compliance with CERT Coding Standard.
Definition: Ace.cpp:1688
static double Mod(const double &numerator, const double &denominator)
Computes the floating-point remainder of the division operation numerator/denominator in compliance w...
Definition: Ace.cpp:14075
static long ConvertStringToLong(const char *str)
Converts a string to its long integer value.
Definition: Ace.cpp:6558
static void RemoveAllWhitespaceInPlace(char *str)
Removes all whitespace from a given string in place.
Definition: Ace.cpp:17896
static void RemoveCharactersFromStringInPlace(char *strToRemoveFrom, const char &charToRemove)
Removes any occurrence of charToRemove from strToRemoveFrom.
Definition: Ace.cpp:18153
static void * _Aligned_Malloc(const size_t &size, const size_t &alignment=BYTE_ALIGNMENT)
Allocates a memory aligned buffer of specified size.
Definition: Ace.cpp:35
static char * RemoveAllWhitespace(const char *str)
Removes all whitespace from a given string.
Definition: Ace.cpp:17762
static char * ConvertStringToOneLine(const char *strToConvert)
Converts a traditional string to a traditional string that is all on one line, In other words; this f...
Definition: Ace.cpp:6651
static double ArcSinH(const double &numInRadians)
Calculates the ArcSinH in compliance with CERT Coding Standard.
Definition: Ace.cpp:1215
static void ReverseStringInPlace(char *strToReverse)
Directly modifies strToReverse to have all its characters in reverse order.
Definition: Ace.cpp:21370
static double GammaFunction(const double &num)
Calculates The Gamma Function ( (0)integral(Inf)[t^num-1 * e^-t dt] ) in compliance with CERT Coding ...
Definition: Ace.cpp:10101
static double AbsoluteValue(const double &num)
Calculates the absolute value of a number in compliance with CERT Coding Standard.
Definition: Ace.cpp:118
static char * AllocateAndCopyString(const char *strToCopy)
Allocates a buffer and copies a provided traditional string into the buffer.
Definition: Ace.cpp:223
static bool ConvertLongToBool(const long &num)
By definition, false is equal to 0 and true is equal to anything but 0.
Definition: Ace.cpp:4943
static char ConvertToUpperCase(const char &character)
Converts a character to uppercase.
Definition: Ace.cpp:7340
static char * SubString(const char *str, const int &startIndex, const int &upToButNotIncludingIndex=INT_MAX)
Returns a string containing the characters between startIndex and upToButNotIncludingIndex.
Definition: Ace.cpp:22806
static int IndexOfFirstLetter(const char *strToSearch)
Returns the first index of a letter in a given string.
Definition: Ace.cpp:11760
static bool ConvertFloatToBool(const float &num)
By definition, false is equal to 0 and true is equal to anything but 0.
Definition: Ace.cpp:4743
static bool IsDigit(const char &character)
Returns true if a character is a digit from 0-9.
Definition: Ace.cpp:12492
static char * ConcatenateStrings(const int &numStrings, char **stringArray)
Appends an array of strings together and returns the combined string.
Definition: Ace.cpp:3382
static float ConvertStringToFloat(const char *str)
Converts a string to its float value.
Definition: Ace.cpp:6450
static int IndexOfIgnoreCase(const char *strToSearch, const char &charToLookFor)
Searches strToSearch for the first occurrence of charToLookFor (regardless of case) and returns the (...
Definition: Ace.cpp:11856
static bool IsWhitespace(const char &character)
Returns true if a character is whitespace.
Definition: Ace.cpp:13092
static char ** RetrieveDataChunksBetweenTags(const char *fileData, const char *startTag, const char *endTag, int &outFinalBufferSize)
Finds a series of XML data between startTag and endTag.
Definition: Ace.cpp:19842
static double MultiplyThenAdd(const double &multOne, const double &multTwo, const double &add)
Calculates the product of multOne * multTwo, then adds add to that product (i.e.
Definition: Ace.cpp:14347
static double Cos(const double &numInRadians)
Calculates the Cosine (cos) of numInRadians in compliance with CERT Coding Standard.
Definition: Ace.cpp:7739
static bool ConvertDoubleToBool(const double &num)
By definition, false is equal to 0 and true is equal to anything but 0.
Definition: Ace.cpp:4705
static vector< char * > RetrieveFileNames(const char *fullFilePath)
Returns all the names of the files inside a folder, Ignores non files like folders.
Definition: Ace.cpp:20385
static bool Equals(const char *strToCompOne, const char *strToCompTwo)
Compares two traditional strings together.
Definition: Ace.cpp:9160
static void * ReadBinaryFile(const char *filePath, const size_t &numBytesToRead=0, const size_t &maxBufferSize=MAX_STRING_BUFFER_SIZE, const char *mode="rb", const int &seekOffset=0, const int &seekOrigin=SEEK_SET, long *outEndCursorPos=NULL)
Opens a file for reading and returns a char buffer containing some or all of the data in the file.
Definition: Ace.cpp:16580
static bool ContainsIgnoreCase(const char *strToSearch, const char *strToLookFor)
Searches strToSearch for the first occurrence of strToLookFor (regardless of case) and returns true i...
Definition: Ace.cpp:4597
static double Ceiling(const double &num)
Calculates the smallest integer value greater than or equal to num.
Definition: Ace.cpp:2509
static char * ConvertStringFullWidthToHalfWidth(const char *fullWidthStr)
Converts a string containing "full width" characters to the corresponding "half width" characters.
Definition: Ace.cpp:5252
static double LogBaseTwo(const double &num)
Calculates the logarithm (log) base 2 of num in compliance with CERT Coding Standard.
Definition: Ace.cpp:13805
static int NextIndexOf(const char *strToSearch, const char &charToLookFor, const int &startIndex)
Retrieves the first occurrence of charToLookFor in strToSearch starting at startIndex onward.
Definition: Ace.cpp:15130
static double ArcTan2(const double &yInRadians, const double &xInRadians)
Calculates the ArcTan2 in compliance with CERT Coding Standard.
Definition: Ace.cpp:1968
static vector< char * > ConvertStringArrayToStringVectorArray(char **stringArray)
Converts a traditional string array to a vector string array.
Definition: Ace.cpp:5127
static char ConvertToLowerCase(const char &character)
Converts a character to lowercase.
Definition: Ace.cpp:7296
static double NaturalLog(const double &num)
Calculates the Natural Logarithm (ln) of num in compliance with CERT Coding Standard.
Definition: Ace.cpp:14591
static char * RetrieveDataBetweenTags(const char *fileData, const char *startTag, const char *endTag)
Finds the XML data between the startTag and endTag and returns it.
Definition: Ace.cpp:19137
static char * ReplaceString(const char *strToSearch, const char *strToLookFor, const char *strToReplaceWith, const bool &removeOnlyFirstOccurrence=false)
Inserts strToReplaceWith in the position strToLookFor is located, then strToLookFor is removed.
Definition: Ace.cpp:18662
static long RoundUp(const double &num)
Calculates the nearest integer value to num (in integer format), rounding halfway cases away from zer...
Definition: Ace.cpp:21730
static double SquareRoot(const double &num)
Returns the Square Root of the provided number.
Definition: Ace.cpp:22634
static char CharAt(const char *str, const int &index)
Returns a single character in str at a specified index.
Definition: Ace.cpp:2888
static double CubeRoot(const double &num)
Calculates the Cube Root in compliance with CERT Coding Standard.
Definition: Ace.cpp:8516
static int LastIndexOf(const char *strToSearch, const char *strToLookFor)
Searches strToSearch for the last occurrence of strToLookFor and returns the (0 based) index of its l...
Definition: Ace.cpp:13336
static bool ZeroOutMemory(void *bufferToZero, const size_t &sizeOfBufferInBytes)
Assigns 0 to every slot in the buffer (aka Zeroing out the memory) in compliance with CERT Coding Sta...
Definition: Ace.cpp:25058
static wchar_t * ConvertStringToWCharString(const char *strToConvert)
Converts a traditional string to a wide string.
Definition: Ace.cpp:6831
static double ArcTan(const double &numInRadians)
Calculates the ArcTan in compliance with CERT Coding Standard.
Definition: Ace.cpp:1451
static int CalculateNumLength(const int &num)
Counts the number of digits of num.
Definition: Ace.cpp:2395
static double ErrorFunction(const double &num)
Calculates the Error Function integral from 0 to num in compliance with CERT Coding Standard.
Definition: Ace.cpp:8927
static double ComplementaryErrorFunction(const double &num)
Calculates the Complementary Error Function integral from num to infinity in compliance with CERT Cod...
Definition: Ace.cpp:3139
static char * InsertString(const char *strToReceive, const char *strToInsert, const int &startIndex)
Inserts the string strToInsert into strToRevcive by "sandwiching" the two halves of strToReceive.
Definition: Ace.cpp:12068
static char ** ConvertStringVectorArrayToStringArray(const vector< const char * > &stringVectorArray, int &outStringArrayLength)
Converts a string vector array to a traditional string array.
Definition: Ace.cpp:6904
static char * ConvertIntToString(const int &integerToConvert)
Returns a buffer containing the result of _itoa_s() using integerToConvert.
Definition: Ace.cpp:4818
static void * ReadBinaryFileW(const wchar_t *filePath, const size_t &numBytesToRead=0, const size_t &maxBufferSize=MAX_STRING_BUFFER_SIZE, const wchar_t *mode=L"rb, ccs=UTF-8", const int &seekOffset=0, const int &seekOrigin=SEEK_SET, long *outEndCursorPos=NULL)
Opens a file for reading and returns a wide char buffer containing some or all of the data in the fil...
Definition: Ace.cpp:16667
static double Remainder(const double &numerator, const double &denominator)
Calculates the Computes The IEEE remainder of the floating point division operation numerator/denomin...
Definition: Ace.cpp:17221
static wchar_t * ConvertIntToWideString(const int &integerToConvert)
Returns a buffer containing the result of _itow_s() using integerToConvert.
Definition: Ace.cpp:4880
static char * RemoveStringFromString(const char *strToRemoveFrom, const char *strToRemove, const bool &removeOnlyFirstOccurrence=false)
Removes the specified string (strToLookFor) from strToSearch and returns a newly allocated buffer con...
Definition: Ace.cpp:18284
static void GetImageSizeW(const wchar_t *fileName, int *outWidth, int *outHeight)
Gets the pixel dimensions of the provided image (filePath).
Definition: Ace.cpp:10955
static double ArcSin(const double &numInRadians)
Calculates the ArcSin in compliance with CERT Coding Standard.
Definition: Ace.cpp:934
static wchar_t * ConcatenateW(int numWideStrings,...)
Appends a series of strings together.
Definition: Ace.cpp:4296
static double EToTheXPower(const double &power)
Calculates e^x in compliance with CERT Coding Standard.
Definition: Ace.cpp:9325
static double ArcCos(const double &numInRadians)
Calculates the ArcCos in compliance with CERT Coding Standard.
Definition: Ace.cpp:382
static size_t WriteTextFileW(const wchar_t *filePath, const void *bufferToWrite, const size_t &bufferSize, const wchar_t *mode=L"w, ccs=UTF-8", const int &seekOffset=0, const int &seekOrigin=SEEK_SET, long *outEndCursorPos=NULL)
Opens a file for writing and returns the number of items/elements written to the file.
Definition: Ace.cpp:24796
static int Clamp(const int &numToClamp, const int &min, const int &max)
Returns a value between min and max inclusive.
Definition: Ace.cpp:2991