AceLinux 2.0
A library of wicked convenience functions for Linux.
Ace Class Reference

#include <Ace.h>

Static Public Member Functions

static void * _Aligned_Malloc (const size_t &size, const size_t &alignment=BYTE_ALIGNMENT)
 Allocates a memory aligned buffer of specified size. More...
 
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. More...
 
static double AbsoluteValue (const double &num)
 Calculates the absolute value of a number in compliance with CERT Coding Standard. More...
 
static float AbsoluteValue (const float &num)
 Calculates the absolute value of a number in compliance with CERT Coding Standard. More...
 
static int AbsoluteValue (const int &num)
 Calculates the absolute value of a number in compliance with CERT Coding Standard. More...
 
static long AbsoluteValue (const long &num)
 Calculates the absolute value of a number in compliance with CERT Coding Standard. More...
 
static char * AllocateAndCopyString (const char *strToCopy)
 Allocates a buffer and copies a provided traditional string into the buffer. More...
 
static wchar_t * AllocateAndCopyString (const wchar_t *wideStrToCopy)
 Allocates a buffer and copies a provided traditional wide string into the buffer. More...
 
static double ArcCos (const double &numInRadians)
 Calculates the ArcCos in compliance with CERT Coding Standard. More...
 
static float ArcCos (const float &numInRadians)
 Calculates the ArcCos in compliance with CERT Coding Standard. More...
 
static int ArcCos (const int &numInRadians)
 Calculates the ArcCos in compliance with CERT Coding Standard. More...
 
static long ArcCos (const long &numInRadians)
 Calculates the ArcCos in compliance with CERT Coding Standard. More...
 
static double ArcCosH (const double &numInRadians)
 Calculates the ArcCosH in compliance with CERT Coding Standard. More...
 
static float ArcCosH (const float &numInRadians)
 Calculates the ArcCosH in compliance with CERT Coding Standard. More...
 
static int ArcCosH (const int &numInRadians)
 Calculates the ArcCosH in compliance with CERT Coding Standard. More...
 
static long ArcCosH (const long &numInRadians)
 Calculates the ArcCosH in compliance with CERT Coding Standard. More...
 
static double ArcSin (const double &numInRadians)
 Calculates the ArcSin in compliance with CERT Coding Standard. More...
 
static float ArcSin (const float &numInRadians)
 Calculates the ArcSin in compliance with CERT Coding Standard. More...
 
static int ArcSin (const int &numInRadians)
 Calculates the ArcSin in compliance with CERT Coding Standard. More...
 
static long ArcSin (const long &numInRadians)
 Calculates the ArcSin in compliance with CERT Coding Standard. More...
 
static double ArcSinH (const double &numInRadians)
 Calculates the ArcSinH in compliance with CERT Coding Standard. More...
 
static float ArcSinH (const float &numInRadians)
 Calculates the ArcSinH in compliance with CERT Coding Standard. More...
 
static int ArcSinH (const int &numInRadians)
 Calculates the ArcSinH in compliance with CERT Coding Standard. More...
 
static long ArcSinH (const long &numInRadians)
 Calculates the ArcSinH in compliance with CERT Coding Standard. More...
 
static double ArcTan (const double &numInRadians)
 Calculates the ArcTan in compliance with CERT Coding Standard. More...
 
static float ArcTan (const float &numInRadians)
 Calculates the ArcTan in compliance with CERT Coding Standard. More...
 
static int ArcTan (const int &numInRadians)
 Calculates the ArcTan in compliance with CERT Coding Standard. More...
 
static long ArcTan (const long &numInRadians)
 Calculates the ArcTan in compliance with CERT Coding Standard. More...
 
static double ArcTanH (const double &numInRadians)
 Calculates the ArcTanH in compliance with CERT Coding Standard. More...
 
static float ArcTanH (const float &numInRadians)
 Calculates the ArcTanH in compliance with CERT Coding Standard. More...
 
static int ArcTanH (const int &numInRadians)
 Calculates the ArcTanH in compliance with CERT Coding Standard. More...
 
static long ArcTanH (const long &numInRadians)
 Calculates the ArcTanH in compliance with CERT Coding Standard. More...
 
static double ArcTan2 (const double &yInRadians, const double &xInRadians)
 Calculates the ArcTan2 in compliance with CERT Coding Standard. More...
 
static float ArcTan2 (const float &yInRadians, const float &xInRadians)
 Calculates the ArcTan2 in compliance with CERT Coding Standard. More...
 
static int ArcTan2 (const int &yInRadians, const int &xInRadians)
 Calculates the ArcTan2 in compliance with CERT Coding Standard. More...
 
static long ArcTan2 (const long &yInRadians, const long &xInRadians)
 Calculates the ArcTan2 in compliance with CERT Coding Standard. More...
 
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. More...
 
static LONGLONG CalculateFileSize (const char *theFilePath)
 Uses fseek() to calculate the size of the file by moving the file pointer to the end. More...
 
static LONGLONG CalculateFileSize (const wchar_t *theFilePath)
 Gets the size of the file in compliance with CERT Coding Standard. More...
 
static int CalculateNumLength (const int &num)
 Counts the number of digits of num. More...
 
static long CalculateNumLength (const long &num)
 Counts the number of digits of num. More...
 
static double Ceiling (const double &num)
 Calculates the smallest integer value greater than or equal to num. More...
 
static float Ceiling (const float &num)
 Calculates the smallest integer value greater than or equal to num. More...
 
static int Ceiling (const int &num)
 Calculates the smallest integer value greater than or equal to num. More...
 
static long Ceiling (const long &num)
 Calculates the smallest integer value greater than or equal to num. More...
 
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)
 
static char CharAt (const char *str, const int &index)
 Returns a single character in str at a specified index. More...
 
static wchar_t CharAt (const wchar_t *str, const int &index)
 Returns a single character in str at a specified index. More...
 
static int Clamp (const int &numToClamp, const int &min, const int &max)
 Returns a value between min and max inclusive. More...
 
static long Clamp (const long &numToClamp, const long &min, const long &max)
 Returns a value between min and max inclusive. More...
 
static double Clamp (const double &numToClamp, const double &min, const double &max)
 Returns a value between min and max inclusive. More...
 
static float Clamp (const float &numToClamp, const float &min, const float &max)
 Returns a value between min and max inclusive. More...
 
static double ComplementaryErrorFunction (const double &num)
 Calculates the Complementary Error Function integral from num to infinity in compliance with CERT Coding Standard. More...
 
static float ComplementaryErrorFunction (const float &num)
 Calculates the Complementary Error Function integral from num to infinity in compliance with CERT Coding Standard. More...
 
static int ComplementaryErrorFunction (const int &num)
 Calculates the Complementary Error Function integral from num to infinity in compliance with CERT Coding Standard. More...
 
static long ComplementaryErrorFunction (const long &num)
 Calculates the Complementary Error Function integral from num to infinity in compliance with CERT Coding Standard. More...
 
static char * ConcatenateStrings (const int &numStrings, char **stringArray)
 Appends an array of strings together and returns the combined string. More...
 
static wchar_t * ConcatenateStrings (const int &numStrings, wchar_t **stringArray)
 Appends an array of strings together and returns the combined string. More...
 
static char * ConcatenateStrings (const vector< const char * > &stringVectorArray)
 Appends a vector array of strings together and returns the combined string. More...
 
static wchar_t * ConcatenateStrings (const vector< const wchar_t * > &stringVectorArray)
 Appends a vector array of wide strings together and returns the combined wide string. More...
 
static bool ConcatenateStrings (char *destination, const int &numStrings, const char **stringArray)
 Appends an array of strings together and stores it in the provided destination buffer. More...
 
static bool ConcatenateStrings (wchar_t *destination, const int &numStrings, const wchar_t **stringArray)
 Appends an array of strings together and stores it in the provided destination buffer. More...
 
static bool ConcatenateStrings (char *destination, const vector< const char * > &stringVectorArray)
 Appends a vector array of strings together and stores the result in the provided destination buffer. More...
 
static bool ConcatenateStrings (wchar_t *destination, const vector< const wchar_t * > &stringVectorArray)
 Appends a vector array of wide strings together and returns the combined wide string. More...
 
static char * Concatenate (int numStrings,...)
 Appends a series of strings together. More...
 
static wchar_t * ConcatenateW (int numWideStrings,...)
 Appends a series of strings together. More...
 
static bool Concatenate (char *destination, int numStrings,...)
 Appends a series of strings together. More...
 
static bool ConcatenateW (wchar_t *destination, int numWideStrings,...)
 Appends a series of strings together. More...
 
static bool Contains (const char *strToSearch, const char *strToLookFor)
 Searches strToSearch for the first occurrence of strToLookFor and returns true if found. More...
 
static bool Contains (const wchar_t *strToSearch, const wchar_t *strToLookFor)
 Searches strToSearch for the first occurrence of strToLookFor and returns true if found. More...
 
static bool ContainsIgnoreCase (const char *strToSearch, const char *strToLookFor)
 Searches strToSearch for the first occurrence of strToLookFor (regardless of case) and returns true if found. More...
 
static bool ContainsIgnoreCase (const wchar_t *strToSearch, const wchar_t *strToLookFor)
 Searches strToSearch for the first occurrence of strToLookFor (regardless of case) and returns true if found. More...
 
static bool ConvertDoubleToBool (const double &num)
 By definition, false is equal to 0 and true is equal to anything but 0. More...
 
static bool ConvertFloatToBool (const float &num)
 By definition, false is equal to 0 and true is equal to anything but 0. More...
 
static bool ConvertIntToBool (const int &num)
 By definition, false is equal to 0 and true is equal to anything but 0. More...
 
static char * ConvertIntToString (const int &integerToConvert)
 Returns a buffer containing the result of _itoa_s() using integerToConvert. More...
 
static wchar_t * ConvertIntToWideString (const int &integerToConvert)
 Returns a buffer containing the result of _itow_s() using integerToConvert. More...
 
static bool ConvertLongToBool (const long &num)
 By definition, false is equal to 0 and true is equal to anything but 0. More...
 
static char * ConvertLongToString (const long &longToConvert)
 Returns a buffer containing the result of snprintf() using integerToConvert. More...
 
static wchar_t * ConvertLongToWideString (const long &longToConvert)
 Returns a buffer containing the result of swprintf() using longToConvert. More...
 
static vector< char * > ConvertStringArrayToStringVectorArray (char **stringArray)
 Converts a traditional string array to a vector string array. More...
 
static vector< wchar_t * > ConvertStringArrayToStringVectorArray (wchar_t **stringArray)
 Converts a traditional wide string array to a vector wide string array. More...
 
static char * ConvertStringFullWidthToHalfWidth (const char *fullWidthStr)
 Converts a string containing "full width" characters to the corresponding "half width" characters. More...
 
static wchar_t * ConvertStringFullWidthToHalfWidth (const wchar_t *fullWidthStr)
 Converts a string containing "full width" characters to the corresponding "half width" characters. More...
 
static bool ConvertStringFullWidthToHalfWidth (const char *fullWidthStr, char *outHalfWidthStr)
 Converts a string containing "full width" characters to the corresponding "half width" characters. More...
 
static bool ConvertStringFullWidthToHalfWidth (const wchar_t *fullWidthStr, wchar_t *outHalfWidthStr)
 Converts a string containing "full width" characters to the corresponding "half width" characters. More...
 
static char * ConvertStringHalfWidthToFullWidth (const char *halfWidthStr)
 Converts a string containing "half width" characters to the corresponding "full width" characters. More...
 
static wchar_t * ConvertStringHalfWidthToFullWidth (const wchar_t *halfWidthStr)
 Converts a string containing "half width" characters to the corresponding "full width" characters. More...
 
static bool ConvertStringHalfWidthToFullWidth (const char *halfWidthStr, char *outFullWidthStr)
 Converts a string containing "half width" characters to the corresponding "full width" characters. More...
 
static bool ConvertStringHalfWidthToFullWidth (const wchar_t *halfWidthStr, wchar_t *outFullWidthStr)
 Converts a string containing "half width" characters to the corresponding "full width" characters. More...
 
static bool ConvertStringToBool (const char *str)
 Converts a given string to a bool, If str is a string like "False", "FALSE", or "tRuE", then the function will return false, false, true respectively. More...
 
static bool ConvertStringToBool (const wchar_t *str)
 Converts a given wide string to a bool, If str is a wide string like "False", "FALSE", or "tRuE", then the function will return false, false, true respectively. More...
 
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 floats. More...
 
static float * ConvertStringToFloatArray (const wchar_t *strToConvert, const wchar_t *delimiter, int &outNumItems)
 Converts a tokenized wide string (a string with commas separating numbers for example) to an array of floats. More...
 
static unsigned int ConvertStringToHex (const char *str)
 Converts a string to its hex value. More...
 
static unsigned int ConvertStringToHex (const wchar_t *str)
 Converts a string to its hex value. More...
 
static double ConvertStringToDouble (const char *str)
 Converts a string to its double value. More...
 
static double ConvertStringToDouble (const wchar_t *str)
 Converts a string to its double value. More...
 
static float ConvertStringToFloat (const char *str)
 Converts a string to its float value. More...
 
static float ConvertStringToFloat (const wchar_t *str)
 Converts a string to its float value. More...
 
static int ConvertStringToInteger (const char *str)
 Converts a string to its integer value. More...
 
static int ConvertStringToInteger (const wchar_t *str)
 Converts a string to its integer value. More...
 
static long ConvertStringToLong (const char *str)
 Converts a string to its long integer value. More...
 
static long ConvertStringToLong (const wchar_t *str)
 Converts a string to its long integer value. More...
 
static char * ConvertStringToOneLine (const char *strToConvert)
 Converts a traditional string to a traditional string that is all on one line, In other words; this function removes any occurrence of
from stringToConvert. More...
 
static wchar_t * ConvertStringToOneLine (const wchar_t *strToConvert)
 Converts a traditional wide string to a traditional wide string that is all on one line, In other words; this function removes any occurrence of
from stringToConvert. More...
 
static void ConvertStringToOneLineInPlace (char *strToConvert)
 Converts a traditional string to a traditional string that is all on one line, In other words; this function removes any occurrence of
from stringToConvert. More...
 
static void ConvertStringToOneLineInPlace (wchar_t *strToConvert)
 Converts a traditional wide string to a traditional wide string that is all on one line, In other words; this function removes any occurrence of
from stringToConvert. More...
 
static wchar_t * ConvertStringToWCharString (const char *strToConvert)
 Converts a traditional string to a wide string. More...
 
static char ** ConvertStringVectorArrayToStringArray (const vector< const char * > &stringVectorArray, int &outStringArrayLength)
 Converts a string vector array to a traditional string array. More...
 
static wchar_t ** ConvertStringVectorArrayToStringArray (const vector< const wchar_t * > &stringVectorArray, int &outStringArrayLength)
 Converts a wide string vector array to a traditional wide string array. More...
 
static bool ConvertStringVectorArrayToStringArray (char **destinationStrArray, const vector< const char * > &stringVectorArray, int &outStringArrayLength)
 Converts a string vector array to a traditional string array. More...
 
static bool ConvertStringVectorArrayToStringArray (wchar_t **destinationStrArray, const vector< const wchar_t * > &stringVectorArray, int &outStringArrayLength)
 Converts a string vector array to a traditional string array. More...
 
static char ConvertToLowerCase (const char &character)
 Converts a character to lowercase. More...
 
static wchar_t ConvertToLowerCase (const wchar_t &character)
 Converts a wide character to lowercase. More...
 
static char ConvertToUpperCase (const char &character)
 Converts a character to uppercase. More...
 
static wchar_t ConvertToUpperCase (const wchar_t &character)
 Converts a wide character to uppercase. More...
 
static char * ConvertToLowerCase (const char *str)
 Converts a string to all lowercase letters. More...
 
static wchar_t * ConvertToLowerCase (const wchar_t *str)
 Converts a wide string to all lowercase letters. More...
 
static void ConvertToLowerCaseInPlace (char *str)
 Directly modifies str to have all its letters converted to lower case. More...
 
static void ConvertToLowerCaseInPlace (wchar_t *str)
 Directly modifies str to have all its letters converted to lower case. More...
 
static char * ConvertToUpperCase (const char *str)
 Converts a string to all uppercase letters. More...
 
static wchar_t * ConvertToUpperCase (const wchar_t *str)
 Converts a string to all uppercase letters. More...
 
static void ConvertToUpperCaseInPlace (char *str)
 Directly modifies str to have all its letters converted to upper case. More...
 
static void ConvertToUpperCaseInPlace (wchar_t *str)
 Directly modifies str to have all its letters converted to upper case. More...
 
static double Cos (const double &numInRadians)
 Calculates the Cosine (cos) of numInRadians in compliance with CERT Coding Standard. More...
 
static float Cos (const float &numInRadians)
 Calculates the Cosine (cos) of numInRadians in compliance with CERT Coding Standard. More...
 
static int Cos (const int &numInRadians)
 Calculates the Cosine (cos) of numInRadians in compliance with CERT Coding Standard. More...
 
static long Cos (const long &numInRadians)
 Calculates the Cosine (cos) of numInRadians in compliance with CERT Coding Standard. More...
 
static double CosH (const double &numInRadians)
 Calculates the CosH in compliance with CERT Coding Standard. More...
 
static float CosH (const float &numInRadians)
 Calculates the CosH in compliance with CERT Coding Standard. More...
 
static int CosH (const int &numInRadians)
 Calculates the CosH in compliance with CERT Coding Standard. More...
 
static long CosH (const long &numInRadians)
 Calculates the CosH in compliance with CERT Coding Standard. More...
 
static int CountNumOccurrences (const char *strToSearch, const char &charToLookFor)
 Counts the number of times charToLookFor appears in strToSearch. More...
 
static int CountNumOccurrences (const wchar_t *strToSearch, const wchar_t &charToLookFor)
 Counts the number of times charToLookFor appears in strToSearch. More...
 
static int CountNumOccurrences (const char *strToSearch, const char *strToLookFor)
 Counts the number of times strToLookFor appears in strToSearch. More...
 
static int CountNumOccurrences (const wchar_t *strToSearch, const wchar_t *strToLookFor)
 Counts the number of times strToLookFor appears in strToSearch. More...
 
static double CubeRoot (const double &num)
 Calculates the Cube Root in compliance with CERT Coding Standard. More...
 
static float CubeRoot (const float &num)
 Calculates the Cube Root in compliance with CERT Coding Standard. More...
 
static int CubeRoot (const int &num)
 Calculates the Cube Root in compliance with CERT Coding Standard. More...
 
static long CubeRoot (const long &num)
 Calculates the Cube Root in compliance with CERT Coding Standard. More...
 
static double DegreesToRadians (const double &degrees)
 Converts a number from degrees to radians. More...
 
static float DegreesToRadians (const float &degrees)
 Converts a number from degrees to radians. More...
 
static int DegreesToRadians (const int &degrees)
 Converts a number from degrees to radians. More...
 
static long DegreesToRadians (const long &degrees)
 Converts a number from degrees to radians. More...
 
static bool DoesFileExist (const char *fullFilePathWithNameAndExt)
 Returns true if the specified file exists, false otherwise. More...
 
static bool DoesFileExist (const wchar_t *fullFilePathWithNameAndExt)
 Returns true if the specified file exists, false otherwise. More...
 
static double ErrorFunction (const double &num)
 Calculates the Error Function integral from 0 to num in compliance with CERT Coding Standard. More...
 
static float ErrorFunction (const float &num)
 Calculates the Error Function integral from 0 to num in compliance with CERT Coding Standard. More...
 
static int ErrorFunction (const int &num)
 Calculates the Error Function integral from 0 to num in compliance with CERT Coding Standard. More...
 
static long ErrorFunction (const long &num)
 Calculates the Error Function integral from 0 to num in compliance with CERT Coding Standard. More...
 
static bool Equals (const char *strToCompOne, const char *strToCompTwo)
 Compares two traditional strings together. More...
 
static bool Equals (const wchar_t *strToCompOne, const wchar_t *strToCompTwo)
 Compares two traditional wide strings together. More...
 
static bool EqualsIgnoreCase (const char *strToCompOne, const char *strToCompTwo)
 Compares two traditional strings together but ignores upper/lower case. More...
 
static bool EqualsIgnoreCase (const wchar_t *strToCompOne, const wchar_t *strToCompTwo)
 Compares two traditional wide strings together but ignores upper/lower case. More...
 
static double EToTheXPower (const double &power)
 Calculates e^x in compliance with CERT Coding Standard. More...
 
static float EToTheXPower (const float &power)
 Calculates e^x in compliance with CERT Coding Standard. More...
 
static int EToTheXPower (const int &power)
 Calculates e^x in compliance with CERT Coding Standard. More...
 
static long EToTheXPower (const long &power)
 Calculates e^x in compliance with CERT Coding Standard. More...
 
static double EToTheXPowerMinusOne (const double &power)
 Calculates (e^x) - 1 in compliance with CERT Coding Standard. More...
 
static float EToTheXPowerMinusOne (const float &power)
 Calculates (e^x) - 1 in compliance with CERT Coding Standard. More...
 
static int EToTheXPowerMinusOne (const int &power)
 Calculates (e^x) - 1 in compliance with CERT Coding Standard. More...
 
static long EToTheXPowerMinusOne (const long &power)
 Calculates (e^x) - 1 in compliance with CERT Coding Standard. More...
 
static char FirstChar (const char *str)
 Returns the first character in str. More...
 
static wchar_t FirstChar (const wchar_t *str)
 Returns the first character in str. More...
 
static double Floor (const double &num)
 Calculates the largest integer value not greater than num. More...
 
static float Floor (const float &num)
 Calculates the largest integer value not greater than num. More...
 
static int Floor (const int &num)
 Calculates the largest integer value not greater than num. More...
 
static long Floor (const long &num)
 Calculates the largest integer value not greater than num. More...
 
static double GammaFunction (const double &num)
 Calculates The Gamma Function ( (0)integral(Inf)[t^num-1 * e^-t dt] ) in compliance with CERT Coding Standard. More...
 
static float GammaFunction (const float &num)
 Calculates The Gamma Function ( (0)integral(Inf)[t^num-1 * e^-t dt] ) in compliance with CERT Coding Standard. More...
 
static int GammaFunction (const int &num)
 Calculates The Gamma Function ( (0)integral(Inf)[t^num-1 * e^-t dt] ) in compliance with CERT Coding Standard. More...
 
static long GammaFunction (const long &num)
 Calculates The Gamma Function ( (0)integral(Inf)[t^num-1 * e^-t dt] ) in compliance with CERT Coding Standard. More...
 
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 properly with a proper seed value. More...
 
static float GenerateRandomNum (const float &min, const float &max)
 Some might think this is all unnecessary but I think it's important to seed the RandomNumberGenerator properly with a proper seed value. More...
 
static int GenerateRandomNum (const int &min, const int &max)
 Some might think this is all unnecessary but I think it's important to seed the RandomNumberGenerator properly with a proper seed value. More...
 
static long GenerateRandomNum (const long &min, const long &max)
 Some might think this is all unnecessary but I think it's important to seed the RandomNumberGenerator properly with a proper seed value. More...
 
static char * GetHResultDescription (const HRESULT &result)
 Gets the corresponding detailed description of the HRESULT. More...
 
static wchar_t * GetHResultDescriptionW (const HRESULT &result)
 Gets the corresponding detailed description of the HRESULT. More...
 
static void GetImageSize (const char *fileName, int *outWidth, int *outHeight)
 Gets the pixel dimensions of the provided image (filePath). More...
 
static void GetImageSizeW (const wchar_t *fileName, int *outWidth, int *outHeight)
 Gets the pixel dimensions of the provided image (filePath). More...
 
static void GetLastWindowsError (wchar_t *outLastWindowsErrorMessage)
 
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). More...
 
static float Hypotenuse (const float &x, const float &y)
 Solves for c in Pythagoras theorem (a^2 + b^2 = c^2); i.e square root of (a^2 + b^2). More...
 
static int Hypotenuse (const int &x, const int &y)
 Solves for c in Pythagoras theorem (a^2 + b^2 = c^2); i.e square root of (a^2 + b^2). More...
 
static long Hypotenuse (const long &x, const long &y)
 Solves for c in Pythagoras theorem (a^2 + b^2 = c^2); i.e square root of (a^2 + b^2). More...
 
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 location. More...
 
static int IndexOf (const wchar_t *strToSearch, const wchar_t &charToLookFor)
 Searches strToSearch for the first occurrence of charToLookFor and returns the (0 based) index of its location. More...
 
static int IndexOf (const char *strToSearch, const char *strToLookFor)
 Searches strToSearch for the first occurrence of strToLookFor and returns the (0 based) index of its location. More...
 
static int IndexOf (const wchar_t *strToSearch, const wchar_t *strToLookFor)
 Searches strToSearch for the first occurrence of strToLookFor and returns the (0 based) index of its location. More...
 
static int IndexOfFirstLetter (const char *strToSearch)
 Returns the first index of a letter in a given string. More...
 
static int IndexOfFirstLetter (const wchar_t *strToSearch)
 Returns the first index of a letter in a given wide string. More...
 
static int IndexOfIgnoreCase (const char *strToSearch, const char &charToLookFor)
 Searches strToSearch for the first occurrence of charToLookFor (regardless of case) and returns the (0 based) index of its location. More...
 
static int IndexOfIgnoreCase (const wchar_t *strToSearch, const wchar_t &charToLookFor)
 Searches strToSearch for the first occurrence of charToLookFor (regardless of case) and returns the (0 based) index of its location. More...
 
static int IndexOfIgnoreCase (const char *strToSearch, const char *strToLookFor)
 Searches strToSearch for the first occurrence of strToLookFor (regardless of case) and returns the (0 based) index of its location. More...
 
static int IndexOfIgnoreCase (const wchar_t *strToSearch, const wchar_t *strToLookFor)
 Searches strToSearch for the first occurrence of strToLookFor (regardless of case) and returns the (0 based) index of its location. More...
 
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. More...
 
static wchar_t * InsertString (const wchar_t *strToReceive, const wchar_t *strToInsert, const int &startIndex)
 Inserts the string strToInsert into strToRevcive by "sandwiching" the two halves of strToReceive. More...
 
static bool InsertString (char *destination, const char *strToReceive, const char *strToInsert, const int &startIndex)
 Inserts the string strToInsert into strToRevcive by "sandwiching" the two halves of strToReceive. More...
 
static bool InsertString (wchar_t *destination, const wchar_t *strToReceive, const wchar_t *strToInsert, const int &startIndex)
 Inserts the string strToInsert into strToRevcive by "sandwiching" the two halves of strToReceive. More...
 
static bool IsAlphabetic (const char &character)
 Returns true if a character is a letter from either a to z or A to Z. More...
 
static bool IsAlphabetic (const wchar_t &character)
 Returns true if a wide character is not a digit. More...
 
static bool IsDigit (const char &character)
 Returns true if a character is a digit from 0-9. More...
 
static bool IsDigit (const wchar_t &character)
 Returns true if a wide character is a digit. More...
 
static bool IsEmpty (const char *str)
 Searches a given string to see if it is all empty. More...
 
static bool IsEmpty (const wchar_t *str)
 Searches a given wide string to see if it is all empty. More...
 
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. More...
 
static bool IsFile (const wchar_t *str)
 Searches for a given file path and checks if the file path is (points to) a file or not. More...
 
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. More...
 
static bool IsFolder (const wchar_t *str)
 Searches for a given folder path and checks if the file path is (points to) a folder or not. More...
 
static bool IsNumber (const char *str)
 Returns true if all characters are a digit. More...
 
static bool IsNumber (const wchar_t *str)
 Returns true if all characters are a digit. More...
 
static bool IsPathADevice (const char *path)
 Returns true if the provided path leads to a device rather than a file. More...
 
static bool IsPathADevice (const wchar_t *path)
 Returns true if the provided path leads to a device rather than a file. More...
 
static bool IsWhitespace (const char &character)
 Returns true if a character is whitespace. More...
 
static bool IsWhitespace (const wchar_t &character)
 Returns true if a wide character is whitespace. More...
 
static double Largest (const double &numOne, const double &numTwo)
 Returns the larger of the two values. More...
 
static float Largest (const float &numOne, const float &numTwo)
 Returns the larger of the two values. More...
 
static int Largest (const int &numOne, const int &numTwo)
 Returns the larger of the two values. More...
 
static long Largest (const long &numOne, const long &numTwo)
 Returns the larger of the two values. More...
 
static char LastChar (const char *str)
 Returns the last character in str. More...
 
static wchar_t LastChar (const wchar_t *str)
 Returns the last character in str. More...
 
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 location. More...
 
static int LastIndexOf (const wchar_t *strToSearch, const wchar_t *strToLookFor)
 Searches strToSearch for the last occurrence of strToLookFor and returns the (0 based) index of its location. More...
 
static double LogBaseTen (const double &num)
 Calculates the logarithm (log) base 10 of num in compliance with CERT Coding Standard. More...
 
static float LogBaseTen (const float &num)
 Calculates the logarithm (log) base 10 of num in compliance with CERT Coding Standard. More...
 
static int LogBaseTen (const int &num)
 Calculates the logarithm (log) base 10 of num in compliance with CERT Coding Standard. More...
 
static long LogBaseTen (const long &num)
 Calculates the logarithm (log) base 10 of num in compliance with CERT Coding Standard. More...
 
static double LogBaseTwo (const double &num)
 Calculates the logarithm (log) base 2 of num in compliance with CERT Coding Standard. More...
 
static float LogBaseTwo (const float &num)
 Calculates the logarithm (log) base 2 of num in compliance with CERT Coding Standard. More...
 
static int LogBaseTwo (const int &num)
 Calculates the logarithm (log) base 2 of num in compliance with CERT Coding Standard. More...
 
static long LogBaseTwo (const long &num)
 Calculates the logarithm (log) base 2 of num in compliance with CERT Coding Standard. More...
 
static double Mod (const double &numerator, const double &denominator)
 Computes the floating-point remainder of the division operation numerator/denominator in compliance with CERT Coding Standard. More...
 
static float Mod (const float &numerator, const float &denominator)
 Computes the floating-point remainder of the division operation numerator/denominator in compliance with CERT Coding Standard. More...
 
static int Mod (const int &numerator, const int &denominator)
 Computes the floating-point remainder of the division operation numerator/denominator in compliance with CERT Coding Standard. More...
 
static long Mod (const long &numerator, const long &denominator)
 Computes the floating-point remainder of the division operation numerator/denominator in compliance with CERT Coding Standard. More...
 
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. More...
 
static float MultiplyThenAdd (const float &multOne, const float &multTwo, const float &add)
 Calculates the product of multOne * multTwo, then adds add to that product (i.e. More...
 
static int MultiplyThenAdd (const int &multOne, const int &multTwo, const int &add)
 Calculates the product of multOne * multTwo, then adds add to that product (i.e. More...
 
static long MultiplyThenAdd (const long &multOne, const long &multTwo, const long &add)
 Calculates the product of multOne * multTwo, then adds add to that product (i.e. More...
 
static double NaturalLog (const double &num)
 Calculates the Natural Logarithm (ln) of num in compliance with CERT Coding Standard. More...
 
static float NaturalLog (const float &num)
 Calculates the Natural Logarithm (ln) of num in compliance with CERT Coding Standard. More...
 
static int NaturalLog (const int &num)
 Calculates the Natural Logarithm (ln) of num in compliance with CERT Coding Standard. More...
 
static long NaturalLog (const long &num)
 Calculates the Natural Logarithm (ln) of num in compliance with CERT Coding Standard. More...
 
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] |). More...
 
static float NaturalLogGammaFunction (const float &num)
 Calculates The Natural Log (ln) of The Gamma Function (ln | (0)integral(Inf)[t^num-1 * e^-t dt] |). More...
 
static int NaturalLogGammaFunction (const int &num)
 Calculates The Natural Log (ln) of The Gamma Function (ln | (0)integral(Inf)[t^num-1 * e^-t dt] |). More...
 
static long NaturalLogGammaFunction (const long &num)
 Calculates The Natural Log (ln) of The Gamma Function (ln | (0)integral(Inf)[t^num-1 * e^-t dt] |). More...
 
static int NextIndexOf (const char *strToSearch, const char &charToLookFor, const int &startIndex)
 Retrieves the first occurrence of charToLookFor in strToSearch starting at startIndex onward. More...
 
static int NextIndexOf (const wchar_t *strToSearch, const wchar_t &charToLookFor, const int &startIndex)
 Retrieves the first occurrence of charToLookFor in strToSearch starting at startIndex onward. More...
 
static int NextIndexOf (const char *strToSearch, const char *strToLookFor, const int &startIndex)
 Retrieves the first occurrence of strToLookFor in strToSearch starting at startIndex onward. More...
 
static int NextIndexOf (const wchar_t *strToSearch, const wchar_t *strToLookFor, const int &startIndex)
 Retrieves the first occurrence of strToLookFor in strToSearch starting at startIndex onward. More...
 
static double NumTimesTwoToTheXPower (const double &num, const double &power)
 Calculates num * 2^power in compliance with CERT Coding Standard. More...
 
static float NumTimesTwoToTheXPower (const float &num, const float &power)
 Calculates num * 2^power in compliance with CERT Coding Standard. More...
 
static int NumTimesTwoToTheXPower (const int &num, const int &power)
 Calculates num * 2^power in compliance with CERT Coding Standard. More...
 
static long NumTimesTwoToTheXPower (const long &num, const long &power)
 Calculates num * 2^power in compliance with CERT Coding Standard. More...
 
static double PositiveDifference (const double &numOne, const double &numTwo)
 Calculates the difference between numOne and numTwo only if numOne > numTwo. More...
 
static float PositiveDifference (const float &numOne, const float &numTwo)
 Calculates the difference between numOne and numTwo only if numOne > numTwo. More...
 
static int PositiveDifference (const int &numOne, const int &numTwo)
 Calculates the difference between numOne and numTwo only if numOne > numTwo. More...
 
static long PositiveDifference (const long &numOne, const long &numTwo)
 Calculates the difference between numOne and numTwo only if numOne > numTwo. More...
 
static double Power (const double &base, const double &exponent)
 Takes the provided base and raises it to the exponent (power). More...
 
static float Power (const float &base, const float &exponent)
 Takes the provided base and raises it to the exponent (power). More...
 
static int Power (const int &base, const int &exponent)
 Takes the provided base and raises it to the exponent (power). More...
 
static long Power (const long &base, const long &exponent)
 Takes the provided base and raises it to the exponent (power). More...
 
static double RadiansToDegrees (const double &radians)
 Converts a number from radians to degrees. More...
 
static float RadiansToDegrees (const float &radians)
 Converts a number from radians to degrees. More...
 
static int RadiansToDegrees (const int &radians)
 Converts a number from radians to degrees. More...
 
static long RadiansToDegrees (const long &radians)
 Converts a number from radians to degrees. More...
 
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 between minOutRange and maxOutRange. More...
 
static float Range (const float &inValue, const float &minInRange, const float &maxInRange, const float &minOutRange, const float &maxOutRange)
 Takes the provided inValue with a range of minInRange to maxInRange, and maps the converted value between minOutRange and maxOutRange. More...
 
static int Range (const int &inValue, const int &minInRange, const int &maxInRange, const int &minOutRange, const int &maxOutRange)
 Takes the provided inValue with a range of minInRange to maxInRange, and maps the converted value between minOutRange and maxOutRange. More...
 
static long Range (const long &inValue, const long &minInRange, const long &maxInRange, const long &minOutRange, const long &maxOutRange)
 Takes the provided inValue with a range of minInRange to maxInRange, and maps the converted value between minOutRange and maxOutRange. More...
 
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. More...
 
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 file. More...
 
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. More...
 
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 file. More...
 
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)
 Opens a file for reading and returns a char buffer containing some or all of the data in the file. More...
 
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)
 Opens a file for reading and returns a char buffer containing some or all of the data in the file. More...
 
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)
 Opens a file for reading and returns a char buffer containing some or all of the data in the file. More...
 
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)
 Opens a file for reading and returns a char buffer containing some or all of the data in the file. More...
 
static double Remainder (const double &numerator, const double &denominator)
 Calculates the Computes The IEEE remainder of the floating point division operation numerator/denominator. More...
 
static float Remainder (const float &numerator, const float &denominator)
 Calculates the Computes The IEEE remainder of the floating point division operation numerator/denominator. More...
 
static int Remainder (const int &numerator, const int &denominator)
 Calculates the Computes The IEEE remainder of the floating point division operation numerator/denominator. More...
 
static long Remainder (const long &numerator, const long &denominator)
 Calculates the Computes The IEEE remainder of the floating point division operation numerator/denominator. More...
 
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 the Remainder() function does. More...
 
static float RemainderWithQuotient (const float &numerator, const float &denominator, int *outQuotient)
 Calculates the floating-point remainder of the division operation numerator/denominator the same way the Remainder() function does. More...
 
static int RemainderWithQuotient (const int &numerator, const int &denominator, int *outQuotient)
 Calculates the floating-point remainder of the division operation numerator/denominator the same way the Remainder() function does. More...
 
static long RemainderWithQuotient (const long &numerator, const long &denominator, int *outQuotient)
 Calculates the floating-point remainder of the division operation numerator/denominator the same way the Remainder() function does. More...
 
static char * RemoveAllWhitespace (const char *str)
 Removes all whitespace from a given string. More...
 
static wchar_t * RemoveAllWhitespace (const wchar_t *str)
 Removes all whitespace from a given wide string. More...
 
static void RemoveAllWhitespaceInPlace (char *str)
 Removes all whitespace from a given string in place. More...
 
static void RemoveAllWhitespaceInPlace (wchar_t *str)
 Removes all whitespace from a given wide string in place. More...
 
static char * RemoveCharactersFromString (const char *strToRemoveFrom, const char &charToRemove)
 Removes any occurrence of charToRemove from strToRemoveFrom. More...
 
static wchar_t * RemoveCharactersFromString (const wchar_t *strToRemoveFrom, const wchar_t &charToRemove)
 Removes any occurrence of charToRemove from strToRemoveFrom. More...
 
static void RemoveCharactersFromStringInPlace (char *strToRemoveFrom, const char &charToRemove)
 Removes any occurrence of charToRemove from strToRemoveFrom. More...
 
static void RemoveCharactersFromStringInPlace (wchar_t *strToRemoveFrom, const wchar_t &charToRemove)
 Removes any occurrence of charToRemove from strToRemoveFrom. More...
 
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 containing the result. More...
 
static wchar_t * RemoveStringFromString (const wchar_t *strToRemoveFrom, const wchar_t *strToRemove, const bool &removeOnlyFirstOccurrence=false)
 Removes the specified string (strToLookFor) from strToSearch and returns a newly allocated buffer containing the result. More...
 
static void RemoveStringFromStringInPlace (char *strToRemoveFrom, const char *strToRemove, const bool &removeOnlyFirstOccurrence=false)
 Removes the specified string (strToLookFor) by directly modifying strToSearch. More...
 
static void RemoveStringFromStringInPlace (wchar_t *strToRemoveFrom, const wchar_t *strToRemove, const bool &removeOnlyFirstOccurrence=false)
 Removes the specified string (strToLookFor) by directly modifying strToSearch. More...
 
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. More...
 
static wchar_t * ReplaceString (const wchar_t *strToSearch, const wchar_t *strToLookFor, const wchar_t *strToReplaceWith, const bool &removeOnlyFirstOccurrence=false)
 Inserts strToReplaceWith in the position strToLookFor is located, then strToLookFor is removed. More...
 
static bool ReplaceString (char *destination, const int &destinationLength, const char *strToSearch, const char *strToLookFor, const char *strToReplaceWith, const bool &removeOnlyFirstOccurrence=false)
 Attempts to remove the provided strToLookFor and replace it with the provided strToReplaceWith inside of the whole strToSearch. More...
 
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)
 Attempts to remove the provided strToLookFor and replace it with the provided strToReplaceWith inside of the whole strToSearch. More...
 
static char * RetrieveDataBetweenTags (const char *fileData, const char *startTag, const char *endTag)
 Finds the XML data between the startTag and endTag and returns it. More...
 
static wchar_t * RetrieveDataBetweenTags (const wchar_t *fileData, const wchar_t *startTag, const wchar_t *endTag)
 Finds the XML data between the startTag and endTag and returns it. More...
 
static char * RetrieveDataBetweenTags (const char *fileData, const int &startTagIndex, const int &endTagIndex)
 Finds the XML data between the startTagIndex and endTagIndex and returns it. More...
 
static wchar_t * RetrieveDataBetweenTags (const wchar_t *fileData, const int &startTagIndex, const int &endTagIndex)
 Finds the XML data between the startTagIndex and endTagIndex and returns it. More...
 
static bool RetrieveDataBetweenTags (char *destination, const char *fileData, const char *startTag, const char *endTag)
 Finds the XML data between the startTag and endTag and returns it. More...
 
static bool RetrieveDataBetweenTags (wchar_t *destination, const wchar_t *fileData, const wchar_t *startTag, const wchar_t *endTag)
 Finds the XML data between the startTag and endTag and returns it. More...
 
static bool RetrieveDataBetweenTags (char *destination, const char *fileData, const int &startTagIndex, const int &endTagIndex)
 Finds the XML data between the startTagIndex and endTagIndex and returns it. More...
 
static bool RetrieveDataBetweenTags (wchar_t *destination, const wchar_t *fileData, const int &startTagIndex, const int &endTagIndex)
 Finds the XML data between the startTagIndex and endTagIndex and returns it. More...
 
static char ** RetrieveDataChunksBetweenTags (const char *fileData, const char *startTag, const char *endTag, int &outFinalBufferSize)
 Finds a series of XML data between startTag and endTag. More...
 
static wchar_t ** RetrieveDataChunksBetweenTags (const wchar_t *fileData, const wchar_t *startTag, const wchar_t *endTag, int &outFinalBufferSize)
 Finds a series of XML data between startTag and endTag. More...
 
static bool RetrieveDataChunksBetweenTags (char **destination, const char *fileData, const char *startTag, const char *endTag)
 Finds a series of XML data between startTag and endTag. More...
 
static bool RetrieveDataChunksBetweenTags (wchar_t **destination, const wchar_t *fileData, const wchar_t *startTag, const wchar_t *endTag)
 Finds a series of XML data between startTag and endTag. More...
 
static vector< char * > RetrieveFileNames (const char *fullFilePath)
 Returns all the names of the files inside a folder, Ignores non files like folders. More...
 
static vector< wchar_t * > RetrieveFileNames (const wchar_t *fullFilePath)
 Returns all the names of the files inside a folder, Ignores non files like folders. More...
 
static vector< char * > RetrieveFolderNames (const char *fullFilePath)
 Returns all the names of the sub-folder(s) in a folder. More...
 
static vector< wchar_t * > RetrieveFolderNames (const wchar_t *fullFilePath)
 Returns all the names of the sub-folder(s) in a folder. More...
 
static bool RetrieveFileNames (vector< WIN32_FIND_DATAA > &destination, const char *fullFilePath)
 Returns all the names of the files(s) in a folder. More...
 
static bool RetrieveFileNames (vector< WIN32_FIND_DATAW > &destination, const wchar_t *fullFilePath)
 Returns all the names of the files(s) in a folder. More...
 
static bool RetrieveFolderNames (vector< WIN32_FIND_DATAA > &destination, const char *fullFilePath)
 Retrieves and stores all the names of the sub-folder(s) in a folder. More...
 
static bool RetrieveFolderNames (vector< WIN32_FIND_DATAW > &destination, const wchar_t *fullFilePath)
 Retrieves and stores all the names of the sub-folder(s) in a folder. More...
 
static char * ReverseString (const char *strToReverse)
 Creates a new string containing all the characters from strToReverse in reverse order. More...
 
static wchar_t * ReverseString (const wchar_t *strToReverse)
 Creates a new wide string containing all the characters from strToReverse in reverse order. More...
 
static void ReverseStringInPlace (char *strToReverse)
 Directly modifies strToReverse to have all its characters in reverse order. More...
 
static void ReverseStringInPlace (wchar_t *strToReverse)
 Directly modifies strToReverse to have all its characters in reverse order. More...
 
static long RoundToNearestInteger (const double &num)
 Rounds the floating-point argument num to an integer value, using the current rounding mode. More...
 
static long RoundToNearestInteger (const float &num)
 Rounds the floating-point argument num to an integer value, using the current rounding mode. More...
 
static long RoundToNearestInteger (const int &num)
 Rounds the floating-point argument num to an integer value, using the current rounding mode. More...
 
static long RoundToNearestInteger (const long &num)
 Rounds the floating-point argument num to an integer value, using the current rounding mode. More...
 
static long RoundUp (const double &num)
 Calculates the nearest integer value to num (in integer format), rounding halfway cases away from zero, regardless of the current rounding mode. More...
 
static long RoundUp (const float &num)
 Calculates the nearest integer value to num (in integer format), rounding halfway cases away from zero, regardless of the current rounding mode. More...
 
static long RoundUp (const int &num)
 Calculates the nearest integer value to num (in integer format), rounding halfway cases away from zero, regardless of the current rounding mode. More...
 
static long RoundUp (const long &num)
 Calculates the nearest integer value to num (in integer format), rounding halfway cases away from zero, regardless of the current rounding mode. More...
 
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. More...
 
static void ShowMessageBox (const HWND &hWindow, const wchar_t *message, const wchar_t *title=L"Error")
 Displays a standard message box with a message, title, and an OK button. More...
 
static double Sin (const double &numInRadians)
 Calculates the Sin in compliance with CERT Coding Standard. More...
 
static float Sin (const float &numInRadians)
 Calculates the Sin in compliance with CERT Coding Standard. More...
 
static int Sin (const int &numInRadians)
 Calculates the Sin in compliance with CERT Coding Standard. More...
 
static long Sin (const long &numInRadians)
 Calculates the Sin in compliance with CERT Coding Standard. More...
 
static double SinH (const double &numInRadians)
 Calculates the SinH in compliance with CERT Coding Standard. More...
 
static float SinH (const float &numInRadians)
 Calculates the SinH in compliance with CERT Coding Standard. More...
 
static int SinH (const int &numInRadians)
 Calculates the SinH in compliance with CERT Coding Standard. More...
 
static long SinH (const long &numInRadians)
 Calculates the SinH in compliance with CERT Coding Standard. More...
 
static double Smallest (const double &numOne, const double &numTwo)
 Calculates the smaller of the two values and returns the smaller one. More...
 
static float Smallest (const float &numOne, const float &numTwo)
 Calculates the smaller of the two values and returns the smaller one. More...
 
static int Smallest (const int &numOne, const int &numTwo)
 Calculates the smaller of the two values and returns the smaller one. More...
 
static long Smallest (const long &numOne, const long &numTwo)
 Calculates the smaller of the two values and returns the smaller one. More...
 
static double SquareRoot (const double &num)
 Returns the Square Root of the provided number. More...
 
static float SquareRoot (const float &num)
 Returns the Square Root of the provided number. More...
 
static int SquareRoot (const int &num)
 Returns the Square Root of the provided number. More...
 
static long SquareRoot (const long &num)
 Returns the Square Root of the provided number. More...
 
static char * SubString (const char *str, const int &startIndex, const int &upToButNotIncludingIndex=INT_MAX)
 Returns a string containing the characters between startIndex and upToButNotIncludingIndex. More...
 
static wchar_t * SubString (const wchar_t *str, const int &startIndex, const int &upToButNotIncludingIndex=INT_MAX)
 Returns a wide string containing the characters between startIndex and upToButNotIncludingIndex. More...
 
static bool SubString (char *destination, const char *str, const int &startIndex, const int &upToButNotIncludingIndex=INT_MAX)
 Returns a string containing the characters between startIndex and upToButNotIncludingIndex. More...
 
static bool SubString (wchar_t *destination, const wchar_t *str, const int &startIndex, const int &upToButNotIncludingIndex=INT_MAX)
 Returns a string containing the characters between startIndex and upToButNotIncludingIndex. More...
 
static double Tan (const double &numInRadians)
 Calculates the Tangent (Tan) of numInRadians in compliance with CERT Coding Standard. More...
 
static float Tan (const float &numInRadians)
 Calculates the Tangent (Tan) of numInRadians in compliance with CERT Coding Standard. More...
 
static int Tan (const int &numInRadians)
 Calculates the Tangent (Tan) of numInRadians in compliance with CERT Coding Standard. More...
 
static long Tan (const long &numInRadians)
 Calculates the Tangent (Tan) of numInRadians in compliance with CERT Coding Standard. More...
 
static double TanH (const double &numInRadians)
 Calculates The Hyperbolic Tangent (TanH) of numInRadians in compliance with CERT Coding Standard. More...
 
static float TanH (const float &numInRadians)
 Calculates The Hyperbolic Tangent (TanH) of numInRadians in compliance with CERT Coding Standard. More...
 
static int TanH (const int &numInRadians)
 Calculates The Hyperbolic Tangent (TanH) of numInRadians in compliance with CERT Coding Standard. More...
 
static long TanH (const long &numInRadians)
 Calculates The Hyperbolic Tangent (TanH) of numInRadians in compliance with CERT Coding Standard. More...
 
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. More...
 
static wchar_t ** Tokenize (const wchar_t *strToTokenize, const wchar_t *delimiter, int &outNumTokensFound)
 Breaks up a wide string and returns an array of all the wide strings between each delimiter. More...
 
static bool Tokenize (char **destination, const char *strToTokenize, const char *delimiter, int &outNumTokensFound)
 Breaks up a string and stores of all the strings between each delimiter into the destination buffer. More...
 
static bool Tokenize (wchar_t **destination, const wchar_t *strToTokenize, const wchar_t *delimiter, int &outNumTokensFound)
 Breaks up a string and stores of all the strings between each delimiter into the destination buffer. More...
 
static double Truncate (const double &num)
 Removes everything after the decimal point. More...
 
static float Truncate (const float &num)
 Removes everything after the decimal point. More...
 
static double TwoToTheXPower (const double &power)
 Calculates 2^power in compliance with CERT Coding Standard. More...
 
static float TwoToTheXPower (const float &power)
 Calculates 2^power in compliance with CERT Coding Standard. More...
 
static int TwoToTheXPower (const int &power)
 Calculates 2^power in compliance with CERT Coding Standard. More...
 
static long TwoToTheXPower (const long &power)
 Calculates 2^power in compliance with CERT Coding Standard. More...
 
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. More...
 
static bool Validate (const HWND &hWnd, const HRESULT &result, const wchar_t *message, const wchar_t *title=L"ERROR")
 Returns false and displays an error window if result is an error (i.e. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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 Standard. More...
 

Member Function Documentation

◆ _Aligned_Calloc()

void * Ace::_Aligned_Calloc ( const size_t &  size,
const size_t &  alignment = BYTE_ALIGNMENT 
)
static

Allocates a memory aligned buffer of specified size and zeros it out.

Author
Eddie O'Hagan
Date
11/5/2016
try
{
char* buffer = (char*)Ace::_Aligned_Calloc(1024);
if (strcpy_s(buffer, 1024, "My name is Eddie and I like spaghetti.") != 0)
{
throw "Error: Failed to copy string.";
}
printf("%s\n", buffer);
_aligned_free(buffer);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:My name is Eddie and I like spaghetti.

Parameters
sizeThe number of bytes to allocate.
alignmentThe byte alignment of the buffer.
Returns
A zeroed out buffer of specified size. Throws an exception if error occurs.

◆ _Aligned_Malloc()

void * Ace::_Aligned_Malloc ( const size_t &  size,
const size_t &  alignment = BYTE_ALIGNMENT 
)
static

Allocates a memory aligned buffer of specified size.

Author
Eddie O'Hagan
Date
2/26/2022
try
{
char* buffer = (char*)Ace::_Aligned_Malloc(1024);
if (strcpy_s(buffer, 1024, "My name is Eddie and I like spaghetti.") != 0)
{
throw "Error: Failed to copy string.";
}
printf("%s\n", buffer);
_aligned_free(buffer);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:My name is Eddie and I like spaghetti.

Parameters
sizeThe number of bytes to allocate.
alignmentThe byte alignment of the buffer.
Returns
A buffer of specified size. Throws an exception if error occurs.

◆ AbsoluteValue() [1/4]

double Ace::AbsoluteValue ( const double &  num)
static

Calculates the absolute value of a number in compliance with CERT Coding Standard.

The absolute value is the positive version of value (example: |3-4| = 1).

Author
Eddie O'Hagan
Date
10/8/2016
double retVal = Ace::AbsoluteValue(-2.3);
printf("%f\n", retVal);
static double AbsoluteValue(const double &num)
Calculates the absolute value of a number in compliance with CERT Coding Standard.
Definition: Ace.cpp:118

Output:2.300000

Parameters
numThe number to use to determine the absolute value.
Returns
The absolute value of num.

◆ AbsoluteValue() [2/4]

float Ace::AbsoluteValue ( const float &  num)
static

Calculates the absolute value of a number in compliance with CERT Coding Standard.

The absolute value is the positive version of value (example: |3-4| = 1).

Author
Eddie O'Hagan
Date
10/8/2016
float retVal = Ace::AbsoluteValue(-2.3f);
printf("%f\n", retVal);

Output:2.300000

Parameters
numThe number to use to determine the absolute value.
Returns
The absolute value of num.

◆ AbsoluteValue() [3/4]

int Ace::AbsoluteValue ( const int &  num)
static

Calculates the absolute value of a number in compliance with CERT Coding Standard.

The absolute value is the positive version of value (example: |3-4| = 1).

Author
Eddie O'Hagan
Date
10/19/2016
int retVal = Ace::AbsoluteValue(-2);
printf("%d\n", retVal);

Output:2

Parameters
numThe number to use to determine the absolute value.
Returns
The absolute value of num.

◆ AbsoluteValue() [4/4]

long Ace::AbsoluteValue ( const long &  num)
static

Calculates the absolute value of a number in compliance with CERT Coding Standard.

The absolute value is the positive version of value (example: |3-4| = 1).

Author
Eddie O'Hagan
Date
7/23/2023
long retVal = Ace::AbsoluteValue((long)-2);
printf("%ld\n", retVal);

Output:2

Parameters
numThe number to use to determine the absolute value.
Returns
The absolute value of num.

◆ AllocateAndCopyString() [1/2]

char * Ace::AllocateAndCopyString ( const char *  strToCopy)
static

Allocates a buffer and copies a provided traditional string into the buffer.

Author
Eddie O'Hagan
Date
3/2/2022
try
{
const char* strToCopy = "An eraser of love...";
char* buffer = Ace::AllocateAndCopyString(strToCopy);
printf("%s\n", buffer);
_aligned_free(buffer);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char * AllocateAndCopyString(const char *strToCopy)
Allocates a buffer and copies a provided traditional string into the buffer.
Definition: Ace.cpp:223

Output:An eraser of love...

Parameters
[in,out]strToCopyIf non-null, to copy.
Returns
A newly allocated buffer containing strToCopy. Throws an exception if there is an error.

◆ AllocateAndCopyString() [2/2]

wchar_t * Ace::AllocateAndCopyString ( const wchar_t *  wideStrToCopy)
static

Allocates a buffer and copies a provided traditional wide string into the buffer.

Author
Eddie O'Hagan
Date
3/2/2022
try
{
const wchar_t* strToCopy = L"これ は なん です か?";
wchar_t* buffer = Ace::AllocateAndCopyString(strToCopy);
printf("%ls\n", buffer);
_aligned_free(buffer);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output: (output cannot be displayed on Windows console without calling the ChangeWindowsConsoleFont function first.)

Parameters
[in,out]wideStrToCopyIf non-null, the wide string to copy.
Returns
A newly allocated buffer containing wideStrToCopy. Throws an exception if there is an error.

◆ ArcCos() [1/4]

double Ace::ArcCos ( const double &  numInRadians)
static

Calculates the ArcCos in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/3/2016
try
{
const double PI = 3.14159265;
double angleInRadians = PI / 4.0;
double result = Ace::ArcCos(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static const double PI
Definition: Ace.h:35
static double ArcCos(const double &numInRadians)
Calculates the ArcCos in compliance with CERT Coding Standard.
Definition: Ace.cpp:382

Output:angleInRadians:0.785398 result:0.667457

Parameters
numInRadiansNumber in radians to calculate ArcCos for.
Returns
The ArcCos of numInRadians. If a mathematical error occurs or numInRadians is not between -1 and 1, then an exception is thrown.

◆ ArcCos() [2/4]

float Ace::ArcCos ( const float &  numInRadians)
static

Calculates the ArcCos in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
const double PI = 3.14159265;
float angleInRadians = PI / 4.0;
float result = Ace::ArcCos(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0.785398 result:0.667457

Parameters
numInRadiansNumber in radians to calculate ArcCos for.
Returns
The ArcCos of numInRadians. If a mathematical error occurs or numInRadians is not between -1 and 1, then an exception is thrown.

◆ ArcCos() [3/4]

int Ace::ArcCos ( const int &  numInRadians)
static

Calculates the ArcCos in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/19/2016
try
{
const double PI = 3.14159265;
int angleInRadians = PI / 4.0;
int result = Ace::ArcCos(angleInRadians);
printf("angleInRadians:%d result:%d\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:1

Parameters
numInRadiansNumber in radians to calculate ArcCos for.
Returns
The ArcCos of numInRadians. If a mathematical error occurs or numInRadians is not between -1 and 1, then an exception is thrown.

◆ ArcCos() [4/4]

long Ace::ArcCos ( const long &  numInRadians)
static

Calculates the ArcCos in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
const double PI = 3.14159265;
long angleInRadians = PI / 4.0;
long result = Ace::ArcCos(angleInRadians);
printf("angleInRadians:%ld result:%ld\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:1

Parameters
numInRadiansNumber in radians to calculate ArcCos for.
Returns
The ArcCos of numInRadians. If a mathematical error occurs or numInRadians is not between -1 and 1, then an exception is thrown.

◆ ArcCosH() [1/4]

double Ace::ArcCosH ( const double &  numInRadians)
static

Calculates the ArcCosH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/3/2016
try
{
double result = Ace::ArcCosH(1.5);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double ArcCosH(const double &numInRadians)
Calculates the ArcCosH in compliance with CERT Coding Standard.
Definition: Ace.cpp:660

Output:0.962424

Parameters
numInRadiansNumber in radians to calculate ArcCosH for.
Returns
The ArcCosH of numInRadians. If a mathematical error occurs or numInRadians is less than 1, then an exception is thrown.

◆ ArcCosH() [2/4]

float Ace::ArcCosH ( const float &  numInRadians)
static

Calculates the ArcCosH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float result = Ace::ArcCosH(1.5f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:0.962424

Parameters
numInRadiansNumber in radians to calculate ArcCosH for.
Returns
The ArcCosH of numInRadians. If a mathematical error occurs or numInRadians is less than 1, then an exception is thrown.

◆ ArcCosH() [3/4]

int Ace::ArcCosH ( const int &  numInRadians)
static

Calculates the ArcCosH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/19/2016
try
{
int result = Ace::ArcCosH(2);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:1

Parameters
numInRadiansNumber in radians to calculate ArcCosH for.
Returns
The ArcCosH of numInRadians. If a mathematical error occurs or numInRadians is less than 1, then an exception is thrown.

◆ ArcCosH() [4/4]

long Ace::ArcCosH ( const long &  numInRadians)
static

Calculates the ArcCosH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::ArcCosH((long)2);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:1

Parameters
numInRadiansNumber in radians to calculate ArcCosH for.
Returns
The ArcCosH of numInRadians. If a mathematical error occurs or numInRadians is less than 1, then an exception is thrown.

◆ ArcSin() [1/4]

double Ace::ArcSin ( const double &  numInRadians)
static

Calculates the ArcSin in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
const double PI = 3.14159265;
double angleInRadians = PI / 4.0;
double result = Ace::ArcSin(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double ArcSin(const double &numInRadians)
Calculates the ArcSin in compliance with CERT Coding Standard.
Definition: Ace.cpp:934

Output:angleInRadians:0.785398 result:0.903339

Parameters
numInRadiansNumber in radians to calculate ArcSin for.
Returns
The ArcSin of numInRadians. If a mathematical error occurs or numInRadians is less than or equal to -1 or numInRadians is greater then 1, then an exception is thrown.

◆ ArcSin() [2/4]

float Ace::ArcSin ( const float &  numInRadians)
static

Calculates the ArcSin in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
const double PI = 3.14159265;
float angleInRadians = PI / 4.0;
float result = Ace::ArcSin(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0.785398 result:0.903339

Parameters
numInRadiansNumber in radians to calculate ArcSin for.
Returns
The ArcSin of numInRadians. If a mathematical error occurs or numInRadians is less than or equal to -1 or numInRadians is greater then 1, then an exception is thrown.

◆ ArcSin() [3/4]

int Ace::ArcSin ( const int &  numInRadians)
static

Calculates the ArcSin in compliance with CERT Coding Standard.

This function is useless but is provided for completeness.

Author
Eddie O'Hagan
Date
10/19/2016
try
{
const double PI = 3.14159265;
int angleInRadians = PI / 4.0;
int result = Ace::ArcSin(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber in radians to calculate ArcSin for.
Returns
The ArcSin of numInRadians. If a mathematical error occurs or numInRadians is less than or equal to -1 or numInRadians is greater then 1, then an exception is thrown.

◆ ArcSin() [4/4]

long Ace::ArcSin ( const long &  numInRadians)
static

Calculates the ArcSin in compliance with CERT Coding Standard.

This function is useless but is provided for completeness.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
const double PI = 3.14159265;
long angleInRadians = PI / 4.0;
long result = Ace::ArcSin(angleInRadians);
printf("angleInRadians:%ld result:%ld\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber in radians to calculate ArcSin for.
Returns
The ArcSin of numInRadians. If a mathematical error occurs or numInRadians is less than or equal to -1 or numInRadians is greater then 1, then an exception is thrown.

◆ ArcSinH() [1/4]

double Ace::ArcSinH ( const double &  numInRadians)
static

Calculates the ArcSinH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
const double PI = 3.14159265;
double angleInRadians = PI / 4.0;
double result = Ace::ArcSinH(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double ArcSinH(const double &numInRadians)
Calculates the ArcSinH in compliance with CERT Coding Standard.
Definition: Ace.cpp:1215

Output:angleInRadians:0.785398 result:0.721225

Parameters
numInRadiansNumber in radians to calculate ArcSinH for.
Returns
The ArcSinH of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ ArcSinH() [2/4]

float Ace::ArcSinH ( const float &  numInRadians)
static

Calculates the ArcSinH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
const double PI = 3.14159265;
float angleInRadians = PI / 4.0;
float result = Ace::ArcSinH(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0.785398 result:0.721226

Parameters
numInRadiansNumber in radians to calculate ArcSinH for.
Returns
The ArcSinH of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ ArcSinH() [3/4]

int Ace::ArcSinH ( const int &  numInRadians)
static

Calculates the ArcSinH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/19/2016
try
{
const double PI = 3.14159265;
int angleInRadians = PI / 4.0;
int result = Ace::ArcSinH(angleInRadians);
printf("angleInRadians:%d result:%d\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber in radians to calculate ArcSinH for.
Returns
The ArcSinH of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ ArcSinH() [4/4]

long Ace::ArcSinH ( const long &  numInRadians)
static

Calculates the ArcSinH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/19/2016
try
{
const double PI = 3.14159265;
long angleInRadians = PI / 4.0;
long result = Ace::ArcSinH(angleInRadians);
printf("angleInRadians:%ld result:%ld\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber in radians to calculate ArcSinH for.
Returns
The ArcSinH of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ ArcTan() [1/4]

double Ace::ArcTan ( const double &  numInRadians)
static

Calculates the ArcTan in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
const double PI = 3.14159265;
double angleInRadians = PI / 4.0;
double result = Ace::ArcTan(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double ArcTan(const double &numInRadians)
Calculates the ArcTan in compliance with CERT Coding Standard.
Definition: Ace.cpp:1451

Output:angleInRadians:0.785398 result:0.665774

Parameters
numInRadiansNumber in radians to calculate ArcTan for.
Returns
The ArcTan of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ ArcTan() [2/4]

float Ace::ArcTan ( const float &  numInRadians)
static

Calculates the ArcTan in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
const double PI = 3.14159265;
float angleInRadians = PI / 4.0;
float result = Ace::ArcTan(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0.785398 result:0.665774

Parameters
numInRadiansNumber in radians to calculate ArcTan for.
Returns
The ArcTan of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ ArcTan() [3/4]

int Ace::ArcTan ( const int &  numInRadians)
static

Calculates the ArcTan in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/19/2016
try
{
const double PI = 3.14159265;
int angleInRadians = PI / 4.0;
int result = Ace::ArcTan(angleInRadians);
printf("angleInRadians:%d result:%d\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber in radians to calculate ArcTan for.
Returns
The ArcTan of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ ArcTan() [4/4]

long Ace::ArcTan ( const long &  numInRadians)
static

Calculates the ArcTan in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
const double PI = 3.14159265;
long angleInRadians = PI / 4.0;
long result = Ace::ArcTan(angleInRadians);
printf("angleInRadians:%ld result:%ld\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber in radians to calculate ArcTan for.
Returns
The ArcTan of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ ArcTan2() [1/4]

double Ace::ArcTan2 ( const double &  y,
const double &  x 
)
static

Calculates the ArcTan2 in compliance with CERT Coding Standard.

To compute the value, the function takes into account the sign of both arguments in order to determine the quadrant.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
double result = Ace::ArcTan2(-10.0, 5.0);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double ArcTan2(const double &yInRadians, const double &xInRadians)
Calculates the ArcTan2 in compliance with CERT Coding Standard.
Definition: Ace.cpp:1968

Output:-1.107149

Parameters
yValue representing the proportion of the y-coordinate.
xValue representing the proportion of the x-coordinate.
Returns
Arc Tangent of y/x, in radians. If y = 0 or x = 0, or a mathematical error occurs, an exception is thrown.

◆ ArcTan2() [2/4]

float Ace::ArcTan2 ( const float &  y,
const float &  x 
)
static

Calculates the ArcTan2 in compliance with CERT Coding Standard.

To compute the value, the function takes into account the sign of both arguments in order to determine the quadrant.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float result = Ace::ArcTan2(-10.0f, 5.0f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:-1.107149

Parameters
yValue representing the proportion of the y-coordinate.
xValue representing the proportion of the x-coordinate.
Returns
Arc Tangent of y/x, in radians. If y = 0 or x = 0, or a mathematical error occurs, an exception is thrown.

◆ ArcTan2() [3/4]

int Ace::ArcTan2 ( const int &  y,
const int &  x 
)
static

Calculates the ArcTan2 in compliance with CERT Coding Standard.

To compute the value, the function takes into account the sign of both arguments in order to determine the quadrant.

Author
Eddie O'Hagan
Date
10/19/2016
try
{
int result = Ace::ArcTan2(-10, 5);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:-1

Parameters
yValue representing the proportion of the y-coordinate.
xValue representing the proportion of the x-coordinate.
Returns
Arc Tangent of y/x, in radians. If y = 0 or x = 0, or a mathematical error occurs, an exception is thrown.

◆ ArcTan2() [4/4]

long Ace::ArcTan2 ( const long &  y,
const long &  x 
)
static

Calculates the ArcTan2 in compliance with CERT Coding Standard.

To compute the value, the function takes into account the sign of both arguments in order to determine the quadrant.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::ArcTan2((long)420, (long)69);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:1

Parameters
yValue representing the proportion of the y-coordinate.
xValue representing the proportion of the x-coordinate.
Returns
Arc Tangent of y/x, in radians. If y = 0 or x = 0, or a mathematical error occurs, an exception is thrown.

◆ ArcTanH() [1/4]

double Ace::ArcTanH ( const double &  numInRadians)
static

Calculates the ArcTanH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/3/2016
try
{
const double PI = 3.14159265;
double angleInRadians = PI / 4.0;
double result = Ace::ArcTanH(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double ArcTanH(const double &numInRadians)
Calculates the ArcTanH in compliance with CERT Coding Standard.
Definition: Ace.cpp:1688

Output:angleInRadians:0.785398 result:1.059306

Parameters
numInRadiansNumber in radians to calculate ArcTanH for.
Returns
The ArcTanH of numInRadians. If a mathematical error occurs or if numInRadians is less than or equal to -1 or if numInRadians is greater than or equal to 1, then an exception is thrown.

◆ ArcTanH() [2/4]

float Ace::ArcTanH ( const float &  numInRadians)
static

Calculates the ArcTanH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
const double PI = 3.14159265;
float angleInRadians = PI / 4.0;
float result = Ace::ArcTanH(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0.785398 result:1.059306

Parameters
numInRadiansNumber in radians to calculate ArcTanH for.
Returns
The ArcTanH of numInRadians. If a mathematical error occurs or if numInRadians is less than or equal to -1 or if numInRadians is greater than or equal to 1, then an exception is thrown.

◆ ArcTanH() [3/4]

int Ace::ArcTanH ( const int &  numInRadians)
static

Calculates the ArcTanH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/19/2016
try
{
const double PI = 3.14159265;
int angleInRadians = PI / 4.0;
int result = Ace::ArcTanH(angleInRadians);
printf("angleInRadians:%d result:%d\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber in radians to calculate ArcTanH for.
Returns
The ArcTanH of numInRadians. If a mathematical error occurs or if numInRadians is less than or equal to -1 or if numInRadians is greater than or equal to 1, then an exception is thrown.

◆ ArcTanH() [4/4]

long Ace::ArcTanH ( const long &  numInRadians)
static

Calculates the ArcTanH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
const double PI = 3.14159265;
long angleInRadians = PI / 4.0;
long result = Ace::ArcTanH(angleInRadians);
printf("angleInRadians:%ld result:%ld\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber in radians to calculate ArcTanH for.
Returns
The ArcTanH of numInRadians. If a mathematical error occurs or if numInRadians is less than or equal to -1 or if numInRadians is greater than or equal to 1, then an exception is thrown.

◆ CalculateAspectRatio()

void Ace::CalculateAspectRatio ( const int &  newWidth,
const int &  newHeight,
const int &  originalWidth,
const int &  originalHeight,
int &  outAdjustedWidth,
int &  outAdjustedHeight 
)
static

Adjusts the resolution to the correct aspect ratio for the destination.

Author
Eddie O'Hagan
Date
10/18/2016
try
{
int outNewWidth;
int outNewHeight;
Ace::CalculateAspectRatio(1920, 1080, 1024, 768, outNewWidth, outNewHeight);
printf("New Width:%d New Height:%d\n", outNewWidth, outNewHeight);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:New Width:1024 New Height:576

Parameters
newWidthThe width for the image destination.
newHeightThe height for the image destination.
originalWidthThe original width of the source.
originalHeightThe original height of the source.
[out]outAdjustedWidthThe calculated width.
[out]outAdjustedHeightThe calculated height.
Returns
Throws an exception if parameters are not in valid range.

◆ CalculateFileSize() [1/2]

LONGLONG Ace::CalculateFileSize ( const char *  theFilePath)
static

Uses fseek() to calculate the size of the file by moving the file pointer to the end.

Author
Eddie O'Hagan
Date
3/2/2022
try
{
int fileSize = Ace::CalculateFileSize("C:\\dicks.txt");
printf("%d\n", fileSize);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:37

Parameters
[in]theFileA pointer to the File.
Returns
Size of the file in bytes. Throws an exception if there is an error.

◆ CalculateFileSize() [2/2]

LONGLONG Ace::CalculateFileSize ( const wchar_t *  theFilePath)
static

Gets the size of the file in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
3/2/2022
try
{
int fileSize = Ace::CalculateFileSize(L"C:\\とまと.txt");
printf("%d\n", fileSize);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:33

Parameters
[in]theFilePathThe full file path.
Returns
Size of the file in bytes. Throws an exception if there is an error.

◆ CalculateNumLength() [1/2]

int Ace::CalculateNumLength ( const int &  num)
static

Counts the number of digits of num.

Author
Eddie O'Hagan
Date
10/23/2016
try
{
int numLength = Ace::CalculateNumLength(9999999);
printf("%d\n", numLength);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static int CalculateNumLength(const int &num)
Counts the number of digits of num.
Definition: Ace.cpp:2395

Output:7

Parameters
numNumber to count digits of.
Returns
The length (number of digits) of a given num. Throws an exception if there is an error.

◆ CalculateNumLength() [2/2]

long Ace::CalculateNumLength ( const long &  num)
static

Counts the number of digits of num.

Author
Eddie O'Hagan
Date
10/23/2016
try
{
long num = 9999999;
long numLength = Ace::CalculateNumLength(num);
printf("%d\n", numLength);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:7

Parameters
numNumber to count digits of.
Returns
The length (number of digits) of a given num. Throws an exception if there is an error.

◆ Ceiling() [1/4]

double Ace::Ceiling ( const double &  num)
static

Calculates the smallest integer value greater than or equal to num.

Author
Eddie O'Hagan
Date
10/7/2016
try
{
double retVal = Ace::Ceiling(1.01);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double Ceiling(const double &num)
Calculates the smallest integer value greater than or equal to num.
Definition: Ace.cpp:2509

Output:2.000000

Parameters
numThe number to convert.
Returns
The smallest integral value not less than num. Throws an exception if a mathematical error occurs.

◆ Ceiling() [2/4]

float Ace::Ceiling ( const float &  num)
static

Calculates the smallest integer value greater than or equal to num.

Author
Eddie O'Hagan
Date
10/7/2016
try
{
float retVal = Ace::Ceiling(1.01f);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:2.000000

Parameters
numThe number to convert.
Returns
The smallest integral value not less than num. Throws an exception if a mathematical error occurs.

◆ Ceiling() [3/4]

int Ace::Ceiling ( const int &  num)
static

Calculates the smallest integer value greater than or equal to num.

Author
Eddie O'Hagan
Date
10/19/2016
try
{
int retVal = Ace::Ceiling(5);
printf("%d\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:5

Parameters
numThe number to convert.
Returns
The smallest integral value not less than num. Throws an exception if a mathematical error occurs.

◆ Ceiling() [4/4]

long Ace::Ceiling ( const long &  num)
static

Calculates the smallest integer value greater than or equal to num.

Author
Eddie O'Hagan
Date
8/11/2023
try
{
long retVal = Ace::Ceiling((long)5);
printf("%ld\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:5

Parameters
numThe number to convert.
Returns
The smallest integral value not less than num. Throws an exception if a mathematical error occurs.

◆ ChangeWindowsConsoleFont()

bool Ace::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 
)
static

◆ CharAt() [1/2]

char Ace::CharAt ( const char *  str,
const int &  index 
)
static

Returns a single character in str at a specified index.

Author
Eddie O'Hagan
Date
3/2/2022
try
{
const char* data = "Has anyone ever been as far as decided to be there and then look more like?";
char theCharacter = Ace::CharAt(data, 11);
printf("%c", theCharacter);;
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char CharAt(const char *str, const int &index)
Returns a single character in str at a specified index.
Definition: Ace.cpp:2888

Output:e

Parameters
[in]strString to search.
indexThe (0 based) index of what character to get.
Returns
A single character from str. Throws an exception if str is NULL or index is not in valid range.

◆ CharAt() [2/2]

wchar_t Ace::CharAt ( const wchar_t *  str,
const int &  index 
)
static

Returns a single character in str at a specified index.

Author
Eddie O'Hagan
Date
3/2/2022
try
{
const wchar_t* data = L"誰かがそこにいることを決めたのと同じくらい言ったことがあります、そしてそれからより多くのように見えますか?";
wchar_t theCharacter = Ace::CharAt(data, 11);
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%lc\n", theCharacter);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:決

Parameters
[in]strString to search.
indexThe (0 based) index of what character to get.
Returns
A single character from str. Throws an exception if str is NULL or index is not in valid range.

◆ Clamp() [1/4]

double Ace::Clamp ( const double &  numToClamp,
const double &  min,
const double &  max 
)
static

Returns a value between min and max inclusive.

If the value exceeds max, then max is returned. If the value is below min, then min is returned, otherwise numToClamp is returned.

Author
Eddie O'Hagan
Date
7/28/2026
double numToClamp = 1.20000000002;
double clampedNum = Ace::Clamp(numToClamp, 1.2000001, 1.275);
printf("Clamped Number: %.11f\n", clampedNum);
static int Clamp(const int &numToClamp, const int &min, const int &max)
Returns a value between min and max inclusive.
Definition: Ace.cpp:2991

Output:Clamped Number: 1.20000010000

Parameters
numToClampThe number to bound between min and max.
minThe number to return if numToClamp is lower then it.
maxThe number to return if numToClamp is higher then it.
Returns
The number between min and max.

◆ Clamp() [2/4]

float Ace::Clamp ( const float &  numToClamp,
const float &  min,
const float &  max 
)
static

Returns a value between min and max inclusive.

If the value exceeds max, then max is returned. If the value is below min, then min is returned, otherwise numToClamp is returned.

Author
Eddie O'Hagan
Date
7/28/2026
float numToClamp = 1.3f;
float clampedNum = Ace::Clamp(numToClamp, 1.21f, 1.275f);
printf("Clamped Number: %f\n", clampedNum);

Output:Clamped Number: 1.275000

Parameters
numToClampThe number to bound between min and max.
minThe number to return if numToClamp is lower then it.
maxThe number to return if numToClamp is higher then it.
Returns
The number between min and max.

◆ Clamp() [3/4]

int Ace::Clamp ( const int &  numToClamp,
const int &  min,
const int &  max 
)
static

Returns a value between min and max inclusive.

If the value exceeds max, then max is returned. If the value is below min, then min is returned, otherwise numToClamp is returned.

Author
Eddie O'Hagan
Date
7/28/2026
int numToClamp = 67;
int clampedNum = Ace::Clamp(numToClamp, 68, 70);
printf("Clamped Number: %d\n", clampedNum);

Output:Clamped Number: 68

Parameters
numToClampThe number to bound between min and max.
minThe number to return if numToClamp is lower then it.
maxThe number to return if numToClamp is higher then it.
Returns
The number between min and max inclusive.

◆ Clamp() [4/4]

long Ace::Clamp ( const long &  numToClamp,
const long &  min,
const long &  max 
)
static

Returns a value between min and max inclusive.

If the value exceeds max, then max is returned. If the value is below min, then min is returned, otherwise numToClamp is returned.

Author
Eddie O'Hagan
Date
7/28/2026
long numToClamp = 2000100015;
long clampedNum = Ace::Clamp(numToClamp, 1000000000L, 2000000000L);
printf("Clamped Number: %ld\n", clampedNum);

Output:Clamped Number: 2000000000

Parameters
numToClampThe number to bound between min and max.
minThe number to return if numToClamp is lower then it.
maxThe number to return if numToClamp is higher then it.
Returns
The number between min and max.

◆ ComplementaryErrorFunction() [1/4]

double Ace::ComplementaryErrorFunction ( const double &  num)
static

Calculates the Complementary Error Function integral from num to infinity in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
double result = Ace::ComplementaryErrorFunction(1.0);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:0.157299

Parameters
numThe starting point for the integral.
Returns
The result of the Complementary Error Function integral. If a mathematical error occurs then an exception is thrown.

◆ ComplementaryErrorFunction() [2/4]

float Ace::ComplementaryErrorFunction ( const float &  num)
static

Calculates the Complementary Error Function integral from num to infinity in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float result = Ace::ComplementaryErrorFunction(1.0f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:0.157299

Parameters
numThe starting point for the integral.
Returns
The result of the Complementary Error Function integral. If a mathematical error occurs then an exception is thrown.

◆ ComplementaryErrorFunction() [3/4]

int Ace::ComplementaryErrorFunction ( const int &  num)
static

Calculates the Complementary Error Function integral from num to infinity in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/19/2016
try
{
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:0

Parameters
numThe starting point for the integral.
Returns
The result of the Complementary Error Function integral. If a mathematical error occurs then an exception is thrown.

◆ ComplementaryErrorFunction() [4/4]

long Ace::ComplementaryErrorFunction ( const long &  num)
static

Calculates the Complementary Error Function integral from num to infinity in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::ComplementaryErrorFunction((long)4);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:0

Parameters
numThe starting point for the integral.
Returns
The result of the Complementary Error Function integral. If a mathematical error occurs then an exception is thrown.

◆ Concatenate() [1/2]

bool Ace::Concatenate ( char *  destination,
int  numStrings,
  ... 
)
static

Appends a series of strings together.

Author
Eddie O'Hagan
Date
4/2/2022
try
{
char destination[1024];
if (Ace::Concatenate(destination, 3, "Everything", "Everything", "Everything") == true)
{
printf("%s\n", destination);
}
else
{
printf("%s\n", "Failed to concatenate strings.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char * Concatenate(int numStrings,...)
Appends a series of strings together.
Definition: Ace.cpp:4233

Output:EverythingEverythingEverything.

Parameters
[in]destinationThe Destination Buffer to store the concatenation.
[in]numStringsNumber of strings to append.
[in]...Variable arguments providing additional strings.
Returns
true if the concatenation was a success, false otherwise. Throws an exception if an error occurs.

◆ Concatenate() [2/2]

char * Ace::Concatenate ( int  numStrings,
  ... 
)
static

Appends a series of strings together.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* completeStr = Ace::Concatenate(3, "Everything", "Everything", "Everything");
printf("%s\n", completeStr);
_aligned_free(completeStr);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:EverythingEverythingEverything.

Parameters
[in]numStringsNumber of strings to append.
[in]...Variable arguments providing additional strings.
Returns
A combined string of all the strings in the arguments. Throws an exception if an error occurs.

◆ ConcatenateStrings() [1/8]

bool Ace::ConcatenateStrings ( char *  destination,
const int &  numStrings,
const char **  stringArray 
)
static

Appends an array of strings together and stores it in the provided destination buffer.

Author
Eddie O'Hagan
Date
4/2/2022
try
{
char destination[1024];
const char* stringArray[4] = { "Everything", "Everything", "Everything", "Everything" };
if (Ace::ConcatenateStrings(destination, 4, stringArray) == true)
{
printf("%s\n", destination);
}
else
{
printf("%s\n", "Failed to concatenate strings.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char * ConcatenateStrings(const int &numStrings, char **stringArray)
Appends an array of strings together and returns the combined string.
Definition: Ace.cpp:3382

Output:EverythingEverythingEverythingEverything

Parameters
destinationThe buffer to store the concatenated strings in.
numStringsNumber of strings to append.
[in]stringArrayThe array of strings to append.
Returns
true if concatenation was a success, false otherwise. If an error occurs, an exception is thrown.

◆ ConcatenateStrings() [2/8]

bool Ace::ConcatenateStrings ( char *  destination,
const vector< const char * > &  stringVectorArray 
)
static

Appends a vector array of strings together and stores the result in the provided destination buffer.

Author
Eddie O'Hagan
Date
4/2/2022
try
{
char destination[1024];
vector<const char*> stringVectorArray;
for (int currIndex = 1; currIndex <= 4; currIndex++)
{
stringVectorArray.push_back("Everything");
}
if (Ace::ConcatenateStrings(destination, stringVectorArray) == true)
{
printf("%s\n", destination);
}
else
{
printf("%s", "Failed to concatenate strings.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:EverythingEverythingEverythingEverything

Parameters
[in]stringVectorArrayThe vector array of strings to append.
Returns
true if the concatenation was successful, false otherwise. If an error occurs, an exception is thrown.

◆ ConcatenateStrings() [3/8]

char * Ace::ConcatenateStrings ( const int &  numStrings,
char **  stringArray 
)
static

Appends an array of strings together and returns the combined string.

Author
Eddie O'Hagan
Date
3/2/2022
try
{
char** stringArray = (char**)Ace::_Aligned_Malloc(4 * sizeof(char*));
for (int currIndex = 0; currIndex < 4; currIndex++)
{
stringArray[currIndex] = Ace::AllocateAndCopyString("Everything");
}
char* completeStr = Ace::ConcatenateStrings(4, stringArray);
printf("%s\n", completeStr);
for (int currIndex = 0; currIndex < 4; currIndex++)
{
_aligned_free(stringArray[currIndex]);
}
_aligned_free(stringArray);
_aligned_free(completeStr);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:EverythingEverythingEverythingEverything

Parameters
numStringsNumber of strings to append.
[in]stringArrayThe array of strings to append.
Returns
A combined string of all the strings in the array. If an error occurs, an exception is thrown.

◆ ConcatenateStrings() [4/8]

wchar_t * Ace::ConcatenateStrings ( const int &  numStrings,
wchar_t **  stringArray 
)
static

Appends an array of strings together and returns the combined string.

Author
Eddie O'Hagan
Date
3/2/2022
try
{
wchar_t** stringArray = (wchar_t**)Ace::_Aligned_Malloc(4 * sizeof(wchar_t*));
for (int currIndex = 0; currIndex < 4; currIndex++)
{
stringArray[currIndex] = Ace::AllocateAndCopyString(L"Бля");
}
wchar_t* completeStr = Ace::ConcatenateStrings(4, stringArray);
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"Russian", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%ls\n", completeStr);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
for (int currIndex = 0; currIndex < 4; currIndex++)
{
_aligned_free(stringArray[currIndex]);
}
_aligned_free(stringArray);
_aligned_free(completeStr);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:БляБляБляБля

Parameters
numStringsNumber of strings to append.
[in]stringArrayThe array of strings to append.
Returns
A combined string of all the strings in the array. If an error occurs, an exception is thrown.

◆ ConcatenateStrings() [5/8]

char * Ace::ConcatenateStrings ( const vector< const char * > &  stringVectorArray)
static

Appends a vector array of strings together and returns the combined string.

Author
Eddie O'Hagan
Date
5/6/2016
try
{
vector<const char*> stringVectorArray;
for (int currIndex = 1; currIndex <= 4; currIndex++)
{
stringVectorArray.push_back("Everything");
}
char* completeStr = Ace::ConcatenateStrings(stringVectorArray);
printf("%s\n", completeStr);
_aligned_free(completeStr);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:EverythingEverythingEverythingEverything

Parameters
[in]stringVectorArrayThe vector array of strings to append.
Returns
A combined string of all the strings in the array. If an error occurs, an exception is thrown.

◆ ConcatenateStrings() [6/8]

wchar_t * Ace::ConcatenateStrings ( const vector< const wchar_t * > &  stringVectorArray)
static

Appends a vector array of wide strings together and returns the combined wide string.

Author
Eddie O'Hagan
Date
9/4/2016
try
{
vector<const wchar_t*> stringVectorArray;
for (int currIndex = 1; currIndex <= 4; currIndex++)
{
stringVectorArray.push_back(L"Everything");
}
wchar_t* completeStr = Ace::ConcatenateStrings(stringVectorArray);
wprintf(L"%ls\n", completeStr);
_aligned_free(completeStr);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:EverythingEverythingEverythingEverything.

Parameters
[in]stringVectorArrayThe vector array of strings to append.
Returns
A combined string of all the strings in the array. If an error occurs, an exception is thrown.

◆ ConcatenateStrings() [7/8]

bool Ace::ConcatenateStrings ( wchar_t *  destination,
const int &  numStrings,
const wchar_t **  stringArray 
)
static

Appends an array of strings together and stores it in the provided destination buffer.

Author
Eddie O'Hagan
Date
4/2/2022
try
{
wchar_t destination[1024];
const wchar_t* stringArray[4] = { L"万事", L"万事", L"万事", L"万事" };
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
if (Ace::ConcatenateStrings(destination, 4, stringArray) == true)
{
wprintf(L"%ls\n", destination);
}
else
{
printf("%s\n", "Failed to concatenate strings.");
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:万事万事万事万事

Parameters
destinationThe buffer to store the concatenated strings in.
numStringsNumber of strings to append.
[in]stringArrayThe array of strings to append.
Returns
true if concatenation was a success, false otherwise. If an error occurs, an exception is thrown.

◆ ConcatenateStrings() [8/8]

bool Ace::ConcatenateStrings ( wchar_t *  destination,
const vector< const wchar_t * > &  stringVectorArray 
)
static

Appends a vector array of wide strings together and returns the combined wide string.

Author
Eddie O'Hagan
Date
4/2/2022
try
{
wchar_t destination[1024];
vector<const wchar_t*> stringVectorArray;
for (int currIndex = 1; currIndex <= 4; currIndex++)
{
stringVectorArray.push_back(L"万事");
}
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
if (Ace::ConcatenateStrings(destination, stringVectorArray) == true)
{
wprintf(L"%ls\n", destination);
}
else
{
printf("%s\n", "Failed to concatenate strings.");
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:万事万事万事万事.

Parameters
[in]stringVectorArrayThe vector array of strings to append.
Returns
A combined string of all the strings in the array. If an error occurs, an exception is thrown.

◆ ConcatenateW() [1/2]

wchar_t * Ace::ConcatenateW ( int  numWideStrings,
  ... 
)
static

Appends a series of strings together.

Author
Eddie O'Hagan
Date
9/5/2016
try
{
wchar_t* completeStr = Ace::ConcatenateW(3, L"ทุกอย่าง", L"ทุกอย่าง", L"ทุกอย่าง");
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Tahoma", L"Thai", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%ls\n", completeStr);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
_aligned_free(completeStr);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static wchar_t * ConcatenateW(int numWideStrings,...)
Appends a series of strings together.
Definition: Ace.cpp:4296

Output:ทุกอย่างทุกอย่างทุกอย่าง

Parameters
[in]numStringsNumber of strings to append.
[in]...Variable arguments providing additional strings.
Returns
A combined string of all the strings in the arguments. Throws an exception if an error occurs.

◆ ConcatenateW() [2/2]

bool Ace::ConcatenateW ( wchar_t *  destination,
int  numWideStrings,
  ... 
)
static

Appends a series of strings together.

Author
Eddie O'Hagan
Date
4/2/2022
try
{
wchar_t destination[1024];
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Tahoma", L"Thai", fontFamily, fontWeight, 12, 20);
if (success == true)
{
if (Ace::ConcatenateW(destination, 3, L"ทุกอย่าง", L"ทุกอย่าง", L"ทุกอย่าง") == true)
{
wprintf(L"%s\n", destination);
}
else
{
printf("%s\n", "Failed to concatenate strings.");
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:ทุกอย่างทุกอย่างทุกอย่าง

Parameters
[in]destinationThe Destination Buffer to store the concatenation.
[in]numStringsNumber of strings to append.
[in]...Variable arguments providing additional strings.
Returns
A combined string of all the strings in the arguments. Throws an exception if an error occurs.

◆ Contains() [1/2]

bool Ace::Contains ( const char *  strToSearch,
const char *  strToLookFor 
)
static

Searches strToSearch for the first occurrence of strToLookFor and returns true if found.

Author
Eddie O'Hagan
Date
3/2/2022
try
{
bool result = Ace::Contains("My name is Eddie and I like cheese.", "Eddie");
if (result == true)
{
printf("%s\n", "Contains the word.");
}
else
{
printf("%s\n", "Does not contain the word.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:Contains the word.

Parameters
[in]strToSearchString to search starting from left to right.
[in]strToLookForString to look for inside of strToSearch.
Returns
true if strToSearch contains strToLookFor, false otherwise. Throws an exception if error occurs.

◆ Contains() [2/2]

bool Ace::Contains ( const wchar_t *  strToSearch,
const wchar_t *  strToLookFor 
)
static

Searches strToSearch for the first occurrence of strToLookFor and returns true if found.

Author
Eddie O'Hagan
Date
3/2/2022
try
{
bool result = Ace::Contains(L"私は エヂイ です。", L"エヂイ");
if (result == true)
{
wprintf(L"%ls\n", L"Contains the word.");
}
else
{
wprintf(L"%ls\n", L"Does not contain the word.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Contains the word.

Parameters
[in]strToSearchWide String to search starting from left to right.
[in]strToLookForWide String to look for inside of strToSearch.
Returns
true if strToSearch contains strToLookFor, false otherwise. Throws an exception if error occurs.

◆ ContainsIgnoreCase() [1/2]

bool Ace::ContainsIgnoreCase ( const char *  strToSearch,
const char *  strToLookFor 
)
static

Searches strToSearch for the first occurrence of strToLookFor (regardless of case) and returns true if found.

Author
Eddie O'Hagan
Date
5/26/2016
try
{
bool result = Ace::ContainsIgnoreCase("My name is eddIe and I like cheese.", "EdDIe");
if (result == true)
{
printf("%s\n", "Contains the word.");
}
else
{
printf("%s\n", "Does not contain the word.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:Contains the word.

Parameters
[in]strToSearchString to search starting from left to right.
[in]strToLookForString to look for inside of strToSearch.
Returns
true if strToSearch contains strToLookFor, false otherwise. Throws an exception if error occurs.

◆ ContainsIgnoreCase() [2/2]

bool Ace::ContainsIgnoreCase ( const wchar_t *  strToSearch,
const wchar_t *  strToLookFor 
)
static

Searches strToSearch for the first occurrence of strToLookFor (regardless of case) and returns true if found.

Author
Eddie O'Hagan
Date
9/5/2016
try
{
bool result = Ace::ContainsIgnoreCase(L"My name is eddIe and I like cheese.", L"EdDIe");
if (result == true)
{
printf("%ls\n", L"Contains the word.");
}
else
{
printf("%ls\n", L"Does not contain the word.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Contains the word.

Parameters
[in]strToSearchWide String to search starting from left to right.
[in]strToLookForWide String to look for inside of strToSearch.
Returns
true if strToSearch contains strToLookFor, false otherwise. Throws an exception if error occurs.

◆ ConvertDoubleToBool()

bool Ace::ConvertDoubleToBool ( const double &  num)
static

By definition, false is equal to 0 and true is equal to anything but 0.

In other words, any positive or negative number returns true, if num is 0 then false.

Author
Eddie O'Hagan
Date
10/20/2016
bool data = Ace::ConvertDoubleToBool(0.0);
if (data == true)
{
printf("%s", "true");
}
else
{
printf("%s", "false");
}
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

Output:false

Parameters
[in]numThe number to determine if true or false.
Returns
true or false based on the value of num.

◆ ConvertFloatToBool()

bool Ace::ConvertFloatToBool ( const float &  num)
static

By definition, false is equal to 0 and true is equal to anything but 0.

In other words, any positive or negative number returns true, if num is 0 then false.

Author
Eddie O'Hagan
Date
10/20/2016
bool data = Ace::ConvertFloatToBool(0.0f);
if (data == true)
{
printf("%s", "true");
}
else
{
printf("%s", "false");
}
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

Output:false

Parameters
[in]numThe number to determine if true or false.
Returns
true or false based on the value of num.

◆ ConvertIntToBool()

bool Ace::ConvertIntToBool ( const int &  num)
static

By definition, false is equal to 0 and true is equal to anything but 0.

In other words, any positive or negative number returns true, if num is 0 then false.

Author
Eddie O'Hagan
Date
5/7/2016
bool data = Ace::ConvertIntToBool(0);
if (data == true)
{
printf("%s", "true");
}
else
{
printf("%s", "false");
}
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

Output:false

Parameters
[in]numThe number to determine if true or false.
Returns
true or false based on the value of num.

◆ ConvertIntToString()

char * Ace::ConvertIntToString ( const int &  integerToConvert)
static

Returns a buffer containing the result of _itoa_s() using integerToConvert.

Author
Eddie O'Hagan
Date
10/19/2016
try
{
char* str = Ace::ConvertIntToString(989969);
printf("%s\n", str);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char * ConvertIntToString(const int &integerToConvert)
Returns a buffer containing the result of _itoa_s() using integerToConvert.
Definition: Ace.cpp:4818

Output:989969

Parameters
integerToConvertThe integer to pass to _itoa_s().
Returns
A buffer containing the converted integerToConvert.

◆ ConvertIntToWideString()

wchar_t * Ace::ConvertIntToWideString ( const int &  integerToConvert)
static

Returns a buffer containing the result of _itow_s() using integerToConvert.

Author
Eddie O'Hagan
Date
10/19/2016
try
{
wchar_t* str = Ace::ConvertIntToWideString(989969);
printf("%ls\n", str);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static wchar_t * ConvertIntToWideString(const int &integerToConvert)
Returns a buffer containing the result of _itow_s() using integerToConvert.
Definition: Ace.cpp:4880

Output:989969

Parameters
integerToConvertThe integer to pass to _itow_s().
Returns
A buffer containing the converted integerToConvert.

◆ ConvertLongToBool()

bool Ace::ConvertLongToBool ( const long &  num)
static

By definition, false is equal to 0 and true is equal to anything but 0.

In other words, any positive or negative number returns true, if num is 0 then false.

Author
Eddie O'Hagan
Date
7/23/2023
bool data = Ace::ConvertLongToBool(0);
if (data == true)
{
printf("%s", "true");
}
else
{
printf("%s", "false");
}
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

Output:false

Parameters
[in]numThe number to determine if true or false.
Returns
true or false based on the value of num.

◆ ConvertLongToString()

char * Ace::ConvertLongToString ( const long &  longToConvert)
static

Returns a buffer containing the result of snprintf() using integerToConvert.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
char* str = Ace::ConvertLongToString(2147483647);
printf("%s\n", str);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char * ConvertLongToString(const long &longToConvert)
Returns a buffer containing the result of snprintf() using integerToConvert.
Definition: Ace.cpp:4980

Output:2147483647

Parameters
integerToConvertThe integer to pass to snprintf().
Returns
A buffer containing the converted integerToConvert.

◆ ConvertLongToWideString()

wchar_t * Ace::ConvertLongToWideString ( const long &  longToConvert)
static

Returns a buffer containing the result of swprintf() using longToConvert.

Author
Eddie O'Hagan
Date
8/11/2023
try
{
wchar_t* str = Ace::ConvertLongToWideString((long)2147483647);
printf("%ls\n", str);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static wchar_t * ConvertLongToWideString(const long &longToConvert)
Returns a buffer containing the result of swprintf() using longToConvert.
Definition: Ace.cpp:5046

Output:2147483647

Parameters
longToConvertThe integer to pass to swprintf().
Returns
A buffer containing the converted longToConvert.

◆ ConvertStringArrayToStringVectorArray() [1/2]

vector< char * > Ace::ConvertStringArrayToStringVectorArray ( char **  stringArray)
static

Converts a traditional string array to a vector string array.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char** strArray = (char**)Ace::_Aligned_Malloc(4 * sizeof(char*), 16);
for (int currIndex = 0; currIndex < 4; currIndex++)
{
strArray[currIndex] = (char*)Ace::_Aligned_Malloc(32 * sizeof(char), 16);
memset(strArray[currIndex], 0, 32 * sizeof(char));
_itoa_s(currIndex, strArray[currIndex], 32, 10);
}
vector<char*> stringVectorArray = Ace::ConvertStringArrayToStringVectorArray(strArray);
for (int currIndex = 0; currIndex < 4; currIndex++)
{
printf("strVectorArray[%d]:%s\n", currIndex, stringVectorArray[currIndex]);
_aligned_free(strArray[currIndex]);
}
_aligned_free(strArray);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static vector< char * > ConvertStringArrayToStringVectorArray(char **stringArray)
Converts a traditional string array to a vector string array.
Definition: Ace.cpp:5127

Output:strVectorArray[0]:0 strVectorArray[1]:1 strVectorArray[2]:2 strVectorArray[3]:3

Parameters
[in]stringArrayThe string array to convert.
Returns
A string vector array. If stringArray is NULL, an exception is thrown.

◆ ConvertStringArrayToStringVectorArray() [2/2]

vector< wchar_t * > Ace::ConvertStringArrayToStringVectorArray ( wchar_t **  stringArray)
static

Converts a traditional wide string array to a vector wide string array.

Author
Eddie O'Hagan
Date
9/5/2016
try
{
wchar_t** strArray = (wchar_t**)Ace::_Aligned_Malloc(4 * sizeof(wchar_t*), 16);
for (int currIndex = 0; currIndex < 4; currIndex++)
{
strArray[currIndex] = (wchar_t*)Ace::_Aligned_Malloc(32 * sizeof(wchar_t), 16);
memset(strArray[currIndex], 0, 32 * sizeof(wchar_t));
_itow_s(currIndex, strArray[currIndex], 32, 10);
}
vector<wchar_t*> stringVectorArray = Ace::ConvertStringArrayToStringVectorArray(strArray);
for (int currIndex = 0; currIndex < 4; currIndex++)
{
printf("strVectorArray[%d]:%ls\n", currIndex, stringVectorArray[currIndex]);
_aligned_free(strArray[currIndex]);
}
_aligned_free(strArray);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:strVectorArray[0]:0 strVectorArray[1]:1 strVectorArray[2]:2 strVectorArray[3]:3

Parameters
[in]stringArrayThe wide string array to convert.
Returns
A wide string vector array. If stringArray is NULL, an exception is thrown.

◆ ConvertStringFullWidthToHalfWidth() [1/4]

char * Ace::ConvertStringFullWidthToHalfWidth ( const char *  fullWidthStr)
static

Converts a string containing "full width" characters to the corresponding "half width" characters.

In Unicode, there are "full width" versions of regular ASCII characters such as the number 4 (4) or the letter B (B) for example. This means we can convert full width versions and the half width versions and vice versa.

However, this will only work with the Unicode characters between Full Width Exclamation Mark (0xFF01) to Full Width Tilda (0xFF5E) which line up perfectly with the ASCII chart (33 to 126 respectively). If a character is not in the corresponding ASCII range, an exception is thrown.

Author
Eddie O'Hagan
Date
7/28/2023
try
{
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Tahoma", L"Thai", fontFamily, fontWeight, 12, 20);
if (success == true)
{
char* halfWidthStr = Ace::ConvertStringFullWidthToHalfWidth("!! \\"\" ## $$ %% && ' ( ) * + , - . / 0 10 21 32 43 54 65 76 87 98 : ; < = > ? @ A B C D E F G H I J K L M N O pP qQ R S T U V W X Y Z [ \ ] ^ _ ` a bb c d e f g h i j k l m n o p q r s t u v w x y z { | } ~");
if (halfWidthStr != NULL)
{
printf("%s\n", halfWidthStr);
_aligned_free(halfWidthStr);
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char * ConvertStringFullWidthToHalfWidth(const char *fullWidthStr)
Converts a string containing "full width" characters to the corresponding "half width" characters.
Definition: Ace.cpp:5252

Output: !! "" ## $$ %% && ' ( ) * + , - . / 0 10 21 32 43 54 65 76 87 98 : ; < = > ? @ A B C D E F G H I J K L M N O pP qQ R S T U V W X Y Z [ \ ] ^ _ ` a bb c d e f g h i j k l m n o p q r s t u v w x y z { | } ~

Parameters
[in]fullWidthStrThe string containing the Full Width characters.
Returns
On success, an allocated string containing the converted characters. NULL otherwise.

◆ ConvertStringFullWidthToHalfWidth() [2/4]

bool Ace::ConvertStringFullWidthToHalfWidth ( const char *  fullWidthStr,
char *  outHalfWidthStr 
)
static

Converts a string containing "full width" characters to the corresponding "half width" characters.

In Unicode, there are "full width" versions of regular ASCII characters such as the number 4 (4) or the letter B (B) for example. This means we can convert full width versions and the half width versions and vice versa.

However, this will only work with the Unicode characters between Full Width Exclamation Mark (0xFF01) to Full Width Tilda (0xFF5E) which line up perfectly with the ASCII chart (33 to 126 respectively). If a character is not in the corresponding ASCII range, an exception is thrown.

Author
Eddie O'Hagan
Date
7/28/2023
try
{
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Tahoma", L"Thai", fontFamily, fontWeight, 12, 20);
if (success == true)
{
char halfWidthStr[1024] = "\0";
const char* fullWidthStr = "!! \\"\" ## $$ %% && ' ( ) * + , - . / 0 10 21 32 43 54 65 76 87 98 : ; < = > ? @ A B C D E F G H I J K L M N O pP qQ R S T U V W X Y Z [ \ ] ^ _ ` a bb c d e f g h i j k l m n o p q r s t u v w x y z { | } ~";
if (Ace::ConvertStringFullWidthToHalfWidth(fullWidthStr, halfWidthStr) == true)
{
printf("%s\n", halfWidthStr);
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output: !! "" ## $$ %% && ' ( ) * + , - . / 0 10 21 32 43 54 65 76 87 98 : ; < = > ? @ A B C D E F G H I J K L M N O pP qQ R S T U V W X Y Z [ \ ] ^ _ ` a bb c d e f g h i j k l m n o p q r s t u v w x y z { | } ~

Parameters
[in]fullWidthStrThe string containing the Full Width characters.
[out]outHalfWidthStrThe output string containing the converted characters.
Returns
true on successful conversion of every character, false otherwise.

◆ ConvertStringFullWidthToHalfWidth() [3/4]

wchar_t * Ace::ConvertStringFullWidthToHalfWidth ( const wchar_t *  fullWidthStr)
static

Converts a string containing "full width" characters to the corresponding "half width" characters.

In Unicode, there are "full width" versions of regular ASCII characters such as the number 4 (4) or the letter B (B) for example. This means we can convert full width versions and the half width versions and vice versa.

However, this will only work with the Unicode characters between Full Width Exclamation Mark (0xFF01) to Full Width Tilda (0xFF5E) which line up perfectly with the ASCII chart (33 to 126 respectively). If a character is not in the corresponding ASCII range, an exception is thrown.

Author
Eddie O'Hagan
Date
7/28/2023
try
{
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Tahoma", L"Thai", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wchar_t* halfWidthStr = Ace::ConvertStringFullWidthToHalfWidth(L"!! \\"\" ## $$ %% && ' ( ) * + , - . / 0 10 21 32 43 54 65 76 87 98 : ; < = > ? @ A B C D E F G H I J K L M N O pP qQ R S T U V W X Y Z [ \ ] ^ _ ` a bb c d e f g h i j k l m n o p q r s t u v w x y z { | } ~");
if (halfWidthStr != NULL)
{
wprintf(L"%s\n", halfWidthStr);
_aligned_free(halfWidthStr);
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output: !! "" ## $$ %% && ' ( ) * + , - . / 0 10 21 32 43 54 65 76 87 98 : ; < = > ? @ A B C D E F G H I J K L M N O pP qQ R S T U V W X Y Z [ \ ] ^ _ ` a bb c d e f g h i j k l m n o p q r s t u v w x y z { | } ~

Parameters
[in]fullWidthStrThe string containing the Full Width characters.
Returns
On success, an allocated string containing the converted characters. NULL otherwise.

◆ ConvertStringFullWidthToHalfWidth() [4/4]

bool Ace::ConvertStringFullWidthToHalfWidth ( const wchar_t *  fullWidthStr,
wchar_t *  outHalfWidthStr 
)
static

Converts a string containing "full width" characters to the corresponding "half width" characters.

In Unicode, there are "full width" versions of regular ASCII characters such as the number 4 (4) or the letter B (B) for example. This means we can convert full width versions and the half width versions and vice versa.

However, this will only work with the Unicode characters between Full Width Exclamation Mark (0xFF01) to Full Width Tilda (0xFF5E) which line up perfectly with the ASCII chart (33 to 126 respectively). If a character is not in the corresponding ASCII range, an exception is thrown.

Author
Eddie O'Hagan
Date
7/28/2023
try
{
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Tahoma", L"Thai", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wchar_t halfWidthStr[1024] = L"\0";
const wchar_t* fullWidthStr = L"!! \\"\" ## $$ %% && ' ( ) * + , - . / 0 10 21 32 43 54 65 76 87 98 : ; < = > ? @ A B C D E F G H I J K L M N O pP qQ R S T U V W X Y Z [ \ ] ^ _ ` a bb c d e f g h i j k l m n o p q r s t u v w x y z { | } ~";
if (Ace::ConvertStringFullWidthToHalfWidth(fullWidthStr, halfWidthStr) == true)
{
wprintf(L"%s\n", halfWidthStr);
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:!! "" ## $$ %% && ' ( ) * + , - . / 0 10 21 32 43 54 65 76 87 98 : ; < = > ? @ A B C D E F G H I J K L M N O pP qQ R S T U V W X Y Z [ \ ] ^ _ ` a bb c d e f g h i j k l m n o p q r s t u v w x y z { | } ~

Parameters
[in]fullWidthStrThe string containing the Full Width characters.
[out]outHalfWidthStrThe output string containing the converted characters.
Returns
true on successful conversion of every character, false otherwise.

◆ ConvertStringHalfWidthToFullWidth() [1/4]

char * Ace::ConvertStringHalfWidthToFullWidth ( const char *  halfWidthStr)
static

Converts a string containing "half width" characters to the corresponding "full width" characters.

In Unicode, there are "full width" versions of regular ASCII characters such as the number 4 (4) or the letter B (B) for example. This means we can convert full width versions and the half width versions and vice versa.

However, this will only work with the Unicode characters between Full Width Exclamation Mark (0xFF01) to Full Width Tilda (0xFF5E) which line up perfectly with the ASCII chart (33 to 126 respectively). If a character is not in the corresponding ASCII range, an exception is thrown.

Author
Eddie O'Hagan
Date
7/28/2023
try
{
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Tahoma", L"Japanese", fontFamily, fontWeight, 12, 20);
if (success == true)
{
setlocale(LC_ALL, "");
const char* halfWidthStr = "!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~";
char* fullWidthStr = Ace::ConvertStringHalfWidthToFullWidth(halfWidthStr);
if (fullWidthStr != NULL)
{
printf("%s\n", fullWidthStr);
_aligned_free(fullWidthStr);
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char * ConvertStringHalfWidthToFullWidth(const char *halfWidthStr)
Converts a string containing "half width" characters to the corresponding "full width" characters.
Definition: Ace.cpp:5640

Output: !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~

Parameters
[in]halfWidthStrThe string containing the Half Width characters.
Returns
On success, an allocated string containing the converted characters. NULL otherwise.

◆ ConvertStringHalfWidthToFullWidth() [2/4]

bool Ace::ConvertStringHalfWidthToFullWidth ( const char *  halfWidthStr,
char *  outFullWidthStr 
)
static

Converts a string containing "half width" characters to the corresponding "full width" characters.

In Unicode, there are "full width" versions of regular ASCII characters such as the number 4 (4) or the letter B (B) for example. This means we can convert full width versions and the half width versions and vice versa.

However, this will only work with the Unicode characters between Full Width Exclamation Mark (0xFF01) to Full Width Tilda (0xFF5E) which line up perfectly with the ASCII chart (33 to 126 respectively). If a character is not in the corresponding ASCII range, an exception is thrown.

Author
Eddie O'Hagan
Date
7/30/2023
try
{
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Tahoma", L"Japanese", fontFamily, fontWeight, 12, 20);
if (success == true)
{
setlocale(LC_ALL, "");
char fullWidthStr[1024] = "\0";
const char* halfWidthStr = "!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~";
if (Ace::ConvertStringHalfWidthToFullWidth(halfWidthStr, fullWidthStr) == true)
{
printf("%s\n", fullWidthStr);
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~

Parameters
[in]halfWidthStrThe string containing the Half Width characters.
[out]outHalfWidthStrThe output string containing the converted characters.
Returns
true on successful conversion of every character, false otherwise.

◆ ConvertStringHalfWidthToFullWidth() [3/4]

wchar_t * Ace::ConvertStringHalfWidthToFullWidth ( const wchar_t *  halfWidthStr)
static

Converts a string containing "half width" characters to the corresponding "full width" characters.

In Unicode, there are "full width" versions of regular ASCII characters such as the number 4 (4) or the letter B (B) for example. This means we can convert full width versions and the half width versions and vice versa.

However, this will only work with the Unicode characters between Full Width Exclamation Mark (0xFF01) to Full Width Tilda (0xFF5E) which line up perfectly with the ASCII chart (33 to 126 respectively). If a character is not in the corresponding ASCII range, an exception is thrown.

Author
Eddie O'Hagan
Date
7/28/2023
try
{
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Tahoma", L"Japanese", fontFamily, fontWeight, 12, 20);
if (success == true)
{
setlocale(LC_ALL, "");
const wchar_t* halfWidthStr = L"!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~";
wchar_t* fullWidthStr = Ace::ConvertStringHalfWidthToFullWidth(halfWidthStr);
if (fullWidthStr != NULL)
{
wprintf(L"%s\n", fullWidthStr);
_aligned_free(fullWidthStr);
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output: !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~

Parameters
[in]halfWidthStrThe string containing the Half Width characters.
Returns
On success, an allocated string containing the converted characters. NULL otherwise.

◆ ConvertStringHalfWidthToFullWidth() [4/4]

bool Ace::ConvertStringHalfWidthToFullWidth ( const wchar_t *  halfWidthStr,
wchar_t *  outFullWidthStr 
)
static

Converts a string containing "half width" characters to the corresponding "full width" characters.

In Unicode, there are "full width" versions of regular ASCII characters such as the number 4 (4) or the letter B (B) for example. This means we can convert full width versions and the half width versions and vice versa.

However, this will only work with the Unicode characters between Full Width Exclamation Mark (0xFF01) to Full Width Tilda (0xFF5E) which line up perfectly with the ASCII chart (33 to 126 respectively). If a character is not in the corresponding ASCII range, an exception is thrown.

Author
Eddie O'Hagan
Date
7/30/2023
try
{
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Tahoma", L"Japanese", fontFamily, fontWeight, 12, 20);
if (success == true)
{
setlocale(LC_ALL, "");
wchar_t fullWidthStr[1024] = L"\0";
const wchar_t* halfWidthStr = L"!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~";
if (Ace::ConvertStringHalfWidthToFullWidth(halfWidthStr, fullWidthStr) == true)
{
wprintf(L"%s\n", fullWidthStr);
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~

Parameters
[in]halfWidthStrThe string containing the Half Width characters.
[out]outHalfWidthStrThe output string containing the converted characters.
Returns
true on successful conversion of every character, false otherwise.

◆ ConvertStringToBool() [1/2]

bool Ace::ConvertStringToBool ( const char *  str)
static

Converts a given string to a bool, If str is a string like "False", "FALSE", or "tRuE", then the function will return false, false, true respectively.

If str is an integer for example; "0" will return false and any other number will return true.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
bool data = Ace::ConvertStringToBool("tRuE");
if (data == true)
{
printf("%s", "true");
}
else
{
printf("%s", "false");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:true

Parameters
[in]strString to convert.
Returns
true if str is equal to "true" (any case combination) or if str is an integer not equal to 0; false otherwise. Throws an exception if str is NULL.

◆ ConvertStringToBool() [2/2]

bool Ace::ConvertStringToBool ( const wchar_t *  str)
static

Converts a given wide string to a bool, If str is a wide string like "False", "FALSE", or "tRuE", then the function will return false, false, true respectively.

If str is an integer for example; "0" will return false and any other number will return true.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
bool data = Ace::ConvertStringToBool(L"tRuE");
if (data == true)
{
wprintf(L"%ls", L"true");
}
else
{
wprintf(L"%ls", L"false");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:true

Parameters
[in]strWide String to convert.
Returns
true if str is equal to "true" (any case combination) or if str is an integer not equal to 0; false otherwise. Throws an exception if str is NULL.

◆ ConvertStringToDouble() [1/2]

double Ace::ConvertStringToDouble ( const char *  str)
static

Converts a string to its double value.

Author
Eddie O'Hagan
Date
7/23/2023
double data = Ace::ConvertStringToDouble("0.42069");
printf("Value: %f\n", data);
static double ConvertStringToDouble(const char *str)
Converts a string to its double value.
Definition: Ace.cpp:6377

Output: Value: 0.420690

Parameters
[in]strString to convert to double.
Returns
The double value of the string.

◆ ConvertStringToDouble() [2/2]

double Ace::ConvertStringToDouble ( const wchar_t *  str)
static

Converts a string to its double value.

Author
Eddie O'Hagan
Date
7/23/2023
const wchar_t* strToConvert = L"0.42069"; //String containing wide characters.
wchar_t convertedStr[128];
if (Ace::ConvertStringFullWidthToHalfWidth(strToConvert, convertedStr) == true)
{
double data = Ace::ConvertStringToDouble(convertedStr);
wprintf(L"Value: %f\n", data);
}

Output:Value: 0.420690

Parameters
[in]strString to convert to double.
Returns
The double value of the string.

◆ ConvertStringToFloat() [1/2]

float Ace::ConvertStringToFloat ( const char *  str)
static

Converts a string to its float value.

Author
Eddie O'Hagan
Date
7/23/2023
float data = Ace::ConvertStringToFloat("0.42069");
printf("Value: %f\n", data);
static float ConvertStringToFloat(const char *str)
Converts a string to its float value.
Definition: Ace.cpp:6450

Output: Value: 0.420690

Parameters
[in]strString to convert to float.
Returns
The float value of the string.

◆ ConvertStringToFloat() [2/2]

float Ace::ConvertStringToFloat ( const wchar_t *  str)
static

Converts a string to its float value.

Author
Eddie O'Hagan
Date
7/23/2023
float data = Ace::ConvertStringToFloat(L"0.42069");
printf("Value: %f\n", data);

Output:Value: 0.420690

Parameters
[in]strString to convert to float.
Returns
The float value of the string.

◆ ConvertStringToFloatArray() [1/2]

float * Ace::ConvertStringToFloatArray ( const char *  strToConvert,
const char *  delimiter,
int &  outNumItems 
)
static

Converts a tokenized string (a string with commas separating numbers for example) to an array of floats.

Author
Eddie O'Hagan
Date
6/26/2016
try
{
int numItems = 0;
const char* strPosition = "0.0, 1.0f, 2.0";
float* floatArray = Ace::ConvertStringToFloatArray(strPosition, ",", numItems);
for (int currIndex = 0; currIndex < numItems; currIndex++)
{
printf("floatArray[%d]: %f\n", currIndex, floatArray[currIndex]);
}
_aligned_free(floatArray);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:floatArray[0]: 0.000000 floatArray[1]: 1.000000 floatArray[2]: 2.000000

Parameters
[in]strToConvertString to convert.
[in]delimiterString that separates each number.
[out]outNumItemsSize of the array.
Returns
A newly allocated array of floats. Throws an exception if an error occurs.

◆ ConvertStringToFloatArray() [2/2]

float * Ace::ConvertStringToFloatArray ( const wchar_t *  strToConvert,
const wchar_t *  delimiter,
int &  outNumItems 
)
static

Converts a tokenized wide string (a string with commas separating numbers for example) to an array of floats.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
int numItems = 0;
const wchar_t* strPosition = L"0.0, 1.0f, 2.0";
float* floatArray = Ace::ConvertStringToFloatArray(strPosition, L",", numItems);
for (int currIndex = 0; currIndex < numItems; currIndex++)
{
wprintf(L"floatArray[%d]: %f\n", currIndex, floatArray[currIndex]);
}
_aligned_free(floatArray);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:floatArray[0]: 0.000000 floatArray[1]: 1.000000 floatArray[2]: 2.000000

Parameters
[in]strToConvertString to convert.
[in]delimiterString that separates each number.
[out]outNumItemsSize of the array.
Returns
A newly allocated array of floats. Throws an exception if an error occurs.

◆ ConvertStringToHex() [1/2]

unsigned int Ace::ConvertStringToHex ( const char *  str)
static

Converts a string to its hex value.

Author
Eddie O'Hagan
Date
5/7/2016
unsigned int data = Ace::ConvertStringToHex("0xDEADBEEF");
printf("Hex Value: %x\n", data);
printf("Integer Value: %u\n", data);
static unsigned int ConvertStringToHex(const char *str)
Converts a string to its hex value.
Definition: Ace.cpp:6321

Output:Hex Value: deadbeef Integer Value: 305419896.

Parameters
[in]strString to convert to hex.
Returns
The hex value of the string.

◆ ConvertStringToHex() [2/2]

unsigned int Ace::ConvertStringToHex ( const wchar_t *  str)
static

Converts a string to its hex value.

Author
Eddie O'Hagan
Date
9/7/2016
unsigned int data = Ace::ConvertStringToHex(L"0xDEADBEEF");
printf("Hex Value: %x\n", data);
printf("Integer Value: %u\n", data);

Output:Hex Value: deadbeef Integer Value: 305419896.

Parameters
[in]strString to convert to hex.
Returns
The hex value of the string.

◆ ConvertStringToInteger() [1/2]

int Ace::ConvertStringToInteger ( const char *  str)
static

Converts a string to its integer value.

Author
Eddie O'Hagan
Date
7/23/2023
int data = Ace::ConvertStringToInteger("42069");
printf("Value: %d\n", data);
static int ConvertStringToInteger(const char *str)
Converts a string to its integer value.
Definition: Ace.cpp:6504

Output:Value: 42069

Parameters
[in]strString to convert to integer.
Returns
The integer value of the string.

◆ ConvertStringToInteger() [2/2]

int Ace::ConvertStringToInteger ( const wchar_t *  str)
static

Converts a string to its integer value.

Author
Eddie O'Hagan
Date
7/23/2023
int data = Ace::ConvertStringToInteger(L"42069");
printf("Value: %d\n", data);

Output:Value: 42069

Parameters
[in]strString to convert to integer.
Returns
The integer value of the string.

◆ ConvertStringToLong() [1/2]

long Ace::ConvertStringToLong ( const char *  str)
static

Converts a string to its long integer value.

Author
Eddie O'Hagan
Date
7/23/2023
long data = Ace::ConvertStringToLong("1206942069");
printf("Value: %ld\n", data);
static long ConvertStringToLong(const char *str)
Converts a string to its long integer value.
Definition: Ace.cpp:6558

Output:Value: 1206942069

Parameters
[in]strString to convert to long.
Returns
The long integer value of the string.

◆ ConvertStringToLong() [2/2]

long Ace::ConvertStringToLong ( const wchar_t *  str)
static

Converts a string to its long integer value.

Author
Eddie O'Hagan
Date
7/23/2023
long data = Ace::ConvertStringToLong(L"1206942069");
printf("Value: %ld\n", data);

Output:Value: 1206942069

Parameters
[in]strString to convert to long.
Returns
The long integer value of the string.

◆ ConvertStringToOneLine() [1/2]

char * Ace::ConvertStringToOneLine ( const char *  strToConvert)
static

Converts a traditional string to a traditional string that is all on one line, In other words; this function removes any occurrence of
from stringToConvert.

Author
Eddie O'Hagan
Date
6/12/2016
try
{
const char* data = "Krusty\nKrab\nUn-Fair\n!";
char* oneLineData = Ace::ConvertStringToOneLine(data);
printf("%s", oneLineData);
_aligned_free(oneLineData);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:KrustyKrabUn-Fair!

Parameters
[in]strToConvertThe string to convert to one line.
Returns
A string with every occurrence of
removed. Throws an exception if strToConvert is NULL.

◆ ConvertStringToOneLine() [2/2]

wchar_t * Ace::ConvertStringToOneLine ( const wchar_t *  strToConvert)
static

Converts a traditional wide string to a traditional wide string that is all on one line, In other words; this function removes any occurrence of
from stringToConvert.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
const wchar_t* data = L"夕日\nが私たち\nを照ら\nします。\n";
wchar_t* oneLineData = Ace::ConvertStringToOneLine(data);
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%ls\n", oneLineData);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
_aligned_free(oneLineData);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:夕日が私たちを照らします。

Parameters
[in]strToConvertThe wide string to convert to one line.
Returns
A wide string with every occurrence of
removed. Throws an exception if strToConvert is NULL.

◆ ConvertStringToOneLineInPlace() [1/2]

void Ace::ConvertStringToOneLineInPlace ( char *  strToConvert)
static

Converts a traditional string to a traditional string that is all on one line, In other words; this function removes any occurrence of
from stringToConvert.

strToConvert must be an allocated string since this function works directly on it.

Author
Eddie O'Hagan
Date
6/12/2016
try
{
char* oneLineData = Ace::AllocateAndCopyString("Krusty\nKrab\nUn-Fair\n!");
printf("%s", oneLineData);
_aligned_free(oneLineData);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:KrustyKrabUn-Fair!

Parameters
[in,out]strToConvertThe string to directly convert to one line. Throws an exception if strToConvert is NULL.

◆ ConvertStringToOneLineInPlace() [2/2]

void Ace::ConvertStringToOneLineInPlace ( wchar_t *  strToConvert)
static

Converts a traditional wide string to a traditional wide string that is all on one line, In other words; this function removes any occurrence of
from stringToConvert.

strToConvert must be an allocated wide string since this function works directly on it.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
wchar_t* oneLineData = Ace::AllocateAndCopyString(L"Krusty\nKrab\nUn-Fair\n!");
wprintf(L"%ls", oneLineData);
_aligned_free(oneLineData);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:KrustyKrabUn-Fair!

Parameters
[in,out]strToConvertThe wide string to directly convert to one line. Throws an exception if strToConvert is NULL.

◆ ConvertStringToWCharString()

wchar_t * Ace::ConvertStringToWCharString ( const char *  strToConvert)
static

Converts a traditional string to a wide string.

A wide string is a string containing Unicode characters (non English).

Author
Eddie O'Hagan
Date
6/25/2016
try
{
const char* normalString = "The ceiling is right Squidward.";
wchar_t* wideString = Ace::ConvertStringToWCharString(normalString);
wprintf(L"Wide string: %ls\n", wideString);
_aligned_free(wideString);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static wchar_t * ConvertStringToWCharString(const char *strToConvert)
Converts a traditional string to a wide string.
Definition: Ace.cpp:6831

Output:Wide string: The ceiling is right Squidward.

Parameters
[in]strToConvertThe string to convert to a wide string.
Returns
The string converted to wide character string. Throws an exception if an error occurs.

◆ ConvertStringVectorArrayToStringArray() [1/4]

bool Ace::ConvertStringVectorArrayToStringArray ( char **  destinationStrArray,
const vector< const char * > &  stringVectorArray,
int &  outStringArrayLength 
)
static

Converts a string vector array to a traditional string array.

Author
Eddie O'Hagan
Date
4/3/2022
try
{
const int destinationArraySize = 5;
int index;
char* destinationArray[destinationArraySize];
for (index = 0; index < destinationArraySize; index++)
{
destinationArray[index] = (char*)Ace::_Aligned_Calloc(256);
}
vector<const char*> strVectorArray;
char* allocatedStr = Ace::AllocateAndCopyString("and I like Pizza.");
strVectorArray.push_back("My");
strVectorArray.push_back("name");
strVectorArray.push_back("is");
strVectorArray.push_back("Eddie");
strVectorArray.push_back(allocatedStr);
int numStrs = strVectorArray.size();
if (Ace::ConvertStringVectorArrayToStringArray(destinationArray, strVectorArray, numStrs) == true)
{
for (index = 0; index < numStrs; index++)
{
printf("Array[%d]:%s\n", index, destinationArray[index]);
}
}
else
{
printf("%s\n", "Failed to convert to string array.");
}
for (index = 0; index < destinationArraySize; index++)
{
_aligned_free(destinationArray[index]);
}
_aligned_free(allocatedStr);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char ** ConvertStringVectorArrayToStringArray(const vector< const char * > &stringVectorArray, int &outStringArrayLength)
Converts a string vector array to a traditional string array.
Definition: Ace.cpp:6904

Output:Array[0]:My Array[1]:name Array[2]:is Array[3]:Eddie Array[4]:and I like Pizza.

Parameters
[in]destinationStrArrayThe Destination Buffer to hold the converted vector array.
[in]stringVectorArrayThe string vector array to convert.
[out]outStringArrayLengthThe final length of the created string vector array.
Returns
true if the conversion was successful, false otherwise. Throws an exception if error occurs.

◆ ConvertStringVectorArrayToStringArray() [2/4]

char ** Ace::ConvertStringVectorArrayToStringArray ( const vector< const char * > &  stringVectorArray,
int &  outStringArrayLength 
)
static

Converts a string vector array to a traditional string array.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
vector<const char*> strVectorArray;
char* allocatedStr = Ace::AllocateAndCopyString("and I like Pizza.");
strVectorArray.push_back("My");
strVectorArray.push_back("name");
strVectorArray.push_back("is");
strVectorArray.push_back("Eddie");
strVectorArray.push_back(allocatedStr);
int numStrs = strVectorArray.size();
char** strArray = Ace::ConvertStringVectorArrayToStringArray(strVectorArray, numStrs);
for (int currIndex = 0; currIndex < numStrs; currIndex++)
{
printf("Array[%d]:%s\n", currIndex, strArray[currIndex]);
_aligned_free(strArray[currIndex]);
}
_aligned_free(allocatedStr);
_aligned_free(strArray);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Array[0]:My Array[1]:name Array[2]:is Array[3]:Eddie Array[4]:and I like Pizza.

Parameters
[in]stringVectorArrayThe string vector array to convert.
[out]outStringArrayLengthThe final length of the created string vector array.
Returns
A newly created traditional string array. Throws an exception if error occurs.

◆ ConvertStringVectorArrayToStringArray() [3/4]

wchar_t ** Ace::ConvertStringVectorArrayToStringArray ( const vector< const wchar_t * > &  stringVectorArray,
int &  outStringArrayLength 
)
static

Converts a wide string vector array to a traditional wide string array.

Author
Eddie O'Hagan
Date
9/4/2016
try
{
vector<const wchar_t*> strVectorArray;
wchar_t* allocatedStr = Ace::AllocateAndCopyString(L"お");
strVectorArray.push_back(L"あ");
strVectorArray.push_back(L"い");
strVectorArray.push_back(L"う");
strVectorArray.push_back(L"え");
strVectorArray.push_back(allocatedStr);
int numStrs = strVectorArray.size();
wchar_t** strArray = Ace::ConvertStringVectorArrayToStringArray(strVectorArray, numStrs);
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
for (int currIndex = 0; currIndex < numStrs; currIndex++)
{
wprintf(L"Array[%d]:%ls\n", currIndex, strArray[currIndex]);
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
for (int currIndex = 0; currIndex < numStrs; currIndex++)
{
_aligned_free(strArray[currIndex]);
}
_aligned_free(allocatedStr);
_aligned_free(strArray);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Array[0]:あ Array[1]:い Array[2]:う Array[3]:え Array[4]:お

Parameters
[in]stringVectorArrayThe string vector array to convert.
[out]outStringArrayLengthThe final length of the created string vector array.
Returns
A newly created traditional string array. Throws an exception if error occurs.

◆ ConvertStringVectorArrayToStringArray() [4/4]

bool Ace::ConvertStringVectorArrayToStringArray ( wchar_t **  destinationStrArray,
const vector< const wchar_t * > &  stringVectorArray,
int &  outStringArrayLength 
)
static

Converts a string vector array to a traditional string array.

Author
Eddie O'Hagan
Date
4/3/2022
try
{
const int destinationArraySize = 5;
int index;
wchar_t* destinationArray[destinationArraySize];
for (index = 0; index < destinationArraySize; index++)
{
destinationArray[index] = (wchar_t*)Ace::_Aligned_Calloc(256);
}
vector<const wchar_t*> strVectorArray;
wchar_t* allocatedStr = Ace::AllocateAndCopyString(L"お");
strVectorArray.push_back(L"あ");
strVectorArray.push_back(L"い");
strVectorArray.push_back(L"う");
strVectorArray.push_back(L"え");
strVectorArray.push_back(allocatedStr);
int numStrs = strVectorArray.size();
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
if (Ace::ConvertStringVectorArrayToStringArray(destinationArray, strVectorArray, numStrs) == true)
{
for (int currIndex = 0; currIndex < numStrs; currIndex++)
{
wprintf(L"Array[%d]:%ls\n", currIndex, destinationArray[currIndex]);
}
}
else
{
printf("%s\n", "Failed to convert to string array.");
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
for (index = 0; index < destinationArraySize; index++)
{
_aligned_free(destinationArray[index]);
}
_aligned_free(allocatedStr);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Array[0]:あ Array[1]:い Array[2]:う Array[3]:え Array[4]:お

Parameters
[in]destinationStrArrayThe Destination Buffer to hold the converted vector array.
[in]stringVectorArrayThe string vector array to convert.
[out]outStringArrayLengthThe final length of the created string vector array.
Returns
true if the conversion was successful, false otherwise. Throws an exception if error occurs.

◆ ConvertToLowerCase() [1/4]

char Ace::ConvertToLowerCase ( const char &  character)
static

Converts a character to lowercase.

Author
Eddie O'Hagan
Date
5/7/2016
char retVal = Ace::ConvertToLowerCase('A');
printf("%c", retVal);
static char ConvertToLowerCase(const char &character)
Converts a character to lowercase.
Definition: Ace.cpp:7296

Output:a

Parameters
[in]characterThe character to convert to lowercase.
Returns
The converted character.

◆ ConvertToLowerCase() [2/4]

char * Ace::ConvertToLowerCase ( const char *  str)
static

Converts a string to all lowercase letters.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* data = Ace::ConvertToLowerCase("ABCDEF");
printf("%s\n", data);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:abcdef

Parameters
[in]strThe string to determine if true or false.
Returns
true or false based on the value of str. Throws an exception if str is NULL.

◆ ConvertToLowerCase() [3/4]

wchar_t Ace::ConvertToLowerCase ( const wchar_t &  character)
static

Converts a wide character to lowercase.

Author
Eddie O'Hagan
Date
5/7/2016
char retVal = Ace::ConvertToLowerCase(L'A');
wprintf(L"%lc", retVal);

Output:a

Parameters
[in]characterThe wide character to convert to lowercase.
Returns
The converted character.

◆ ConvertToLowerCase() [4/4]

wchar_t * Ace::ConvertToLowerCase ( const wchar_t *  str)
static

Converts a wide string to all lowercase letters.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
wchar_t* data = Ace::ConvertToLowerCase(L"ABCDEF");
wprintf(L"%ls\n", data);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:abcdef

Parameters
[in]strThe string to determine if true or false.
Returns
true or false based on the value of str. Throws an exception if str is NULL.

◆ ConvertToLowerCaseInPlace() [1/2]

void Ace::ConvertToLowerCaseInPlace ( char *  str)
static

Directly modifies str to have all its letters converted to lower case.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* data = Ace::AllocateAndCopyString("ABCDEF");
printf("%s", data);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static void ConvertToLowerCaseInPlace(char *str)
Directly modifies str to have all its letters converted to lower case.
Definition: Ace.cpp:7478

Output:abcdef

Parameters
[in,out]strThe string to determine if true or false. Throws an exception if str is NULL.

◆ ConvertToLowerCaseInPlace() [2/2]

void Ace::ConvertToLowerCaseInPlace ( wchar_t *  str)
static

Directly modifies str to have all its letters converted to lower case.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
wchar_t* data = Ace::AllocateAndCopyString(L"ABCDEF");
wprintf(L"%ls", data);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:abcdef

Parameters
[in,out]strThe wide string to determine if true or false. Throws an exception if str is NULL.

◆ ConvertToUpperCase() [1/4]

char Ace::ConvertToUpperCase ( const char &  character)
static

Converts a character to uppercase.

Author
Eddie O'Hagan
Date
5/7/2016
char retVal = Ace::ConvertToUpperCase('a');
printf("%c", retVal);
static char ConvertToUpperCase(const char &character)
Converts a character to uppercase.
Definition: Ace.cpp:7340

Output:A

Parameters
[in]characterThe character to convert to uppercase.
Returns
The converted character.

◆ ConvertToUpperCase() [2/4]

char * Ace::ConvertToUpperCase ( const char *  str)
static

Converts a string to all uppercase letters.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* data = Ace::ConvertToUpperCase("abcdef");
printf("%s\n", data);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:ABCDEF

Parameters
[in]strThe string to determine if true or false.
Returns
A newly created string containing all the letters in str in uppercase. Throws an exception if str is NULL.

◆ ConvertToUpperCase() [3/4]

wchar_t Ace::ConvertToUpperCase ( const wchar_t &  character)
static

Converts a wide character to uppercase.

Author
Eddie O'Hagan
Date
5/7/2016
wchar_t retVal = Ace::ConvertToUpperCase(L'a');
wprintf(L"%lc", retVal);

Output:A

Parameters
[in]characterThe wide character to convert to uppercase.
Returns
The converted character.

◆ ConvertToUpperCase() [4/4]

wchar_t * Ace::ConvertToUpperCase ( const wchar_t *  str)
static

Converts a string to all uppercase letters.

Author
Eddie O'Hagan
Date
9/5/2016
try
{
wchar_t* data = Ace::ConvertToUpperCase(L"abcdef");
wprintf(L"%ls\n", data);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:ABCDEF

Parameters
[in]strThe string to determine if true or false.
Returns
A newly created string containing all the letters in str in uppercase. Throws an exception if str is NULL.

◆ ConvertToUpperCaseInPlace() [1/2]

void Ace::ConvertToUpperCaseInPlace ( char *  str)
static

Directly modifies str to have all its letters converted to upper case.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* data = Ace::AllocateAndCopyString("abcdef");
printf("%s", data);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static void ConvertToUpperCaseInPlace(char *str)
Directly modifies str to have all its letters converted to upper case.
Definition: Ace.cpp:7650

Output:ABCDEF

Parameters
[in]strThe string to convert to all uppercase letters. Throws an exception if str is NULL.

◆ ConvertToUpperCaseInPlace() [2/2]

void Ace::ConvertToUpperCaseInPlace ( wchar_t *  str)
static

Directly modifies str to have all its letters converted to upper case.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
wchar_t* data = Ace::AllocateAndCopyString(L"abcdef");
wprintf(L"%ls", data);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:ABCDEF

Parameters
[in]strThe string to convert to all uppercase letters. Throws an exception if str is NULL.

◆ Cos() [1/4]

double Ace::Cos ( const double &  numInRadians)
static

Calculates the Cosine (cos) of numInRadians in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/8/2016
try
{
const double PI = 3.14159265;
double angleInRadians = PI / 4.0;
double result = Ace::Cos(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double Cos(const double &numInRadians)
Calculates the Cosine (cos) of numInRadians in compliance with CERT Coding Standard.
Definition: Ace.cpp:7739

Output:angleInRadians:0.785398 result:0.707107

Parameters
numInRadiansThe number in radians to take the cosine of.
Returns
The cosine of the numInRadians. If a mathematical error occurs then an exception is thrown.

◆ Cos() [2/4]

float Ace::Cos ( const float &  numInRadians)
static

Calculates the Cosine (cos) of numInRadians in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/8/2016
try
{
const double PI = 3.14159265;
float angleInRadians = PI / 4.0;
float result = Ace::Cos(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0.785398 result:0.707107

Parameters
numInRadiansThe number in radians to take the cosine of.
Returns
The cosine of the numInRadians. If a mathematical error occurs then an exception is thrown.

◆ Cos() [3/4]

int Ace::Cos ( const int &  numInRadians)
static

Calculates the Cosine (cos) of numInRadians in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
const double PI = 3.14159265;
int angleInRadians = PI / 4.0;
int result = Ace::Cos(angleInRadians);
printf("angleInRadians:%d result:%d\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:1

Parameters
numInRadiansThe number in radians to take the cosine of.
Returns
The cosine of the numInRadians. If a mathematical error occurs then an exception is thrown.

◆ Cos() [4/4]

long Ace::Cos ( const long &  numInRadians)
static

Calculates the Cosine (cos) of numInRadians in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
const double PI = 3.14159265;
long angleInRadians = PI / 4.0;
long result = Ace::Cos(angleInRadians);
printf("angleInRadians:%ld result:%ld\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:1

Parameters
numInRadiansThe number in radians to take the cosine of.
Returns
The cosine of the numInRadians. If a mathematical error occurs then an exception is thrown.

◆ CosH() [1/4]

double Ace::CosH ( const double &  numInRadians)
static

Calculates the CosH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
const double PI = 3.14159265;
double angleInRadians = PI / 4.0;
double result = Ace::CosH(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double CosH(const double &numInRadians)
Calculates the CosH in compliance with CERT Coding Standard.
Definition: Ace.cpp:7978

Output:angleInRadians:0.785398 result:1.324609

Parameters
numInRadiansNumber in radians to calculate CosH for.
Returns
The CosH of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ CosH() [2/4]

float Ace::CosH ( const float &  numInRadians)
static

Calculates the CosH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
const double PI = 3.14159265;
float angleInRadians = PI / 4.0;
float result = Ace::CosH(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0.785398 result:1.324609

Parameters
numInRadiansNumber in radians to calculate CosH for.
Returns
The CosH of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ CosH() [3/4]

int Ace::CosH ( const int &  numInRadians)
static

Calculates the CosH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
const double PI = 3.14159265;
int angleInRadians = PI / 4.0;
int result = Ace::CosH(angleInRadians);
printf("angleInRadians:%d result:%d\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:1

Parameters
numInRadiansNumber in radians to calculate CosH for.
Returns
The CosH of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ CosH() [4/4]

long Ace::CosH ( const long &  numInRadians)
static

Calculates the CosH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
const double PI = 3.14159265;
long angleInRadians = PI / 4.0;
long result = Ace::CosH(angleInRadians);
printf("angleInRadians:%ld result:%ld\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:1

Parameters
numInRadiansNumber in radians to calculate CosH for.
Returns
The CosH of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ CountNumOccurrences() [1/4]

int Ace::CountNumOccurrences ( const char *  strToSearch,
const char &  charToLookFor 
)
static

Counts the number of times charToLookFor appears in strToSearch.

Author
Eddie O'Hagan
Date
6/11/2016
try
{
const char* data = "Has anyone ever been as far as decided to be there and then look more like?";
int numOccurences = Ace::CountNumOccurrences(data, 'e');
printf("Number of occurrences of %c: %d\n", 'e', numOccurences);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static int CountNumOccurrences(const char *strToSearch, const char &charToLookFor)
Counts the number of times charToLookFor appears in strToSearch.
Definition: Ace.cpp:8214

Output:Number of occurrences of e: 13

Parameters
[in]strToSearchA string containing the data to be searched.
[in]charToLookForA string character to look for.
Returns
The number of times charToLookFor occurred in strToSearch. Throws an exception if strToSearch is NULL.

◆ CountNumOccurrences() [2/4]

int Ace::CountNumOccurrences ( const char *  strToSearch,
const char *  strToLookFor 
)
static

Counts the number of times strToLookFor appears in strToSearch.

Assumes itemToLookFor is always smaller than word.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* data = "Has anyone ever been as far as decided to be there and then look more like?";
int numOccurences = Ace::CountNumOccurrences(data, "as");
printf("Number of occurrences of %s: %d", "as", numOccurences);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Number of occurrences of as: 3

Parameters
[in]strToSearchA string containing the data to be searched.
[in]strToLookForA string representing the substring to look for.
Returns
The number of times strToLookFor occurred in strToSearch. Throws an exception if strToSearch or strToLookFor is NULL.

◆ CountNumOccurrences() [3/4]

int Ace::CountNumOccurrences ( const wchar_t *  strToSearch,
const wchar_t &  charToLookFor 
)
static

Counts the number of times charToLookFor appears in strToSearch.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
const wchar_t* data = L"ビーチディスコ風の音楽があります屋根としての空トロピカルグロー理想的な気候帽子と水着を着ています二人で傘を持ってきますファンを忘れないでください手に取って踊りましょう。";
int numOccurences = Ace::CountNumOccurrences(data, L'て');
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"Number of occurrences of %lc: %d\n", L'て', numOccurences);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Number of occurrences of て: 4

Parameters
[in]strToSearchA wide string containing the data to be searched.
[in]charToLookForA wide character to look for.
Returns
The number of times charToLookFor occurred in strToSearch. Throws an exception if strToSearch is NULL.

◆ CountNumOccurrences() [4/4]

int Ace::CountNumOccurrences ( const wchar_t *  strToSearch,
const wchar_t *  strToLookFor 
)
static

Counts the number of times strToLookFor appears in strToSearch.

Assumes itemToLookFor is always smaller than word.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
const wchar_t* data = L"ビーチディスコ風の音楽があります屋根としての空トロピカルグロー理想的な気候帽子と水着を着ています二人で傘を持ってきますファンを忘れないでください手に取って踊りましょう。";
int numOccurences = Ace::CountNumOccurrences(data, L"ます");
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"Number of occurrences of %ls: %d\n", L"ます", numOccurences);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Number of occurrences of ます: 3

Parameters
[in]strToSearchA wide string containing the data to be searched.
[in]strToLookForA wide string representing the substring to look for.
Returns
The number of times strToLookFor occurred in strToSearch. Throws an exception if strToSearch or strToLookFor is NULL.

◆ CubeRoot() [1/4]

double Ace::CubeRoot ( const double &  num)
static

Calculates the Cube Root in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/8/2016
try
{
double retVal = Ace::CubeRoot(1728.0);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double CubeRoot(const double &num)
Calculates the Cube Root in compliance with CERT Coding Standard.
Definition: Ace.cpp:8516

Output:12.000000

Parameters
numThe number to take the Cube Root of.
Returns
The Cube Root of num. If a mathematical error occurs then an exception is thrown.

◆ CubeRoot() [2/4]

float Ace::CubeRoot ( const float &  num)
static

Calculates the Cube Root in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/8/2016
try
{
float retVal = Ace::CubeRoot(1728.0f);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:12.000000

Parameters
numThe number to take the Cube Root of.
Returns
The Cube Root of num. If a mathematical error occurs then an exception is thrown.

◆ CubeRoot() [3/4]

int Ace::CubeRoot ( const int &  num)
static

Calculates the Cube Root in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int retVal = Ace::CubeRoot(1728);
printf("%d\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:12

Parameters
numThe number to take the Cube Root of.
Returns
The Cube Root of num. If a mathematical error occurs then an exception is thrown.

◆ CubeRoot() [4/4]

long Ace::CubeRoot ( const long &  num)
static

Calculates the Cube Root in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long retVal = Ace::CubeRoot((long)17281728);
printf("%ld\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:258

Parameters
numThe number to take the Cube Root of.
Returns
The Cube Root of num. If a mathematical error occurs then an exception is thrown.

◆ DegreesToRadians() [1/4]

double Ace::DegreesToRadians ( const double &  degrees)
static

Converts a number from degrees to radians.

Author
Eddie O'Hagan
Date
5/16/2016
double deg = 90.0;
double rad = Ace::DegreesToRadians(deg);
printf("%f\n", rad);
static double DegreesToRadians(const double &degrees)
Converts a number from degrees to radians.
Definition: Ace.cpp:8737

Output:1.570796

Parameters
degreesDegrees to convert.
Returns
degrees converted to radians.

◆ DegreesToRadians() [2/4]

float Ace::DegreesToRadians ( const float &  degrees)
static

Converts a number from degrees to radians.

Author
Eddie O'Hagan
Date
10/6/2016
float deg = 90.0f;
float rad = Ace::DegreesToRadians(deg);
printf("%f\n", rad);

Output:1.570796

Parameters
degreesDegrees to convert.
Returns
degrees converted to radians.

◆ DegreesToRadians() [3/4]

int Ace::DegreesToRadians ( const int &  degrees)
static

Converts a number from degrees to radians.

This function is somewhat useless but provided for completeness.

Author
Eddie O'Hagan
Date
10/20/2016
int deg = 90;
int rad = Ace::DegreesToRadians(deg);
printf("%d\n", rad);

Output:1

Parameters
[in]degreesDegrees to convert.
Returns
Radians.

◆ DegreesToRadians() [4/4]

long Ace::DegreesToRadians ( const long &  degrees)
static

Converts a number from degrees to radians.

This function is somewhat useless but provided for completeness.

Author
Eddie O'Hagan
Date
7/23/2023
long deg = 90;
long rad = Ace::DegreesToRadians(deg);
printf("%ld\n", rad);

Output:1

Parameters
[in]degreesDegrees to convert.
Returns
Radians.

◆ DoesFileExist() [1/2]

bool Ace::DoesFileExist ( const char *  fullFilePathWithNameAndExt)
static

Returns true if the specified file exists, false otherwise.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
if (Ace::DoesFileExist("G:\\Pictures\\Cloud.jpg") == true)
{
printf("%s\n", "File exists.");
}
else
{
printf("%s\n", "File does NOT exist.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static bool DoesFileExist(const char *fullFilePathWithNameAndExt)
Returns true if the specified file exists, false otherwise.
Definition: Ace.cpp:8843

Output:File exists.

Parameters
fullFilePathWithNameAndExtFile to check.
Returns
Returns true if the specified file exists, false otherwise.

◆ DoesFileExist() [2/2]

bool Ace::DoesFileExist ( const wchar_t *  fullFilePathWithNameAndExt)
static

Returns true if the specified file exists, false otherwise.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
if (Ace::DoesFileExist(L"C:\\Images\\dickbutt.png") == true)
{
printf("%ls\n", L"File exists.");
}
else
{
printf("%ls\n", L"File does NOT exist.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:File exists.

Parameters
[in]fullFilePathWithNameAndExtFile to check.
Returns
Returns true if the specified file exists, false otherwise.

◆ Equals() [1/2]

bool Ace::Equals ( const char *  strToCompOne,
const char *  strToCompTwo 
)
static

Compares two traditional strings together.

Author
Eddie O'Hagan
Date
5/16/2016
const char* strOne = "Eddie";
const char* strTwo = "John";
if (Ace::Equals(strOne, strTwo) == true)
{
printf("%s\n", "Strings are equal.");
}
else
{
printf("%s\n", "Strings are NOT equal.");
}
static bool Equals(const char *strToCompOne, const char *strToCompTwo)
Compares two traditional strings together.
Definition: Ace.cpp:9160

Output:Strings are NOT equal.

Parameters
[in]strToCompOneFirst string to compare.
[in]strToCompTwoSecond string to compare.
Returns
true if the strings are equal, false otherwise.

◆ Equals() [2/2]

bool Ace::Equals ( const wchar_t *  strToCompOne,
const wchar_t *  strToCompTwo 
)
static

Compares two traditional wide strings together.

Author
Eddie O'Hagan
Date
9/7/2016
const wchar_t* strOne = L"エヂイ";
const wchar_t* strTwo = L"エヂイ";
if (Ace::Equals(strOne, strTwo) == true)
{
wprintf(L"%ls\n", L"Strings are equal.");
}
else
{
wprintf(L"%ls\n", L"Strings are NOT equal.");
}

Output:Strings are equal.

Parameters
[in]strToCompOneFirst wide string to compare.
[in]strToCompTwoSecond wide string to compare.
Returns
true if the wide strings are equal, false otherwise.

◆ EqualsIgnoreCase() [1/2]

bool Ace::EqualsIgnoreCase ( const char *  strToCompOne,
const char *  strToCompTwo 
)
static

Compares two traditional strings together but ignores upper/lower case.

Author
Eddie O'Hagan
Date
5/16/2016
const char* strOne = "Eddie";
const char* strTwo = "eDDie";
if (Ace::EqualsIgnoreCase(strOne, strTwo) == true)
{
printf("%s\n", "Strings are equal.");
}
else
{
printf("%s\n", "Strings are NOT equal.");
}
static bool EqualsIgnoreCase(const char *strToCompOne, const char *strToCompTwo)
Compares two traditional strings together but ignores upper/lower case.
Definition: Ace.cpp:9232

Output:Strings are equal.

Parameters
[in]strToCompOneFirst string to compare.
[in]strToCompTwoSecond string to compare.
Returns
true if the strings are equal, false otherwise.

◆ EqualsIgnoreCase() [2/2]

bool Ace::EqualsIgnoreCase ( const wchar_t *  strToCompOne,
const wchar_t *  strToCompTwo 
)
static

Compares two traditional wide strings together but ignores upper/lower case.

Author
Eddie O'Hagan
Date
9/7/2016
const wchar_t* strOne = L"Eddie";
const wchar_t* strTwo = L"eDDie";
if (Ace::EqualsIgnoreCase(strOne, strTwo) == true)
{
wprintf(L"%ls\n", L"Strings are equal.");
}
else
{
wprintf(L"%ls\n", L"Strings are NOT equal.");
}

Output:Strings are equal.

Parameters
[in]strToCompOneFirst wide string to compare.
[in]strToCompTwoSecond wide string to compare.
Returns
true if the strings are equal, false otherwise.

◆ ErrorFunction() [1/4]

double Ace::ErrorFunction ( const double &  num)
static

Calculates the Error Function integral from 0 to num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
double result = Ace::ErrorFunction(1.0);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:0.842701

Parameters
numEnd point for the integral.
Returns
The result of the Error Function from 0 to num. If a mathematical error occurs then an exception is thrown.

◆ ErrorFunction() [2/4]

float Ace::ErrorFunction ( const float &  num)
static

Calculates the Error Function integral from 0 to num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float result = Ace::ErrorFunction(1.0f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:0.842701

Parameters
numEnd point for the integral.
Returns
The result of the Error Function from 0 to num. If a mathematical error occurs then an exception is thrown.

◆ ErrorFunction() [3/4]

int Ace::ErrorFunction ( const int &  num)
static

Calculates the Error Function integral from 0 to num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int result = Ace::ErrorFunction(5);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:0

Parameters
numEnd point for the integral.
Returns
The result of the Error Function from 0 to num. If a mathematical error occurs then an exception is thrown.

◆ ErrorFunction() [4/4]

long Ace::ErrorFunction ( const long &  num)
static

Calculates the Error Function integral from 0 to num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long num = 58;
long result = Ace::ErrorFunction(num);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:1

Parameters
numEnd point for the integral.
Returns
The result of the Error Function from 0 to num. If a mathematical error occurs then an exception is thrown.

◆ EToTheXPower() [1/4]

double Ace::EToTheXPower ( const double &  power)
static

Calculates e^x in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
double result = Ace::EToTheXPower(5.0);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double EToTheXPower(const double &power)
Calculates e^x in compliance with CERT Coding Standard.
Definition: Ace.cpp:9325

Output:148.413159

Parameters
powerNumber to raise e to (i.e. power = x in e^x).
Returns
The result of raising e to power. If a mathematical error occurs then an exception is thrown.

◆ EToTheXPower() [2/4]

float Ace::EToTheXPower ( const float &  power)
static

Calculates e^x in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float result = Ace::EToTheXPower(5.0f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:148.413159

Parameters
powerNumber to raise e to (i.e. power = x in e^x).
Returns
The result of raising e to power. If a mathematical error occurs then an exception is thrown.

◆ EToTheXPower() [3/4]

int Ace::EToTheXPower ( const int &  power)
static

Calculates e^x in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int result = Ace::EToTheXPower(5);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:148

Parameters
powerNumber to raise e to (i.e. power = x in e^x).
Returns
The result of raising e to power. If a mathematical error occurs then an exception is thrown.

◆ EToTheXPower() [4/4]

long Ace::EToTheXPower ( const long &  power)
static

Calculates e^x in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::EToTheXPower(5);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:148

Parameters
powerNumber to raise e to (i.e. power = x in e^x).
Returns
The result of raising e to power. If a mathematical error occurs then an exception is thrown.

◆ EToTheXPowerMinusOne() [1/4]

double Ace::EToTheXPowerMinusOne ( const double &  power)
static

Calculates (e^x) - 1 in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
double result = Ace::EToTheXPowerMinusOne(5.0);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double EToTheXPowerMinusOne(const double &power)
Calculates (e^x) - 1 in compliance with CERT Coding Standard.
Definition: Ace.cpp:9553

Output:147.413159

Parameters
powerNumber to raise e to (i.e. power = x in e^x).
Returns
The result of raising e to power then subtracting 1. If a mathematical error occurs then an exception is thrown.

◆ EToTheXPowerMinusOne() [2/4]

float Ace::EToTheXPowerMinusOne ( const float &  power)
static

Calculates (e^x) - 1 in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float result = Ace::EToTheXPowerMinusOne(5.0f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:147.413159

Parameters
powerNumber to raise e to (i.e. power = x in e^x).
Returns
The result of raising e to power then subtracting 1. If a mathematical error occurs then an exception is thrown.

◆ EToTheXPowerMinusOne() [3/4]

int Ace::EToTheXPowerMinusOne ( const int &  power)
static

Calculates (e^x) - 1 in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int result = Ace::EToTheXPowerMinusOne(5);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:147

Parameters
powerNumber to raise e to (i.e. power = x in e^x).
Returns
The result of raising e to power then subtracting 1. If a mathematical error occurs then an exception is thrown.

◆ EToTheXPowerMinusOne() [4/4]

long Ace::EToTheXPowerMinusOne ( const long &  power)
static

Calculates (e^x) - 1 in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::EToTheXPowerMinusOne((long)5);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:147

Parameters
powerNumber to raise e to (i.e. power = x in e^x).
Returns
The result of raising e to power then subtracting 1. If a mathematical error occurs then an exception is thrown.

◆ FirstChar() [1/2]

char Ace::FirstChar ( const char *  str)
static

Returns the first character in str.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
const char* data = "Has anyone ever been as far as decided to be there and then look more like?";
char temp = Ace::FirstChar(data);
printf("%c", temp);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char FirstChar(const char *str)
Returns the first character in str.
Definition: Ace.cpp:9782

Output:H

Parameters
[in]strString to search.
Returns
The first character in str. If str is NULL then an exception is thrown.

◆ FirstChar() [2/2]

wchar_t Ace::FirstChar ( const wchar_t *  str)
static

Returns the first character in str.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
const wchar_t* data = L"Has anyone ever been as far as decided to be there and then look more like?";
wchar_t theChar = Ace::FirstChar(data);
wprintf(L"%lc", theChar);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:H

Parameters
[in]strWide String to search.
Returns
The first character in str. If str is NULL then an exception is thrown.

◆ Floor() [1/4]

double Ace::Floor ( const double &  num)
static

Calculates the largest integer value not greater than num.

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/8/2016
try
{
double retVal = Ace::Floor(2.9);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double Floor(const double &num)
Calculates the largest integer value not greater than num.
Definition: Ace.cpp:9863

Output:2.000000

Parameters
numThe number to use to calculate.
Returns
The largest integer value not greater than num. If a mathematical error occurs then an exception is thrown.

◆ Floor() [2/4]

float Ace::Floor ( const float &  num)
static

Calculates the largest integer value not greater than num.

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/8/2016
try
{
float retVal = Ace::Floor(2.9f);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:2.000000

Parameters
numThe number to use to calculate.
Returns
The largest integer value not greater than num. If a mathematical error occurs then an exception is thrown.

◆ Floor() [3/4]

int Ace::Floor ( const int &  num)
static

Calculates the largest integer value not greater than num.

This function is somewhat useless but provided for completeness. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int retVal = Ace::Floor(2);
printf("%d\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:2

Parameters
numThe number to use to calculate.
Returns
The largest integer value not greater than num. If a mathematical error occurs then an exception is thrown.

◆ Floor() [4/4]

long Ace::Floor ( const long &  num)
static

Calculates the largest integer value not greater than num.

This function is somewhat useless but provided for completeness. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long retVal = Ace::Floor((long)2);
printf("%ld\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:2

Parameters
numThe number to use to calculate.
Returns
The largest integer value not greater than num. If a mathematical error occurs then an exception is thrown.

◆ GammaFunction() [1/4]

double Ace::GammaFunction ( const double &  num)
static

Calculates The Gamma Function ( (0)integral(Inf)[t^num-1 * e^-t dt] ) in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
double result = Ace::GammaFunction(5.0);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:24.000000

Parameters
numNumber to use for t^num-1 in the equation.
Returns
The result of calculating The Gamma Function for t^num-1. If a mathematical error occurs or if num is less than or equal to 0.0, then an exception is thrown.

◆ GammaFunction() [2/4]

float Ace::GammaFunction ( const float &  num)
static

Calculates The Gamma Function ( (0)integral(Inf)[t^num-1 * e^-t dt] ) in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float result = Ace::GammaFunction(5.0f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:24.000000

Parameters
numNumber to use for t^num-1 in the equation.
Returns
The result of calculating The Gamma Function for t^num-1. If a mathematical error occurs or if num is less than or equal to 0.0, then an exception is thrown.

◆ GammaFunction() [3/4]

int Ace::GammaFunction ( const int &  num)
static

Calculates The Gamma Function ( (0)integral(Inf)[t^num-1 * e^-t dt] ) in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int result = Ace::GammaFunction(5);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:24

Parameters
numNumber to use for t^num-1 in the equation.
Returns
The result of calculating The Gamma Function for t^num-1. If a mathematical error occurs or if num is less than or equal to 0, then an exception is thrown.

◆ GammaFunction() [4/4]

long Ace::GammaFunction ( const long &  num)
static

Calculates The Gamma Function ( (0)integral(Inf)[t^num-1 * e^-t dt] ) in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::GammaFunction((long)5);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:24

Parameters
numNumber to use for t^num-1 in the equation.
Returns
The result of calculating The Gamma Function for t^num-1. If a mathematical error occurs or if num is less than or equal to 0, then an exception is thrown.

◆ GenerateRandomNum() [1/4]

double Ace::GenerateRandomNum ( const double &  min,
const double &  max 
)
static

Some might think this is all unnecessary but I think it's important to seed the RandomNumberGenerator properly with a proper seed value.

Too often are games plagued with predictable outcomes all leading back to not seeding the RNG properly. Generates a "super" random number using a random seed at launch.

Author
Eddie O'Hagan
Date
7/23/2023
double randomNum = -1.0;
//Generate 10 random numbers.
for (int currIndex = 1; currIndex <= 10; currIndex++)
{
randomNum = Ace::GenerateRandomNum(0.0, 2.0);
printf("%f\n", randomNum);
}
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

Output:0.497629 0.638465 1.472265 1.991590 1.803949 1.128226 1.635912 1.555864 1.969895 1.976564

Parameters
minLowest number to generate.
maxHighest number to generate.
Returns
A random number between the given range.

◆ GenerateRandomNum() [2/4]

float Ace::GenerateRandomNum ( const float &  min,
const float &  max 
)
static

Some might think this is all unnecessary but I think it's important to seed the RandomNumberGenerator properly with a proper seed value.

Too often are games plagued with predictable outcomes all leading back to not seeding the RNG properly. Generates a "super" random number using a random seed at launch.

Author
Eddie O'Hagan
Date
7/23/2023
float randomNum = -1.0f;
//Generate 10 random numbers.
for (int currIndex = 1; currIndex <= 10; currIndex++)
{
randomNum = Ace::GenerateRandomNum(0.0f, 2.0f);
printf("%f\n", randomNum);
}

Output:1.256275 1.039645 1.164033 0.496690 0.133898 0.010024 1.047318 0.418186 0.347023 1.533608

Parameters
minLowest number to generate.
maxHighest number to generate.
Returns
A random number between the given range.

◆ GenerateRandomNum() [3/4]

int Ace::GenerateRandomNum ( const int &  min,
const int &  max 
)
static

Some might think this is all unnecessary but I think it's important to seed the RandomNumberGenerator properly with a proper seed value.

Too often are games plagued with predictable outcomes all leading back to not seeding the RNG properly. Generates a "super" random number using a random seed at launch.

Author
Eddie O'Hagan
Date
5/7/2016
int randomNum = -1;
//Generate 10 random numbers.
for (int currIndex = 1; currIndex <= 10; currIndex++)
{
randomNum = Ace::GenerateRandomNum(1, 100);
printf("%d ", randomNum);
}

Output:35 82 10 52 10 34 56 21 37 14

Parameters
minLowest number to generate.
maxHighest number to generate.
Returns
A random number between the given range.

◆ GenerateRandomNum() [4/4]

long Ace::GenerateRandomNum ( const long &  min,
const long &  max 
)
static

Some might think this is all unnecessary but I think it's important to seed the RandomNumberGenerator properly with a proper seed value.

Too often are games plagued with predictable outcomes all leading back to not seeding the RNG properly. Generates a "super" random number using a random seed at launch.

Author
Eddie O'Hagan
Date
7/23/2023
long randomNum = -1;
//Generate 10 random numbers.
for (int currIndex = 1; currIndex <= 10; currIndex++)
{
randomNum = Ace::GenerateRandomNum((long)1, (long)100);
printf("%ld\n", randomNum);
}

Output:50 52 50 96 47 92 35 90 72 38

Parameters
minLowest number to generate.
maxHighest number to generate.
Returns
A random number between the given range.

◆ GetHResultDescription()

char * Ace::GetHResultDescription ( const HRESULT &  result)
static

Gets the corresponding detailed description of the HRESULT.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* result = Ace::GetHResultDescription((HRESULT)69);
printf("%s\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char * GetHResultDescription(const HRESULT &result)
Gets the corresponding detailed description of the HRESULT.
Definition: Ace.cpp:10618

Output:The network BIOS session limit was exceeded.

Parameters
resultThe HRESULT description.
Returns
The corresponding detailed description of the HRESULT. An exception is thrown if there is an error.

◆ GetHResultDescriptionW()

wchar_t * Ace::GetHResultDescriptionW ( const HRESULT &  result)
static

Gets the corresponding detailed description of the HRESULT.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
wchar_t* result = Ace::GetHResultDescriptionW((HRESULT)69);
wprintf(L"%ls\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static wchar_t * GetHResultDescriptionW(const HRESULT &result)
Gets the corresponding detailed description of the HRESULT.
Definition: Ace.cpp:10687

Output:The network BIOS session limit was exceeded.

Parameters
resultThe HRESULT description.
Returns
The corresponding detailed description of the HRESULT. Throws an exception if an error occurs.

◆ GetImageSize()

void Ace::GetImageSize ( const char *  filePath,
int *  outWidth,
int *  outHeight 
)
static

Gets the pixel dimensions of the provided image (filePath).

Author
Eddie O'Hagan
Date
11/2/2016
try
{
int width;
int height;
Ace::GetImageSize("C:\\Cloud.jpg", &width, &height);
printf("Width:%d Height:%d\n", width, height);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static void GetImageSize(const char *fileName, int *outWidth, int *outHeight)
Gets the pixel dimensions of the provided image (filePath).
Definition: Ace.cpp:10760

Output:Width:250 Height:297

Parameters
filePath[in] The full file path of the image.
outWidth[out] The width of the image.
outHeight[out] The height of the image
Returns
Throws an exception if an error occurs.

◆ GetImageSizeW()

void Ace::GetImageSizeW ( const wchar_t *  filePath,
int *  outWidth,
int *  outHeight 
)
static

Gets the pixel dimensions of the provided image (filePath).

Author
Eddie O'Hagan
Date
11/2/2016
try
{
int width;
int height;
Ace::GetImageSizeW(L"C:\\Cloud.jpg", &width, &height);
wprintf(L"Width:%d Height:%d\n", width, height);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static void GetImageSizeW(const wchar_t *fileName, int *outWidth, int *outHeight)
Gets the pixel dimensions of the provided image (filePath).
Definition: Ace.cpp:10955

Output:Width:250 Height:297

Parameters
filePath[in] The full file path of the image.
outWidth[out] The width of the image.
outHeight[out] The height of the image
Returns
Throws an exception if an error occurs.

◆ GetLastWindowsError()

void Ace::GetLastWindowsError ( wchar_t *  outLastWindowsErrorMessage)
static

◆ Hypotenuse() [1/4]

double Ace::Hypotenuse ( const double &  x,
const double &  y 
)
static

Solves for c in Pythagoras theorem (a^2 + b^2 = c^2); i.e square root of (x^2 + y^2).

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
double result = Ace::Hypotenuse(3.0, 4.0);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:5.000000

Parameters
xValue of one of the sides of the triangle.
yValue of the other side of the triangle.
Returns
The Hypotenuse (the longest side) of the triangle. If a mathematical error occurs then an exception is thrown.

◆ Hypotenuse() [2/4]

float Ace::Hypotenuse ( const float &  x,
const float &  y 
)
static

Solves for c in Pythagoras theorem (a^2 + b^2 = c^2); i.e square root of (a^2 + b^2).

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
float result = Ace::Hypotenuse(3.0f, 4.0f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:5.000000

Parameters
xValue of one of the sides of the triangle.
yValue of the other side of the triangle.
Returns
The Hypotenuse (the longest side) of the triangle. If a mathematical error occurs then an exception is thrown.

◆ Hypotenuse() [3/4]

int Ace::Hypotenuse ( const int &  x,
const int &  y 
)
static

Solves for c in Pythagoras theorem (a^2 + b^2 = c^2); i.e square root of (a^2 + b^2).

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int result = Ace::Hypotenuse(3, 4);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:5

Parameters
xValue of one of the sides of the triangle.
yValue of the other side of the triangle.
Returns
The Hypotenuse (the longest side) of the triangle. If a mathematical error occurs then an exception is thrown.

◆ Hypotenuse() [4/4]

long Ace::Hypotenuse ( const long &  x,
const long &  y 
)
static

Solves for c in Pythagoras theorem (a^2 + b^2 = c^2); i.e square root of (a^2 + b^2).

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::Hypotenuse((long)3, (long)4);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:5

Parameters
xValue of one of the sides of the triangle.
yValue of the other side of the triangle.
Returns
The Hypotenuse (the longest side) of the triangle. If a mathematical error occurs then an exception is thrown.

◆ IndexOf() [1/4]

int Ace::IndexOf ( const char *  strToSearch,
const char &  charToLookFor 
)
static

Searches strToSearch for the first occurrence of charToLookFor and returns the (0 based) index of its location.

Author
Eddie O'Hagan
Date
10/31/2016
try
{
const char* data = "Has anyone ever been as far as decided to be there and then look more like?";
int temp = Ace::IndexOf(data, 'b');
printf("%d\n", temp);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:16

Parameters
[in]strToSearchString to search starting from left to right.
charToLookForCharacter to look for inside of strToSearch.
Returns
The (0 based) index of where charToLookFor is located. Returns -1 if not found. Throws an exception if there is an error.

◆ IndexOf() [2/4]

int Ace::IndexOf ( const char *  strToSearch,
const char *  strToLookFor 
)
static

Searches strToSearch for the first occurrence of strToLookFor and returns the (0 based) index of its location.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
const char* data = "Has anyone ever been as far as decided to be there and then look more like?";
int temp = Ace::IndexOf(data, "been");
printf("%d\n", temp);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:16

Parameters
[in]strToSearchString to search starting from left to right.
[in]strToLookForString to look for inside of strToSearch.
Returns
The (0 based) index of where strToLookFor is located. Returns -1 if not found. Throws an exception if there is an error.

◆ IndexOf() [3/4]

int Ace::IndexOf ( const wchar_t *  strToSearch,
const wchar_t &  charToLookFor 
)
static

Searches strToSearch for the first occurrence of charToLookFor and returns the (0 based) index of its location.

Author
Eddie O'Hagan
Date
10/31/2016
try
{
const wchar_t* data = L"沈黙の中で、私は震えています";
int temp = Ace::IndexOf(data, L'は');
printf("%d\n", temp);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:7

Parameters
[in]strToSearchString to search starting from left to right.
charToLookForCharacter to look for inside of strToSearch.
Returns
The (0 based) index of where charToLookFor is located. Returns -1 if not found. Throws an exception if there is an error.

◆ IndexOf() [4/4]

int Ace::IndexOf ( const wchar_t *  strToSearch,
const wchar_t *  strToLookFor 
)
static

Searches strToSearch for the first occurrence of strToLookFor and returns the (0 based) index of its location.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
const wchar_t* data = L"沈黙の中で、私は震えています";
int temp = Ace::IndexOf(data, L"私は");
printf("%d\n", temp);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:6

Parameters
[in]strToSearchWide String to search starting from left to right.
[in]strToLookForWide String to look for inside of strToSearch.
Returns
The (0 based) index of where strToLookFor is located. Returns -1 if not found. Throws an exception if there is an error.

◆ IndexOfFirstLetter() [1/2]

int Ace::IndexOfFirstLetter ( const char *  strToSearch)
static

Returns the first index of a letter in a given string.

For Example: "23584Anus" would return 5.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
const char* str = "23584Anus";
int retVal = Ace::IndexOfFirstLetter(str);
printf("%d\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static int IndexOfFirstLetter(const char *strToSearch)
Returns the first index of a letter in a given string.
Definition: Ace.cpp:11760

Output:5

Parameters
[in]strToSearchString to search for the first occurrence of a alphabetical character.
Returns
The (0 based) index of where in strToSearch the first alphabetical character was found. Returns -1 if not found. Throws an exception if there is an error.

◆ IndexOfFirstLetter() [2/2]

int Ace::IndexOfFirstLetter ( const wchar_t *  strToSearch)
static

Returns the first index of a letter in a given wide string.

For Example: "23584Anus" would return 5.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
const wchar_t* str = L"23582あほお";
int retVal = Ace::IndexOfFirstLetter(str);
printf("%d\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:5

Parameters
[in]strToSearchWide String to search for the first occurrence of a alphabetical character.
Returns
The (0 based) index of where in strToSearch the first alphabetical character was found. Returns -1 if not found. Throws an exception if there is an error.

◆ IndexOfIgnoreCase() [1/4]

int Ace::IndexOfIgnoreCase ( const char *  strToSearch,
const char &  charToLookFor 
)
static

Searches strToSearch for the first occurrence of charToLookFor (regardless of case) and returns the (0 based) index of its location.

Author
Eddie O'Hagan
Date
5/26/2016
try
{
int result = Ace::IndexOfIgnoreCase("My name Is eddIe and I like cheese.", 'i');
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:8

Parameters
[in]strToSearchString to search starting from left to right.
charToLookForCharacter to look for inside of strToSearch.
Returns
The (0 based) index of where strToLookFor is located. Returns -1 if not found. Throws an exception if there is an error.

◆ IndexOfIgnoreCase() [2/4]

int Ace::IndexOfIgnoreCase ( const char *  strToSearch,
const char *  strToLookFor 
)
static

Searches strToSearch for the first occurrence of strToLookFor (regardless of case) and returns the (0 based) index of its location.

Author
Eddie O'Hagan
Date
5/26/2016
try
{
int result = Ace::IndexOfIgnoreCase("My name is eddIe and I like cheese.", "EdDIe");
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:11

Parameters
[in]strToSearchString to search starting from left to right.
[in]strToLookForString to look for inside of strToSearch.
Returns
The (0 based) index of where strToLookFor is located. Returns -1 if not found. Throws an exception if there is an error.

◆ IndexOfIgnoreCase() [3/4]

int Ace::IndexOfIgnoreCase ( const wchar_t *  strToSearch,
const wchar_t &  charToLookFor 
)
static

Searches strToSearch for the first occurrence of charToLookFor (regardless of case) and returns the (0 based) index of its location.

Author
Eddie O'Hagan
Date
5/26/2016
try
{
int result = Ace::IndexOfIgnoreCase(L"My name is eddIe and I like cheese.", L'I');
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:8

Parameters
[in]strToSearchString to search starting from left to right.
charToLookForCharacter to look for inside of strToSearch.
Returns
The (0 based) index of where strToLookFor is located. Returns -1 if not found. Throws an exception if there is an error.

◆ IndexOfIgnoreCase() [4/4]

int Ace::IndexOfIgnoreCase ( const wchar_t *  strToSearch,
const wchar_t *  strToLookFor 
)
static

Searches strToSearch for the first occurrence of strToLookFor (regardless of case) and returns the (0 based) index of its location.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
int result = Ace::IndexOfIgnoreCase(L"My name is eddIe and I like cheese.", L"EdDIe");
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:11

Parameters
[in]strToSearchWide String to search starting from left to right.
[in]strToLookForWide String to look for inside of strToSearch.
Returns
The (0 based) index of where strToLookFor is located. Returns -1 if not found. Throws an exception if there is an error.

◆ InsertString() [1/4]

bool Ace::InsertString ( char *  destination,
const char *  strToReceive,
const char *  strToInsert,
const int &  startIndex 
)
static

Inserts the string strToInsert into strToRevcive by "sandwiching" the two halves of strToReceive.

The first half is from 0 to startIndex-1, the last half is from startIndex to the end of strToReceive. Stores the result in the provided destination buffer.

Author
Eddie O'Hagan
Date
4/4/2022
try
{
char retVal[2048] = { '\0' };
if (Ace::InsertString(retVal, "Eddie is a Computer Scientist.", " O\'Hagan", 5) == true)
{
printf("%s\n", retVal);
}
else
{
printf("%s\n", "Failed to insert string.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:Eddie O'Hagan is a Computer Scientist.

Parameters
[in]destinationThe Destination Buffer to store the result.
[in]strToReceiveThe string to receive strToInsert.
[in]strToInsertThe string to sandwich/insert into strToReceive.
startIndexThe index in strToReceive to insert at strToInsert.
Returns
true if the insertion was successful, false otherwise. Throws an exception if there is an error.

◆ InsertString() [2/4]

char * Ace::InsertString ( const char *  strToReceive,
const char *  strToInsert,
const int &  startIndex 
)
static

Inserts the string strToInsert into strToRevcive by "sandwiching" the two halves of strToReceive.

The first half is from 0 to startIndex-1, the last half is from startIndex to the end of strToReceive.

Author
Eddie O'Hagan
Date
10/10/2016
try
{
char* retVal = Ace::InsertString("Eddie is a Computer Scientist.", " O\'Hagan", 5);
printf("%s\n", retVal);
_aligned_free(retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Eddie O'Hagan is a Computer Scientist.

Parameters
[in]strToReceiveThe string to receive strToInsert.
[in]strToInsertThe string to sandwich/insert into strToReceive.
startIndexThe index in strToReceive to insert at strToInsert.
Returns
The newly created string with strToInsert inserted into strToReceive. Throws an exception if there is an error.

◆ InsertString() [3/4]

wchar_t * Ace::InsertString ( const wchar_t *  strToReceive,
const wchar_t *  strToInsert,
const int &  startIndex 
)
static

Inserts the string strToInsert into strToRevcive by "sandwiching" the two halves of strToReceive.

The first half is from 0 to startIndex-1, the last half is from startIndex to the end of strToReceive.

Author
Eddie O'Hagan
Date
10/10/2016
try
{
wchar_t* retVal = Ace::InsertString(L"彼らが日本でを合法化することを願っています。", L"マリファナ", 6);
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%ls\n", retVal);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
_aligned_free(retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:彼らが日本でマリファナを合法化することを願っています。

Parameters
[in]strToReceiveThe wide string to receive strToInsert.
[in]strToInsertThe wide string to sandwich/insert into strToReceive.
startIndexThe index in strToReceive to insert at strToInsert.
Returns
The newly created wide string with strToInsert inserted into strToReceive. Throws an exception if there is an error.

◆ InsertString() [4/4]

bool Ace::InsertString ( wchar_t *  destination,
const wchar_t *  strToReceive,
const wchar_t *  strToInsert,
const int &  startIndex 
)
static

Inserts the string strToInsert into strToRevcive by "sandwiching" the two halves of strToReceive.

The first half is from 0 to startIndex-1, the last half is from startIndex to the end of strToReceive. Stores the result in the provided destination buffer.

Author
Eddie O'Hagan
Date
4/4/2022
try
{
wchar_t retVal[2048] = { L'\0' };
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
if (Ace::InsertString(retVal, L"彼らが日本でを合法化することを願っています。", L"マリファナ", 6) == true)
{
wprintf(L"%ls\n", retVal);
}
else
{
printf("%s\n", "Error: Failed to insert string.");
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output: 彼らが日本でマリファナを合法化することを願っています。

Parameters
[in]destinationThe Destination Buffer to store the result.
[in]strToReceiveThe string to receive strToInsert.
[in]strToInsertThe string to sandwich/insert into strToReceive.
startIndexThe index in strToReceive to insert at strToInsert.
Returns
true if the insertion was successful, false otherwise. Throws an exception if there is an error.

◆ IsAlphabetic() [1/2]

bool Ace::IsAlphabetic ( const char &  character)
static

Returns true if a character is a letter from either a to z or A to Z.

Letters fall into a range on the ASCII chart which makes this an simple test.

ASCII chart: http://www.asciitable.com/index/asciifull.gif.

Author
Eddie O'Hagan
Date
5/7/2016
if (Ace::IsAlphabetic('E') == true)
{
printf("%s", "true");
}
else
{
printf("%s", "false");
}
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

Output:true

Parameters
[in]characterA single character to test if it's either a-z or A-Z.
Returns
true if the character is between ranges a-z or A-Z; false otherwise.

◆ IsAlphabetic() [2/2]

bool Ace::IsAlphabetic ( const wchar_t &  character)
static

Returns true if a wide character is not a digit.

Author
Eddie O'Hagan
Date
9/7/2016
if (Ace::IsAlphabetic(L'E') == true)
{
printf("%ls", L"true");
}
else
{
printf("%ls", L"false");
}

Output:true

Parameters
[in]characterA single wide character to test.
Returns
true if the character is not a digit.

◆ IsDigit() [1/2]

bool Ace::IsDigit ( const char &  character)
static

Returns true if a character is a digit from 0-9.

Digits fall into a range on the ASCII chart which makes this an simple test.

ASCII chart: http://www.asciitable.com/index/asciifull.gif.

Author
Eddie O'Hagan
Date
9/7/2016
if (Ace::IsDigit('7') == true)
{
printf("%s", "true");
}
else
{
printf("%s", "false");
}
static bool IsDigit(const char &character)
Returns true if a character is a digit from 0-9.
Definition: Ace.cpp:12492

Output:true

Parameters
[in]characterA single character to test if it's between 0-9.
Returns
true if the character is between 0-9; false otherwise.

◆ IsDigit() [2/2]

bool Ace::IsDigit ( const wchar_t &  character)
static

Returns true if a wide character is a digit.

Author
Eddie O'Hagan
Date
9/7/2016
if (Ace::IsDigit(L'7') == true)
{
printf("%ls", L"true");
}
else
{
printf("%ls", L"false");
}

Output:true

Parameters
[in]characterA single wide character to test if it's between 0-9.
Returns
true if the wide character is a digit; false otherwise.

◆ IsEmpty() [1/2]

bool Ace::IsEmpty ( const char *  str)
static

Searches a given string to see if it is all empty.

In other words, is the string provided all whitespace.

Author
Eddie O'Hagan
Date
5/7/2016
if (Ace::IsEmpty(" ") == true)
{
printf("%s", "true");
}
else
{
printf("%s", "false");
}
static bool IsEmpty(const char *str)
Searches a given string to see if it is all empty.
Definition: Ace.cpp:12560

Output:true

Parameters
[in]strString to search.
Returns
true if every character in str is whitespace; false otherwise.

◆ IsEmpty() [2/2]

bool Ace::IsEmpty ( const wchar_t *  str)
static

Searches a given wide string to see if it is all empty.

In other words, is the string provided all whitespace.

Author
Eddie O'Hagan
Date
9/7/2016
if (Ace::IsEmpty(L" ") == true)
{
printf("%ls", L"true");
}
else
{
printf("%ls", L"false");
}

Output:true

Parameters
[in]strWide String to search.
Returns
true if every wide character in str is whitespace; false otherwise.

◆ IsFile() [1/2]

bool Ace::IsFile ( const char *  str)
static

Searches for a given file path and checks if the file path is (points to) a file or not.

Author
Eddie O'Hagan
Date
8/8/2023
const char* filePath = "C://dicks.txt";
if (Ace::IsFile(filePath) == true)
{
printf("%s\n", "File path is a file.");
}
else
{
printf("%s\n", "File path is NOT a file.");
}
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

Output: File path is a file.

Parameters
[in]str
Returns
true if str points to a file, false otherwise.

◆ IsFile() [2/2]

bool Ace::IsFile ( const wchar_t *  str)
static

Searches for a given file path and checks if the file path is (points to) a file or not.

Author
Eddie O'Hagan
Date
8/8/2023
const wchar_t* filePath = L"C://日本語.txt";
if (Ace::IsFile(filePath) == true)
{
printf("%s\n", "File path is a file.");
}
else
{
printf("%s\n", "File path is NOT a file.");
}

Output: File path is a file.

Parameters
[in]str
Returns
true if str points to a file, false otherwise.

◆ IsFolder() [1/2]

bool Ace::IsFolder ( const char *  str)
static

Searches for a given folder path and checks if the file path is (points to) a folder or not.

Author
Eddie O'Hagan
Date
8/8/2023
const char* folderPath = "C:\\Users";
if (Ace::IsFolder(folderPath) == true)
{
printf("%s\n", "Folder path is a folder.");
}
else
{
printf("%s\n", "Folder path is NOT a folder.");
}
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

Output: Folder path is a folder.

Parameters
[in]str
Returns
true if str points to a folder, false otherwise.

◆ IsFolder() [2/2]

bool Ace::IsFolder ( const wchar_t *  str)
static

Searches for a given folder path and checks if the file path is (points to) a folder or not.

Author
Eddie O'Hagan
Date
8/8/2023
const wchar_t* folderPath = L"C:\\画像";
if (Ace::IsFolder(folderPath) == true)
{
printf("%s\n", "Folder path is a folder.");
}
else
{
printf("%s\n", "Folder path is NOT a folder.");
}

Output: Folder path is a folder.

Parameters
[in]str
Returns
true if str points to a folder, false otherwise.

◆ IsNumber() [1/2]

bool Ace::IsNumber ( const char *  str)
static

Returns true if all characters are a digit.

ASCII chart: http://www.asciitable.com/index/asciifull.gif.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
const char* str = "01234";
if (Ace::IsNumber(str) == true)
{
printf("%s", "true");
}
else
{
printf("%s", "false");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static bool IsNumber(const char *str)
Returns true if all characters are a digit.
Definition: Ace.cpp:12856

Output:true

Parameters
[in]strA string to test if all characters are digits.
Returns
true if the string is all digits, false otherwise. Throws an exception if str is NULL.

◆ IsNumber() [2/2]

bool Ace::IsNumber ( const wchar_t *  str)
static

Returns true if all characters are a digit.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
const wchar_t* str = L"01234";
if (Ace::IsNumber(str) == true)
{
wprintf(L"%ls", L"true");
}
else
{
wprintf(L"%ls", L"false");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:true

Parameters
[in]strA wide string to test if all characters are digits.
Returns
true if the wide string is all digits, false otherwise. Throws an exception if str is NULL.

◆ IsPathADevice() [1/2]

bool Ace::IsPathADevice ( const char *  path)
static

Returns true if the provided path leads to a device rather than a file.

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/14/2016
try
{
bool retVal = Ace::IsPathADevice("C:\\dicks.txt");
if (retVal == true)
{
printf("%s\n", "true");
}
else
{
printf("%s\n", "false");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static bool IsPathADevice(const char *path)
Returns true if the provided path leads to a device rather than a file.
Definition: Ace.cpp:12968

Output:false

Parameters
[in]pathThe file path to test.
Returns
true if the path leads to a device, false otherwise.

◆ IsPathADevice() [2/2]

bool Ace::IsPathADevice ( const wchar_t *  path)
static

Returns true if the provided path leads to a device rather than a file.

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/14/2016
try
{
bool retVal = Ace::IsPathADevice(L"C:\\dicks.txt");
if (retVal == true)
{
printf("%ls\n", L"true");
}
else
{
printf("%ls\n", L"false");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:false

Parameters
[in]pathThe file path to test.
Returns
true if the path leads to a device, false otherwise.

◆ IsWhitespace() [1/2]

bool Ace::IsWhitespace ( const char &  character)
static

Returns true if a character is whitespace.

Author
Eddie O'Hagan
Date
5/7/2016
if (Ace::IsWhitespace(' ') == true)
{
printf("%s", "true");
}
else
{
printf("%s", "false");
}
static bool IsWhitespace(const char &character)
Returns true if a character is whitespace.
Definition: Ace.cpp:13092

Output:true

Parameters
[in]characterCharacter to test to see if it is whitespace.
Returns
true if the character is a space, tab or newline; false otherwise.

◆ IsWhitespace() [2/2]

bool Ace::IsWhitespace ( const wchar_t &  character)
static

Returns true if a wide character is whitespace.

Author
Eddie O'Hagan
Date
9/7/2016
if (Ace::IsWhitespace(L' ') == true)
{
wprintf(L"%ls", L"true");
}
else
{
wprintf(L"%ls", L"false");
}

Output:true

Parameters
[in]characterCharacter to test to see if it is whitespace.
Returns
true if the wide character is a space, tab or newline; false otherwise.

◆ Largest() [1/4]

double Ace::Largest ( const double &  numOne,
const double &  numTwo 
)
static

Returns the larger of the two values.

Author
Eddie O'Hagan
Date
10/9/2016
double retVal = Ace::Largest(2.0, 2.01);
printf("%f\n", retVal);
static double Largest(const double &numOne, const double &numTwo)
Returns the larger of the two values.
Definition: Ace.cpp:13143

Output:2.010000

Parameters
numOnenumber to compare against.
numTwoother number to compare against.
Returns
The larger of the two values.

◆ Largest() [2/4]

float Ace::Largest ( const float &  numOne,
const float &  numTwo 
)
static

Returns the larger of the two values.

Author
Eddie O'Hagan
Date
10/9/2016
float retVal = Ace::Largest(2.0f, 2.01f);
printf("%f\n", retVal);

Output:2.010000

Parameters
numOnenumber to compare against.
numTwoother number to compare against.
Returns
The larger of the two values.

◆ Largest() [3/4]

int Ace::Largest ( const int &  numOne,
const int &  numTwo 
)
static

Returns the larger of the two values.

Author
Eddie O'Hagan
Date
10/20/2016
int retVal = Ace::Largest(2, 3);
printf("%d\n", retVal);

Output:3

Parameters
numOnenumber to compare against.
numTwoother number to compare against.
Returns
The larger of the two values.

◆ Largest() [4/4]

long Ace::Largest ( const long &  numOne,
const long &  numTwo 
)
static

Returns the larger of the two values.

Author
Eddie O'Hagan
Date
7/23/2023
long retVal = Ace::Largest((long)2, (long)3);
printf("%ld\n", retVal);

Output:3

Parameters
numOnenumber to compare against.
numTwoother number to compare against.
Returns
The larger of the two values.

◆ LastChar() [1/2]

char Ace::LastChar ( const char *  str)
static

Returns the last character in str.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* data = "Has anyone ever been as far as decided to be there and then look more like?";
char temp = Ace::LastChar(data);
printf("%c", temp);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char LastChar(const char *str)
Returns the last character in str.
Definition: Ace.cpp:13243

Output:?

Parameters
[in]strString to search.
Returns
The last character in str. Throws an exception if str is NULL.

◆ LastChar() [2/2]

wchar_t Ace::LastChar ( const wchar_t *  str)
static

Returns the last character in str.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
const wchar_t* data = L"彼らが日本でマリファナを合法化することを願っています。";
wchar_t temp = Ace::LastChar(data);
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%lc", temp);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:。

Parameters
[in]strWide String to search.
Returns
The last character in str. Throws an exception if str is NULL.

◆ LastIndexOf() [1/2]

int Ace::LastIndexOf ( const char *  strToSearch,
const char *  strToLookFor 
)
static

Searches strToSearch for the last occurrence of strToLookFor and returns the (0 based) index of its location.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
const char* data = "Has anyone eeveer been as far as decided to be theeree and theen look more likee?";
int temp = Ace::LastIndexOf(data, "ee");
printf("%d\n", temp);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:78

Parameters
[in]strToSearchString to search starting from right to left.
[in]strToLookForString to look for inside of strToSearch.
Returns
The (0 based) index of where strToLookFor is located. Returns -1 if not found. Throws an exception if error occurs.

◆ LastIndexOf() [2/2]

int Ace::LastIndexOf ( const wchar_t *  strToSearch,
const wchar_t *  strToLookFor 
)
static

Searches strToSearch for the last occurrence of strToLookFor and returns the (0 based) index of its location.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
const wchar_t* data = L"ਮੈਨੂੰ ਉਮੀਦਮੈਨੂੰ ਹੈ ਕਿ ਉਹ ਹਰ ਥਾਂ ਮਾਰਿਮੈਨੂੰਜੁਆਨਾ ਨੂੰ ਕਾਨੂੰਨੀ ਤੌਰ 'ਤੇ ਕਾਨੂੰਨੀ ਮੈਨੂੰਬਣਾਉਂਦੇ ਮੈਨੂੰਹਨ.";
int index = Ace::LastIndexOf(data, L"ਮੈਨੂੰ");
printf("%d\n", index);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:88

Parameters
[in]strToSearchWide String to search starting from right to left.
[in]strToLookForWide String to look for inside of strToSearch.
Returns
The (0 based) index of where strToLookFor is located. Returns -1 if not found. Throws an exception if error occurs.

◆ LogBaseTen() [1/4]

double Ace::LogBaseTen ( const double &  num)
static

Calculates the logarithm (log) base 10 of num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
double retVal = Ace::LogBaseTen(69.0);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double LogBaseTen(const double &num)
Calculates the logarithm (log) base 10 of num in compliance with CERT Coding Standard.
Definition: Ace.cpp:13537

Output:1.838849

Parameters
numNumber to use to calculate its logarithm base 10.
Returns
The logarithm base 10 of num. If a mathematical error occurs or num is negative, then an exception is thrown.

◆ LogBaseTen() [2/4]

float Ace::LogBaseTen ( const float &  num)
static

Calculates the logarithm (log) base 10 of num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
float retVal = Ace::LogBaseTen(69.0f);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:1.838849

Parameters
numNumber to use to calculate its logarithm base 10.
Returns
The logarithm base 10 of num. If a mathematical error occurs or num is negative, then an exception is thrown.

◆ LogBaseTen() [3/4]

int Ace::LogBaseTen ( const int &  num)
static

Calculates the logarithm (log) base 10 of num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int retVal = Ace::LogBaseTen(69);
printf("%d\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:1

Parameters
numNumber to use to calculate its logarithm base 10.
Returns
The logarithm base 10 of num. If a mathematical error occurs or num is negative, then an exception is thrown.

◆ LogBaseTen() [4/4]

long Ace::LogBaseTen ( const long &  num)
static

Calculates the logarithm (log) base 10 of num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long retVal = Ace::LogBaseTen((long)69);
printf("%ld\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:1

Parameters
numNumber to use to calculate its logarithm base 10.
Returns
The logarithm base 10 of num. If a mathematical error occurs or num is negative, then an exception is thrown.

◆ LogBaseTwo() [1/4]

double Ace::LogBaseTwo ( const double &  num)
static

Calculates the logarithm (log) base 2 of num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
double retVal = Ace::LogBaseTwo(69.0);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double LogBaseTwo(const double &num)
Calculates the logarithm (log) base 2 of num in compliance with CERT Coding Standard.
Definition: Ace.cpp:13805

Output:6.108524

Parameters
numNumber to use to calculate its logarithm base 2.
Returns
The logarithm base 2 of num. If a mathematical error occurs or num is negative, then an exception is thrown.

◆ LogBaseTwo() [2/4]

float Ace::LogBaseTwo ( const float &  num)
static

Calculates the logarithm (log) base 2 of num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
float retVal = Ace::LogBaseTwo(69.0f);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:6.108524

Parameters
numNumber to use to calculate its logarithm base 2.
Returns
The logarithm base 2 of num. If a mathematical error occurs or num is negative, then an exception is thrown.

◆ LogBaseTwo() [3/4]

int Ace::LogBaseTwo ( const int &  num)
static

Calculates the logarithm (log) base 2 of num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int retVal = Ace::LogBaseTwo(69);
printf("%d\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:6

Parameters
numNumber to use to calculate its logarithm base 2.
Returns
The logarithm base 2 of num. If a mathematical error occurs or num is negative, then an exception is thrown.

◆ LogBaseTwo() [4/4]

long Ace::LogBaseTwo ( const long &  num)
static

Calculates the logarithm (log) base 2 of num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long retVal = Ace::LogBaseTwo((long)69);
printf("%ld\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:6

Parameters
numNumber to use to calculate its logarithm base 2.
Returns
The logarithm base 2 of num. If a mathematical error occurs or num is negative, then an exception is thrown.

◆ Mod() [1/4]

double Ace::Mod ( const double &  numerator,
const double &  denominator 
)
static

Computes the floating-point remainder of the division operation numerator/denominator in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
double result = Ace::Mod(9.0, 5.0);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:4.000000

Parameters
numeratorNumber to be divided.
denominatorNumber to divide the numerator by.
Returns
The remainder of the division operation. If a mathematical error occurs or if denominator equals 0, then an exception is thrown.

◆ Mod() [2/4]

float Ace::Mod ( const float &  numerator,
const float &  denominator 
)
static

Computes the floating-point remainder of the division operation numerator/denominator in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float result = Ace::Mod(9.0f, 5.0f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:4.000000

Parameters
numeratorNumber to be divided.
denominatorNumber to divide the numerator by.
Returns
The remainder of the division operation. If a mathematical error occurs or if denominator equals 0, then an exception is thrown.

◆ Mod() [3/4]

int Ace::Mod ( const int &  numerator,
const int &  denominator 
)
static

Computes the floating-point remainder of the division operation numerator/denominator in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int result = Ace::Mod(9, 5);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:4

Parameters
numeratorNumber to be divided.
denominatorNumber to divide the numerator by.
Returns
The remainder of the division operation. If a mathematical error occurs or if denominator equals 0, then an exception is thrown.

◆ Mod() [4/4]

long Ace::Mod ( const long &  numerator,
const long &  denominator 
)
static

Computes the floating-point remainder of the division operation numerator/denominator in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::Mod((long)9, (long)5);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:4

Parameters
numeratorNumber to be divided.
denominatorNumber to divide the numerator by.
Returns
The remainder of the division operation. If a mathematical error occurs or if denominator equals 0, then an exception is thrown.

◆ MultiplyThenAdd() [1/4]

double Ace::MultiplyThenAdd ( const double &  multOne,
const double &  multTwo,
const double &  add 
)
static

Calculates the product of multOne * multTwo, then adds add to that product (i.e.

(multOne * multTwo) + add). Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
double result = Ace::MultiplyThenAdd(9.0, 3.0, 15.0);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:42.000000

Parameters
multOneNumber to multiply.
multTwoOther number to multiply.
addNumber to add to the product of multOne * multTwo.
Returns
The result of (multOne * multTwo) + add. If a mathematical error occurs then an exception is thrown.

◆ MultiplyThenAdd() [2/4]

float Ace::MultiplyThenAdd ( const float &  multOne,
const float &  multTwo,
const float &  add 
)
static

Calculates the product of multOne * multTwo, then adds add to that product (i.e.

(multOne * multTwo) + add). Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016 try { float result = Ace::MultiplyThenAdd(9.0f, 3.0f, 15.0f); printf("%f\n", result); } catch (char* exceptionMessage) { printf("%s\n", exceptionMessage); }

Output:42.000000

Parameters
multOneNumber to multiply.
multTwoOther number to multiply.
addNumber to add to the product of multOne * multTwo.
Returns
The result of (multOne * multTwo) + add. If a mathematical error occurs then an exception is thrown.

◆ MultiplyThenAdd() [3/4]

int Ace::MultiplyThenAdd ( const int &  multOne,
const int &  multTwo,
const int &  add 
)
static

Calculates the product of multOne * multTwo, then adds add to that product (i.e.

(multOne * multTwo) + add). Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int result = Ace::MultiplyThenAdd(9, 3, 15);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:42

Parameters
multOneNumber to multiply.
multTwoOther number to multiply.
addNumber to add to the product of multOne * multTwo.
Returns
The result of (multOne * multTwo) + add. If a mathematical error occurs then an exception is thrown.

◆ MultiplyThenAdd() [4/4]

long Ace::MultiplyThenAdd ( const long &  multOne,
const long &  multTwo,
const long &  add 
)
static

Calculates the product of multOne * multTwo, then adds add to that product (i.e.

(multOne * multTwo) + add). Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::MultiplyThenAdd((long)9, (long)3, (long)15);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:42

Parameters
multOneNumber to multiply.
multTwoOther number to multiply.
addNumber to add to the product of multOne * multTwo.
Returns
The result of (multOne * multTwo) + add. If a mathematical error occurs then an exception is thrown.

◆ NaturalLog() [1/4]

double Ace::NaturalLog ( const double &  num)
static

Calculates the Natural Logarithm (ln) of num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
double retVal = Ace::NaturalLog(69.0);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double NaturalLog(const double &num)
Calculates the Natural Logarithm (ln) of num in compliance with CERT Coding Standard.
Definition: Ace.cpp:14591

Output:4.234107

Parameters
numNumber to use to calculate its Natural Logarithm.
Returns
The Natural Logarithm of num. If a mathematical error occurs or num is negative, then an exception is thrown.

◆ NaturalLog() [2/4]

float Ace::NaturalLog ( const float &  num)
static

Calculates the Natural Logarithm (ln) of num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
float retVal = Ace::NaturalLog(69.0f);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:4.234107

Parameters
numNumber to use to calculate its Natural Logarithm.
Returns
The Natural Logarithm of num. If a mathematical error occurs or num is negative, then an exception is thrown.

◆ NaturalLog() [3/4]

int Ace::NaturalLog ( const int &  num)
static

Calculates the Natural Logarithm (ln) of num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int retVal = Ace::NaturalLog(69);
printf("%d\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:4

Parameters
numNumber to use to calculate its Natural Logarithm.
Returns
The Natural Logarithm of num. If a mathematical error occurs or num is negative, then an exception is thrown.

◆ NaturalLog() [4/4]

long Ace::NaturalLog ( const long &  num)
static

Calculates the Natural Logarithm (ln) of num in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long retVal = Ace::NaturalLog((long)69);
printf("%ld\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:4

Parameters
numNumber to use to calculate its Natural Logarithm.
Returns
The Natural Logarithm of num. If a mathematical error occurs or num is negative, then an exception is thrown.

◆ NaturalLogGammaFunction() [1/4]

double Ace::NaturalLogGammaFunction ( const double &  num)
static

Calculates The Natural Log (ln) of The Gamma Function (ln | (0)integral(Inf)[t^num-1 * e^-t dt] |).

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
double result = Ace::NaturalLogGammaFunction(5.0);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:3.178054

Parameters
numNumber to use for t^num-1 in the equation.
Returns
The result of calculating The Gamma Function for t^num-1. If a mathematical error occurs or if num is less than or equal to 0.0, then an exception is thrown.

◆ NaturalLogGammaFunction() [2/4]

float Ace::NaturalLogGammaFunction ( const float &  num)
static

Calculates The Natural Log (ln) of The Gamma Function (ln | (0)integral(Inf)[t^num-1 * e^-t dt] |).

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float result = Ace::NaturalLogGammaFunction(5.0f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:3.178054

Parameters
numNumber to use for t^num-1 in the equation.
Returns
The result of calculating The Gamma Function for t^num-1. If a mathematical error occurs or if num is less than or equal to 0.0, then an exception is thrown.

◆ NaturalLogGammaFunction() [3/4]

int Ace::NaturalLogGammaFunction ( const int &  num)
static

Calculates The Natural Log (ln) of The Gamma Function (ln | (0)integral(Inf)[t^num-1 * e^-t dt] |).

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:3

Parameters
numNumber to use for t^num-1 in the equation.
Returns
The result of calculating The Gamma Function for t^num-1. If a mathematical error occurs or if num is less than or equal to 0, then an exception is thrown.

◆ NaturalLogGammaFunction() [4/4]

long Ace::NaturalLogGammaFunction ( const long &  num)
static

Calculates The Natural Log (ln) of The Gamma Function (ln | (0)integral(Inf)[t^num-1 * e^-t dt] |).

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::NaturalLogGammaFunction((long)5);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:3

Parameters
numNumber to use for t^num-1 in the equation.
Returns
The result of calculating The Gamma Function for t^num-1. If a mathematical error occurs or if num is less than or equal to 0, then an exception is thrown.

◆ NextIndexOf() [1/4]

int Ace::NextIndexOf ( const char *  strToSearch,
const char &  charToLookFor,
const int &  startIndex 
)
static

Retrieves the first occurrence of charToLookFor in strToSearch starting at startIndex onward.

Author
Eddie O'Hagan
Date
10/10/2016
try
{
int retVal = Ace::NextIndexOf("I wish I blew it up instead...wicked.", 'I', 1);
printf("%d\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:7

Parameters
strToSearchString to search through.
charToLookForCharacter to look for in strToSearch.
startIndexIndex to start looking.
Returns
The index of the first occurrence of charToLookFor starting from startIndex. If not found, -1 is returned. Throws an exception if strToSearch is NULL.

◆ NextIndexOf() [2/4]

int Ace::NextIndexOf ( const char *  strToSearch,
const char *  strToLookFor,
const int &  startIndex 
)
static

Retrieves the first occurrence of strToLookFor in strToSearch starting at startIndex onward.

Author
Eddie O'Hagan
Date
10/10/2016
try
{
int retVal = Ace::NextIndexOf("I wish I blew it up instead...wicked.", "wicked", 1);
printf("%d\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:30

Parameters
strToSearchString to search through.
strToLookForString to look for in strToSearch.
startIndexIndex to start looking.
Returns
The index of the first occurrence of strToLookFor starting from startIndex. If not found, -1 is returned. Throws an exception if an error occurs.

◆ NextIndexOf() [3/4]

int Ace::NextIndexOf ( const wchar_t *  strToSearch,
const wchar_t &  charToLookFor,
const int &  startIndex 
)
static

Retrieves the first occurrence of charToLookFor in strToSearch starting at startIndex onward.

Author
Eddie O'Hagan
Date
10/10/2016
try
{
int retVal = Ace::NextIndexOf(L"I wish I blew it up instead...wicked.", L'I', 1);
wprintf(L"%d\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:7

Parameters
strToSearchWide String to search through.
charToLookForWide Character to look for in strToSearch.
startIndexIndex to start looking.
Returns
The index of the first occurrence of charToLookFor starting from startIndex. If not found, -1 is returned. Throws an exception if strToSearch is NULL.

◆ NextIndexOf() [4/4]

int Ace::NextIndexOf ( const wchar_t *  strToSearch,
const wchar_t *  strToLookFor,
const int &  startIndex 
)
static

Retrieves the first occurrence of strToLookFor in strToSearch starting at startIndex onward.

Author
Eddie O'Hagan
Date
10/10/2016
try
{
int retVal = Ace::NextIndexOf(L"I wish I blew it up instead...wicked.", L"wicked", 1);
wprintf(L"%d\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:30

Parameters
strToSearchWide String to search through.
strToLookForWide String to look for in strToSearch.
startIndexIndex to start looking.
Returns
The index of the first occurrence of strToLookFor starting from startIndex. If not found, -1 is returned. Throws an exception if an error occurs.

◆ NumTimesTwoToTheXPower() [1/4]

double Ace::NumTimesTwoToTheXPower ( const double &  num,
const double &  power 
)
static

Calculates num * 2^power in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/5/2016
try
{
double result = Ace::NumTimesTwoToTheXPower(1.0 / 3.0, 5.0);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double NumTimesTwoToTheXPower(const double &num, const double &power)
Calculates num * 2^power in compliance with CERT Coding Standard.
Definition: Ace.cpp:15423

Output:10.666667

Parameters
numNumber to multiply 2^power by.
powerNumber to raise 2 to.
Returns
The result of num * 2^power. If a mathematical error occurs then an exception is thrown.

◆ NumTimesTwoToTheXPower() [2/4]

float Ace::NumTimesTwoToTheXPower ( const float &  num,
const float &  power 
)
static

Calculates num * 2^power in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float result = Ace::NumTimesTwoToTheXPower(1.0f / 3.0f, 5.0f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:10.666667

Parameters
numNumber to multiply 2^power by.
powerNumber to raise 2 to.
Returns
The result of num * 2^power. If a mathematical error occurs then an exception is thrown.

◆ NumTimesTwoToTheXPower() [3/4]

int Ace::NumTimesTwoToTheXPower ( const int &  num,
const int &  power 
)
static

Calculates num * 2^power in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int result = Ace::NumTimesTwoToTheXPower(3, 5);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:96

Parameters
numNumber to multiply 2^power by.
powerNumber to raise 2 to.
Returns
The result of num * 2^power. If a mathematical error occurs then an exception is thrown.

◆ NumTimesTwoToTheXPower() [4/4]

long Ace::NumTimesTwoToTheXPower ( const long &  num,
const long &  power 
)
static

Calculates num * 2^power in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::NumTimesTwoToTheXPower((long)3, (long)5);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:96

Parameters
numNumber to multiply 2^power by.
powerNumber to raise 2 to.
Returns
The result of num * 2^power. If a mathematical error occurs then an exception is thrown.

◆ PositiveDifference() [1/4]

double Ace::PositiveDifference ( const double &  numOne,
const double &  numTwo 
)
static

Calculates the difference between numOne and numTwo only if numOne > numTwo.

If numOne <= numTwo then 0 is returned. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/5/2016
try
{
double result = Ace::PositiveDifference(6.3, 2.7);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double PositiveDifference(const double &numOne, const double &numTwo)
Calculates the difference between numOne and numTwo only if numOne > numTwo.
Definition: Ace.cpp:15662

Output:3.600000

Parameters
numOneNumber to use for subtraction.
numTwoOther number to use for subtraction.
Returns
If numOne is larger then numTwo; then numOne - numTwo is returned, else 0 is returned. If a mathematical error occurs then an exception is thrown.

◆ PositiveDifference() [2/4]

float Ace::PositiveDifference ( const float &  numOne,
const float &  numTwo 
)
static

Calculates the difference between numOne and numTwo only if numOne > numTwo.

If numOne <= numTwo then 0 is returned. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/5/2016
try
{
float result = Ace::PositiveDifference(6.3f, 2.7f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:3.600000

Parameters
numOneNumber to use for subtraction.
numTwoOther number to use for subtraction.
Returns
If numOne is larger then numTwo; then numOne - numTwo is returned, else 0 is returned. If a mathematical error occurs then an exception is thrown.

◆ PositiveDifference() [3/4]

int Ace::PositiveDifference ( const int &  numOne,
const int &  numTwo 
)
static

Calculates the difference between numOne and numTwo only if numOne > numTwo.

If numOne <= numTwo then 0 is returned. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/5/2016
try
{
int result = Ace::PositiveDifference(6, 2);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:4

Parameters
numOneNumber to use for subtraction.
numTwoOther number to use for subtraction.
Returns
If numOne is larger then numTwo; then numOne - numTwo is returned, else 0 is returned. If a mathematical error occurs then an exception is thrown.

◆ PositiveDifference() [4/4]

long Ace::PositiveDifference ( const long &  numOne,
const long &  numTwo 
)
static

Calculates the difference between numOne and numTwo only if numOne > numTwo.

If numOne <= numTwo then 0 is returned. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::PositiveDifference((long)6, (long)2);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:4

Parameters
numOneNumber to use for subtraction.
numTwoOther number to use for subtraction.
Returns
If numOne is larger then numTwo; then numOne - numTwo is returned, else 0 is returned. If a mathematical error occurs then an exception is thrown.

◆ Power() [1/4]

double Ace::Power ( const double &  base,
const double &  exponent 
)
static

Takes the provided base and raises it to the exponent (power).

Author
Eddie O'Hagan
Date
9/29/2016
try
{
double powResult = Ace::Power(2.0, 5.0);
printf("%f\n", powResult);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double Power(const double &base, const double &exponent)
Takes the provided base and raises it to the exponent (power).
Definition: Ace.cpp:15905

Output:32.000000

Parameters
baseNumber to raise.
exponentNumber of times to multiply base by itself.
Returns
The base raised to the exponent is returned. If a mathematical error occurs or base is 0.0 and exponent is less than or equal to 0.0 OR base is negative, then an exception is thrown.

◆ Power() [2/4]

float Ace::Power ( const float &  base,
const float &  exponent 
)
static

Takes the provided base and raises it to the exponent (power).

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float powResult = Ace::Power(2.0f, 5.0f);
printf("%f\n", powResult);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:32.000000

Parameters
baseNumber to raise.
exponentNumber of times to multiply base by itself.
Returns
The base raised to the exponent is returned. If a mathematical error occurs or base is 0.0 and exponent is less than or equal to 0.0 OR base is negative, then an exception is thrown.

◆ Power() [3/4]

int Ace::Power ( const int &  base,
const int &  exponent 
)
static

Takes the provided base and raises it to the exponent (power).

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int powResult = Ace::Power(2, 5);
printf("%d\n", powResult);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:32

Parameters
baseNumber to raise.
exponentNumber of times to multiply base by itself.
Returns
The base raised to the exponent is returned. If a mathematical error occurs or base is 0 and exponent is less than or equal to 0 OR base is negative, then an exception is thrown.

◆ Power() [4/4]

long Ace::Power ( const long &  base,
const long &  exponent 
)
static

Takes the provided base and raises it to the exponent (power).

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long powResult = Ace::Power((long)2, (long)5);
printf("%ld\n", powResult);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:32

Parameters
baseNumber to raise.
exponentNumber of times to multiply base by itself.
Returns
The base raised to the exponent is returned. If a mathematical error occurs or base is 0 and exponent is less than or equal to 0 OR base is negative, then an exception is thrown.

◆ RadiansToDegrees() [1/4]

double Ace::RadiansToDegrees ( const double &  radians)
static

Converts a number from radians to degrees.

Author
Eddie O'Hagan
Date
5/16/2016
double rad = 1.570796;
double deg = Ace::RadiansToDegrees(rad);
printf("%f\n", deg);
static double RadiansToDegrees(const double &radians)
Converts a number from radians to degrees.
Definition: Ace.cpp:16175

Output:89.999981

Parameters
[in]radiansRadians to convert.
Returns
Degrees.

◆ RadiansToDegrees() [2/4]

float Ace::RadiansToDegrees ( const float &  radians)
static

Converts a number from radians to degrees.

Author
Eddie O'Hagan
Date
5/16/2016
float rad = 1.570796f;
float deg = Ace::RadiansToDegrees(rad);
printf("%f\n", deg);

Output:89.999981

Parameters
[in]radiansRadians to convert.
Returns
Degrees.

◆ RadiansToDegrees() [3/4]

int Ace::RadiansToDegrees ( const int &  radians)
static

Converts a number from radians to degrees.

Author
Eddie O'Hagan
Date
5/16/2016
int rad = 1;
int deg = Ace::RadiansToDegrees(rad);
printf("%d\n", deg);

Output:57

Parameters
[in]radiansRadians to convert.
Returns
Degrees.

◆ RadiansToDegrees() [4/4]

long Ace::RadiansToDegrees ( const long &  radians)
static

Converts a number from radians to degrees.

Author
Eddie O'Hagan
Date
7/23/2023
long rad = 1;
long deg = Ace::RadiansToDegrees(rad);
printf("%ld\n", deg);

Output:57

Parameters
[in]radiansRadians to convert.
Returns
Degrees.

◆ Range() [1/4]

double Ace::Range ( const double &  inValue,
const double &  minInRange,
const double &  maxInRange,
const double &  minOutRange,
const double &  maxOutRange 
)
static

Takes the provided inValue with a range of minInRange to maxInRange, and maps the converted value between minOutRange and maxOutRange.

For example, if we want to map the inValue (which ranges from 0 to 1024) and get the equivalent value if the range was between 0.0 and 5.0. Then we could do the following (see below example):

Author
Eddie O'Hagan
Date
7/22/2023
double inNum = 512.0;
double rangedNum = Ace::Range(inNum, 0.0, 1024.0, 0.0, 5.0);
printf("inNum=%f rangedNum=%f", inNum, rangedNum);
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

Output:inNum=512.000000 rangedNum=2.500000

Parameters
[in]inValueThe number to convert/map to the range of minOutRange to maxOutRange.
[in]minInRangeThe lowest possible value for inValue.
[in]maxInRangeThe highest possible value for inVale.
[in]minOutRangeThe lowest possible value for the converted value (return value).
[in]minOutRangeThe highest possible value for the converted value (return value).
Returns
Converted inValue between range of minOutRange and maxOutRange.

◆ Range() [2/4]

float Ace::Range ( const float &  inValue,
const float &  minInRange,
const float &  maxInRange,
const float &  minOutRange,
const float &  maxOutRange 
)
static

Takes the provided inValue with a range of minInRange to maxInRange, and maps the converted value between minOutRange and maxOutRange.

For example, if we want to map the inValue (which ranges from 0 to 1024) and get the equivalent value if the range was between 0.0 and 5.0. Then we could do the following (see below example):

Author
Eddie O'Hagan
Date
7/22/2023
float inNum = 512.0f;
float rangedNum = Ace::Range(inNum, 0.0f, 1024.0f, 0.0f, 5.0f);
printf("inNum=%f rangedNum=%f", inNum, rangedNum);

Output:inNum=512.000000 rangedNum=2.500000

Parameters
[in]inValueThe number to convert/map to the range of minOutRange to maxOutRange.
[in]minInRangeThe lowest possible value for inValue.
[in]maxInRangeThe highest possible value for inVale.
[in]minOutRangeThe lowest possible value for the converted value (return value).
[in]minOutRangeThe highest possible value for the converted value (return value).
Returns
Converted inValue between range of minOutRange and maxOutRange.

◆ Range() [3/4]

int Ace::Range ( const int &  inValue,
const int &  minInRange,
const int &  maxInRange,
const int &  minOutRange,
const int &  maxOutRange 
)
static

Takes the provided inValue with a range of minInRange to maxInRange, and maps the converted value between minOutRange and maxOutRange.

For example, if we want to map the inValue (which ranges from 0 to 1024) and get the equivalent value if the range was between 0 and 5. Then we could do the following (see below example):

Author
Eddie O'Hagan
Date
7/22/2023
int inNum = 512;
int rangedNum = Ace::Range(inNum, 0, 1024, 0, 5);
printf("inNum=%d rangedNum=%d", inNum, rangedNum);

Output:inNum=512 rangedNum=2

Parameters
[in]inValueThe number to convert/map to the range of minOutRange to maxOutRange.
[in]minInRangeThe lowest possible value for inValue.
[in]maxInRangeThe highest possible value for inVale.
[in]minOutRangeThe lowest possible value for the converted value (return value).
[in]minOutRangeThe highest possible value for the converted value (return value).
Returns
Converted inValue between range of minOutRange and maxOutRange.

◆ Range() [4/4]

long Ace::Range ( const long &  inValue,
const long &  minInRange,
const long &  maxInRange,
const long &  minOutRange,
const long &  maxOutRange 
)
static

Takes the provided inValue with a range of minInRange to maxInRange, and maps the converted value between minOutRange and maxOutRange.

For example, if we want to map the inValue (which ranges from 0 to 1024) and get the equivalent value if the range was between 0 and 5. Then we could do the following (see below example):

Author
Eddie O'Hagan
Date
7/23/2023
long inNum = 512;
long rangedNum = Ace::Range(inNum, (long)0, (long)1024, (long)0, (long)5);
printf("inNum=%ld rangedNum=%ld\n", inNum, rangedNum);

Output:inNum=512 rangedNum=2

Parameters
[in]inValueThe number to convert/map to the range of minOutRange to maxOutRange.
[in]minInRangeThe lowest possible value for inValue.
[in]maxInRangeThe highest possible value for inVale.
[in]minOutRangeThe lowest possible value for the converted value (return value).
[in]minOutRangeThe highest possible value for the converted value (return value).
Returns
Converted inValue between range of minOutRange and maxOutRange.

◆ ReadBinaryFile() [1/2]

void * Ace::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 
)
static

Opens a file for reading and returns a char buffer containing some or all of the data in the file.

Created in compliance with the CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/13/2016
try
{
int rectIndex;
const int numRectangles = 3;
RECT* currRect;
RECT myRectangles[numRectangles];
//Create 3 rectangles with different values.
for (rectIndex = 0; rectIndex < numRectangles; rectIndex++)
{
myRectangles[rectIndex].left = rectIndex;
myRectangles[rectIndex].right = rectIndex + 1;
myRectangles[rectIndex].top = rectIndex * rectIndex;
myRectangles[rectIndex].bottom = rectIndex / 2;
printf("Writing Rect[%d] to file with values: L%d R%d T%d B%d \n",
rectIndex,
myRectangles[rectIndex].left,
myRectangles[rectIndex].right,
myRectangles[rectIndex].top,
myRectangles[rectIndex].bottom);
Ace::WriteBinaryFile("C:\\rectangleData.bin", &myRectangles[rectIndex], sizeof(RECT), "ab");
}
//Read in those created rectangles, we expect to get the same values back as we originally wrote.
for (rectIndex = 0; rectIndex < numRectangles; rectIndex++)
{
currRect = (RECT*)Ace::ReadBinaryFile("C:\\rectangleData.bin", sizeof(RECT), MAX_STRING_BUFFER_SIZE, "rb", rectIndex * sizeof(RECT));
printf("Reading Rect[%d] from the file with values: L%d R%d T%d B%d \n",
rectIndex,
currRect->left,
currRect->right,
currRect->top,
currRect->bottom);
_aligned_free(currRect);
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static const size_t MAX_STRING_BUFFER_SIZE
Definition: Ace.h:31
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 * 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

Output:Writing Rect[0] to file with values: L0 R1 T0 B0 Writing Rect[1] to file with values: L1 R2 T1 B0 Writing Rect[2] to file with values: L2 R3 T4 B1 Reading Rect[0] from the file with values: L0 R1 T0 B0 Reading Rect[1] from the file with values: L1 R2 T1 B0 Reading Rect[2] from the file with values: L2 R3 T4 B1

Parameters
[in]filePathThe path to the file.
numBytesToReadThe size of the buffer (the number bytes read in). If 0; numBytesToRead = maxBufferSize.
maxBufferSizeMaximum number of bytes to read.
[in]modeThe mode for fopen_s ("r" for read, "r+" for read/write, etc).
seekOffsetNumber of bytes to offset from origin.
seekOriginPosition used as reference for the offset (SEEK_SET represents beginning of file).
[out]outEndCursorPosThe value returned by ftell() after doing the read.
Returns
The buffer containing the file data of size numBytesToRead. Throws an exception if error occurs.

◆ ReadBinaryFile() [2/2]

bool Ace::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 
)
static

Opens a file for reading and returns a char buffer containing some or all of the data in the file.

Created in compliance with the CERT Coding Standard.

Author
Eddie O'Hagan
Date
4/5/2022
try
{
int rectIndex;
const int numRectangles = 3;
RECT* currRect;
RECT myRectangles[numRectangles];
//Create 3 rectangles with different values.
for (rectIndex = 0; rectIndex < numRectangles; rectIndex++)
{
myRectangles[rectIndex].left = rectIndex;
myRectangles[rectIndex].right = rectIndex + 1;
myRectangles[rectIndex].top = rectIndex * rectIndex;
myRectangles[rectIndex].bottom = rectIndex / 2;
printf("Writing Rect[%d] to file with values: L%d R%d T%d B%d \n",
rectIndex,
myRectangles[rectIndex].left,
myRectangles[rectIndex].right,
myRectangles[rectIndex].top,
myRectangles[rectIndex].bottom);
Ace::WriteBinaryFile("C:\\rectangleData.bin", &myRectangles[rectIndex], sizeof(RECT), "ab");
}
//Read in those created rectangles, we expect to get the same values back as we originally wrote.
for (rectIndex = 0; rectIndex < numRectangles; rectIndex++)
{
currRect = (RECT*)Ace::_Aligned_Malloc(sizeof(RECT));
if (Ace::ReadBinaryFile(currRect, "C:\\rectangleData.bin", sizeof(RECT), MAX_STRING_BUFFER_SIZE, "rb", rectIndex * sizeof(RECT)) == true)
{
printf("Reading Rect[%d] from the file with values: L%d R%d T%d B%d \n",
rectIndex,
currRect->left,
currRect->right,
currRect->top,
currRect->bottom);
}
else
{
printf("%s\n", "Failed to read binary file.");
}
_aligned_free(currRect);
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Writing Rect[0] to file with values: L0 R1 T0 B0 Writing Rect[1] to file with values: L1 R2 T1 B0 Writing Rect[2] to file with values: L2 R3 T4 B1 Reading Rect[0] from the file with values: L0 R1 T0 B0 Reading Rect[1] from the file with values: L1 R2 T1 B0 Reading Rect[2] from the file with values: L2 R3 T4 B1

Parameters
[in]destinationThe Destination Buffer to store the text of size numBytesToRead.
[in]filePathThe path to the file.
numBytesToReadThe size of the buffer (the number bytes read in). If 0; numBytesToRead = maxBufferSize.
maxBufferSizeMaximum number of bytes to read.
[in]modeThe mode for fopen_s ("r" for read, "r+" for read/write, etc).
seekOffsetNumber of bytes to offset from origin.
seekOriginPosition used as reference for the offset (SEEK_SET represents beginning of file).
[out]outEndCursorPosThe value returned by ftell() after doing the read.
Returns
true if the process was a success, false otherwise. Throws an exception if error occurs.

◆ ReadBinaryFileW() [1/2]

void * Ace::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 
)
static

Opens a file for reading and returns a wide char buffer containing some or all of the data in the file.

Created in compliance with the CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/13/2016
try
{
int rectIndex;
const int numRectangles = 3;
RECT* currRect;
RECT myRectangles[numRectangles];
//Change windows font to display console output in Japanese.
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == false)
{
printf("%s\n", "Error: Failed to change windows font.");
}
//Create 3 rectangles with different values.
for (rectIndex = 0; rectIndex < numRectangles; rectIndex++)
{
myRectangles[rectIndex].left = rectIndex;
myRectangles[rectIndex].right = rectIndex + 1;
myRectangles[rectIndex].top = rectIndex * rectIndex;
myRectangles[rectIndex].bottom = rectIndex / 2;
wprintf(L"長方形を書く[%d] 値をファイルする: L%d R%d T%d B%d \n",
rectIndex,
myRectangles[rectIndex].left,
myRectangles[rectIndex].right,
myRectangles[rectIndex].top,
myRectangles[rectIndex].bottom);
Ace::WriteBinaryFileW(L"C:\\長方形データ.bin", &myRectangles[rectIndex], sizeof(RECT), L"ab");
}
//Read in those created rectangles, we expect to get the same values back as we originally wrote.
for (rectIndex = 0; rectIndex < numRectangles; rectIndex++)
{
currRect = (RECT*)Ace::ReadBinaryFileW(L"C:\\長方形データ.bin", sizeof(RECT), MAX_STRING_BUFFER_SIZE, L"rb", rectIndex * sizeof(RECT));
wprintf(L"長方形を読む[%d] 値を持つファイルから: L%d R%d T%d B%d \n",
rectIndex,
currRect->left,
currRect->right,
currRect->top,
currRect->bottom);
_aligned_free(currRect);
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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 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

Output:長方形を書く[0] 値をファイルする: L0 R1 T0 B0 長方形を書く[1] 値をファイルする: L1 R2 T1 B0 長方形を書く[2] 値をファイルする: L2 R3 T4 B1 長方形を読む[0] 値を持つファイルから: L0 R1 T0 B0 長方形を読む[1] 値を持つファイルから: L1 R2 T1 B0 長方形を読む[2] 値を持つファイルから: L2 R3 T4 B1

Parameters
[in]filePathThe path to the file.
numBytesToReadThe size of the buffer (the number bytes read in). If 0; numBytesToRead = maxBufferSize.
maxBufferSizeMaximum number of bytes to read.
[in]modeThe mode for fopen_s ("r" for read, "r, ccs=UTF-8" for read unicode, "r+" for read/write, etc).
seekOffsetNumber of bytes to offset from origin.
seekOriginPosition used as reference for the offset (SEEK_SET represents beginning of file).
[out]outEndCursorPosThe value returned by ftell() after doing the read.
Returns
The buffer containing the file data of size numBytesToRead. Throws an exception if error occurs.

◆ ReadBinaryFileW() [2/2]

bool Ace::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 
)
static

Opens a file for reading and returns a char buffer containing some or all of the data in the file.

Created in compliance with the CERT Coding Standard.

Author
Eddie O'Hagan
Date
4/5/2022
try
{
int rectIndex;
const int numRectangles = 3;
RECT* currRect;
RECT myRectangles[numRectangles];
//Change windows font to display console output in Japanese.
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == false)
{
printf("%s\n", "Error: Failed to change windows font.");
}
//Create 3 rectangles with different values.
for (rectIndex = 0; rectIndex < numRectangles; rectIndex++)
{
myRectangles[rectIndex].left = rectIndex;
myRectangles[rectIndex].right = rectIndex + 1;
myRectangles[rectIndex].top = rectIndex * rectIndex;
myRectangles[rectIndex].bottom = rectIndex / 2;
wprintf(L"長方形を書く[%d] 値をファイルする: L%d R%d T%d B%d \n",
rectIndex,
myRectangles[rectIndex].left,
myRectangles[rectIndex].right,
myRectangles[rectIndex].top,
myRectangles[rectIndex].bottom);
Ace::WriteBinaryFileW(L"C:\\長方形データ.bin", &myRectangles[rectIndex], sizeof(RECT), L"ab");
}
//Read in those created rectangles, we expect to get the same values back as we originally wrote.
for (rectIndex = 0; rectIndex < numRectangles; rectIndex++)
{
currRect = (RECT*)Ace::_Aligned_Malloc(sizeof(RECT));
if (Ace::ReadBinaryFileW(currRect, L"C:\\長方形データ.bin", sizeof(RECT), MAX_STRING_BUFFER_SIZE, L"rb", rectIndex * sizeof(RECT)) == true)
{
wprintf(L"長方形を読む[%d] 値を持つファイルから: L%d R%d T%d B%d \n",
rectIndex,
currRect->left,
currRect->right,
currRect->top,
currRect->bottom);
}
else
{
printf("%s\n", "Failed to read binary file.");
}
_aligned_free(currRect);
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:長方形を書く[0] 値をファイルする: L0 R1 T0 B0 長方形を書く[1] 値をファイルする: L1 R2 T1 B0 長方形を書く[2] 値をファイルする: L2 R3 T4 B1 長方形を読む[0] 値を持つファイルから: L0 R1 T0 B0 長方形を読む[1] 値を持つファイルから: L1 R2 T1 B0 長方形を読む[2] 値を持つファイルから: L2 R3 T4 B1

Parameters
[in]destinationThe Destination Buffer to store the text of size numBytesToRead.
[in]filePathThe path to the file.
numBytesToReadThe size of the buffer (the number bytes read in). If 0; numBytesToRead = maxBufferSize.
maxBufferSizeMaximum number of bytes to read.
[in]modeThe mode for fopen_s ("r" for read, "r+" for read/write, etc).
seekOffsetNumber of bytes to offset from origin.
seekOriginPosition used as reference for the offset (SEEK_SET represents beginning of file).
[out]outEndCursorPosThe value returned by ftell() after doing the read.
Returns
true if the process was a success, false otherwise. Throws an exception if error occurs.

◆ ReadTextFile() [1/2]

bool Ace::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 
)
static

Opens a file for reading and returns a char buffer containing some or all of the data in the file.

Created in compliance with the CERT Coding Standard.

Author
Eddie O'Hagan
Date
4/4/2022
try
{
char retVal[2048];
if (Ace::ReadTextFile(retVal, "C:\\dicks.txt", 2048) == true)
{
printf("%s\n", retVal);
}
else
{
printf("%s\n", "Failed to read file.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:dicksdicksdicksdicksdicksdicksdick8=>

Parameters
[in]destinationThe Destination Buffer to store the text of size numBytesToRead.
[in]filePathThe path to the file.
numBytesToReadThe size of the buffer (the number bytes read in). If 0; numBytesToRead = maxBufferSize.
maxBufferSizeMaximum number of bytes to read.
[in]modeThe mode for fopen_s ("r" for read, "r+" for read/write, etc).
seekOffsetEither zero, or a value returned by ftell().
seekOriginPosition used as reference for the offset (SEEK_SET represents beginning of file).
[out]outEndCursorPosThe value returned by ftell() after doing the read.
Returns
true if the process was a success, false otherwise. Throws an exception if error occurs.

◆ ReadTextFile() [2/2]

char * Ace::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 
)
static

Opens a file for reading and returns a char buffer containing some or all of the data in the file.

Created in compliance with the CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/12/2016
try
{
char* retVal = Ace::ReadTextFile("C:\\dicks.txt");
printf("%s\n", retVal);
_aligned_free(retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:dicksdicksdicksdicksdicksdicksdick8=>

Parameters
[in]filePathThe path to the file.
numBytesToReadThe size of the buffer (the number bytes read in). If 0; numBytesToRead = maxBufferSize.
maxBufferSizeMaximum number of bytes to read.
[in]modeThe mode for fopen_s ("r" for read, "r+" for read/write, etc).
seekOffsetEither zero, or a value returned by ftell().
seekOriginPosition used as reference for the offset (SEEK_SET represents beginning of file).
[out]outEndCursorPosThe value returned by ftell() after doing the read.
Returns
The buffer containing the file data of size numBytesToRead. Throws an exception if error occurs.

◆ ReadTextFileW() [1/2]

wchar_t * Ace::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 
)
static

Opens a file for reading and returns a wide char buffer containing some or all of the data in the file.

Created in compliance with the CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/13/2016
try
{
//By default, read mode is set to "r, ccs=UTF-8".
wchar_t* retVal = Ace::ReadTextFileW(L"C:\\jap.txt");
MessageBoxW(NULL, retVal, NULL, 0);
_aligned_free(retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:わたし は エドワド オ’ハゲン です。 これ は なん です か?

Parameters
[in]filePathThe path to the file.
numBytesToReadThe size of the buffer (the number bytes read in). If 0; numBytesToRead = maxBufferSize.
maxBufferSizeMaximum number of bytes to read.
[in]modeThe mode for fopen_s ("r" for read, "r, ccs=UTF-8" for read unicode, "r+" for read/write, etc).
seekOffsetEither zero, or a value returned by ftell().
seekOriginPosition used as reference for the offset (SEEK_SET represents beginning of file).
[out]outEndCursorPosThe value returned by ftell() after doing the read.
Returns
The buffer containing the file data of size numBytesToRead. Throws an exception if error occurs.

◆ ReadTextFileW() [2/2]

bool Ace::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 
)
static

Opens a file for reading and returns a char buffer containing some or all of the data in the file.

Created in compliance with the CERT Coding Standard.

Author
Eddie O'Hagan
Date
4/4/2022
try
{
wchar_t retVal[2048];
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
if (Ace::ReadTextFileW(retVal, L"C:\\日本語.txt", 2048) == true)
{
wprintf(L"%ls", retVal);
}
else
{
printf("%s\n", "Failed to read file.");
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:わたし は エドワド オ’ハゲン です。 これ は なん です か?

Parameters
[in]destinationThe Destination Buffer to store the text of size numBytesToRead.
[in]filePathThe path to the file.
numBytesToReadThe size of the buffer (the number bytes read in). If 0; numBytesToRead = maxBufferSize.
maxBufferSizeMaximum number of bytes to read.
[in]modeThe mode for fopen_s ("r" for read, "r+" for read/write, etc).
seekOffsetEither zero, or a value returned by ftell().
seekOriginPosition used as reference for the offset (SEEK_SET represents beginning of file).
[out]outEndCursorPosThe value returned by ftell() after doing the read.
Returns
true if the process was a success, false otherwise. Throws an exception if error occurs.

◆ Remainder() [1/4]

double Ace::Remainder ( const double &  numerator,
const double &  denominator 
)
static

Calculates the Computes The IEEE remainder of the floating point division operation numerator/denominator.

In contrast to Mod(); the returned value is not guaranteed to have the same sign as the numerator. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/5/2016
try
{
double result = Ace::Remainder(-5.1, 3.2);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:1.300000

Parameters
numeratorNumber to be divided.
denominatorNumber to divide the numerator by.
Returns
The IEEE remainder of the floating point division. If a mathematical error occurs or denominator equals 0, then an exception is thrown.

◆ Remainder() [2/4]

float Ace::Remainder ( const float &  numerator,
const float &  denominator 
)
static

Calculates the Computes The IEEE remainder of the floating point division operation numerator/denominator.

In contrast to Mod(); the returned value is not guaranteed to have the same sign as the numerator. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float result = Ace::Remainder(-5.1f, 3.2f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:1.300000

Parameters
numeratorNumber to be divided.
denominatorNumber to divide the numerator by.
Returns
The IEEE remainder of the floating point division. If a mathematical error occurs or denominator equals 0, then an exception is thrown.

◆ Remainder() [3/4]

int Ace::Remainder ( const int &  numerator,
const int &  denominator 
)
static

Calculates the Computes The IEEE remainder of the floating point division operation numerator/denominator.

In contrast to Mod(); the returned value is not guaranteed to have the same sign as the numerator. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
int result = Ace::Remainder(-5, 3);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:1

Parameters
numeratorNumber to be divided.
denominatorNumber to divide the numerator by.
Returns
The IEEE remainder of the floating point division. If a mathematical error occurs or denominator equals 0, then an exception is thrown.

◆ Remainder() [4/4]

long Ace::Remainder ( const long &  numerator,
const long &  denominator 
)
static

Calculates the Computes The IEEE remainder of the floating point division operation numerator/denominator.

In contrast to Mod(); the returned value is not guaranteed to have the same sign as the numerator. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::Remainder((long)-5, (long)3);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:1

Parameters
numeratorNumber to be divided.
denominatorNumber to divide the numerator by.
Returns
The IEEE remainder of the floating point division. If a mathematical error occurs or denominator equals 0, then an exception is thrown.

◆ RemainderWithQuotient() [1/4]

double Ace::RemainderWithQuotient ( const double &  numerator,
const double &  denominator,
int *  outQuotient 
)
static

Calculates the floating-point remainder of the division operation numerator/denominator the same way the Remainder() function does.

Additionally, the sign and at least the three of the last bits of numerator/denominator will be stored in outQuotient, sufficient to determine the quotient of the result within a period. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/5/2016
int quotient;
double result = Ace::RemainderWithQuotient(-5.1, 3.2, &quotient);
quotient = (unsigned int)quotient % 4;
printf("%f Quotient:%d\n", result, quotient);
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

Output:1.300000 Quotient:2

Parameters
numeratorNumber to be divided.
denominatorNumber to divide the numerator by.
outQuotientSign to indicate the quotient.
Returns
The IEEE remainder of the floating point division and the quotient data. If a mathematical error occurs or denominator equals 0, then an exception is thrown.

◆ RemainderWithQuotient() [2/4]

float Ace::RemainderWithQuotient ( const float &  numerator,
const float &  denominator,
int *  outQuotient 
)
static

Calculates the floating-point remainder of the division operation numerator/denominator the same way the Remainder() function does.

Additionally, the sign and at least the three of the last bits of numerator/denominator will be stored in outQuotient, sufficient to determine the Quotient of the result within a period. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
int quotient;
float result = Ace::RemainderWithQuotient(-5.1f, 3.2f, &quotient);
quotient = (unsigned int)quotient % 4;
printf("%f Quotient:%d\n", result, quotient);

Output:1.300000 Quotient:2

Parameters
numeratorNumber to be divided.
denominatorNumber to divide the numerator by.
outQuotientSign to indicate the quotient.
Returns
The IEEE remainder of the floating point division and the quotient data. If a mathematical error occurs or denominator equals 0, then an exception is thrown.

◆ RemainderWithQuotient() [3/4]

int Ace::RemainderWithQuotient ( const int &  numerator,
const int &  denominator,
int *  outQuotient 
)
static

Calculates the floating-point remainder of the division operation numerator/denominator the same way the Remainder() function does.

Additionally, the sign and at least the three of the last bits of numerator/denominator will be stored in outQuotient, sufficient to determine the quotient of the result within a period. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
int quotient;
int result = Ace::RemainderWithQuotient(-5, 3, &quotient);
quotient = (unsigned int)quotient % 4;
printf("%d Quotient:%d\n", result, quotient);

Output:1 Quotient:2

Parameters
numeratorNumber to be divided.
denominatorNumber to divide the numerator by.
outQuotientSign to indicate the quotient.
Returns
The IEEE remainder of the floating point division and the quotient data. If a mathematical error occurs or denominator equals 0, then an exception is thrown.

◆ RemainderWithQuotient() [4/4]

long Ace::RemainderWithQuotient ( const long &  numerator,
const long &  denominator,
int *  outQuotient 
)
static

Calculates the floating-point remainder of the division operation numerator/denominator the same way the Remainder() function does.

Additionally, the sign and at least the three of the last bits of numerator/denominator will be stored in outQuotient, sufficient to determine the quotient of the result within a period. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
int quotient;
long result = Ace::RemainderWithQuotient((long)-5, (long)3, &quotient);
quotient = (unsigned int)quotient % 4;
printf("%ld Quotient:%lu\n", result, quotient);

Output:1 Quotient:2

Parameters
numeratorNumber to be divided.
denominatorNumber to divide the numerator by.
outQuotientSign to indicate the quotient.
Returns
The IEEE remainder of the floating point division and the quotient data. If a mathematical error occurs or denominator equals 0, then an exception is thrown.

◆ RemoveAllWhitespace() [1/2]

char * Ace::RemoveAllWhitespace ( const char *  str)
static

Removes all whitespace from a given string.

A newly allocated string is returned that has all whitespace removed from it.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* str = Ace::RemoveAllWhitespace("E dd\t i e ");
printf("%s\n", str);
_aligned_free(str);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char * RemoveAllWhitespace(const char *str)
Removes all whitespace from a given string.
Definition: Ace.cpp:17762

Output:Eddie

Parameters
[in]strThe string to remove whitespace from.
Returns
A newly created string containing no whitespace. Throws an exception if str is NULL.

◆ RemoveAllWhitespace() [2/2]

wchar_t * Ace::RemoveAllWhitespace ( const wchar_t *  str)
static

Removes all whitespace from a given wide string.

A newly allocated string is returned that has all whitespace removed from it.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
wchar_t* str = Ace::RemoveAllWhitespace(L"|あ  a い i う え бя лд かь お yo ¥\t |");
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%ls\n", str);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
_aligned_free(str);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:|あaいiうえбялдかьおyo¥|

Parameters
[in]strThe string to remove whitespace from.
Returns
A newly created string containing no whitespace. Throws an exception if str is NULL.

◆ RemoveAllWhitespaceInPlace() [1/2]

void Ace::RemoveAllWhitespaceInPlace ( char *  str)
static

Removes all whitespace from a given string in place.

This means That str is modified directly and as a result, no return value is needed. Assumes str is an allocated string and not a string literal.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* temp = Ace::AllocateAndCopyString("E dd\t i e ");
printf("%s\n", temp);
_aligned_free(temp);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static void RemoveAllWhitespaceInPlace(char *str)
Removes all whitespace from a given string in place.
Definition: Ace.cpp:17896

Output:Eddie

Parameters
[in,out]strThe string to directly modify and delete whitespace from. Throws an exception if str is NULL.

◆ RemoveAllWhitespaceInPlace() [2/2]

void Ace::RemoveAllWhitespaceInPlace ( wchar_t *  str)
static

Removes all whitespace from a given wide string in place.

This means That str is modified directly and as a result, no return value is needed. Assumes str is an allocated string and not a string literal.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
wchar_t* str = Ace::AllocateAndCopyString(L"|あ  a い i う え бя лд かь お yo ¥\t |");
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%ls\n", str);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
_aligned_free(str);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:|あaいiうえбялдかьおyo¥|

Parameters
[in,out]strThe wide string to directly modify and delete whitespace from. Throws an exception if str is NULL.

◆ RemoveCharactersFromString() [1/2]

char * Ace::RemoveCharactersFromString ( const char *  strToRemoveFrom,
const char &  charToRemove 
)
static

Removes any occurrence of charToRemove from strToRemoveFrom.

Author
Eddie O'Hagan
Date
6/12/2016
try
{
const char* data = "Has anyone ever been as far as decided to be there and then look more like?";
char* removedCharData = Ace::RemoveCharactersFromString(data, 'a');
printf("%s\n", removedCharData);
_aligned_free(removedCharData);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char * RemoveCharactersFromString(const char *strToRemoveFrom, const char &charToRemove)
Removes any occurrence of charToRemove from strToRemoveFrom.
Definition: Ace.cpp:18017

Output:Hs nyone ever been s fr s decided to be there nd then look more like?

Parameters
[in,out]strToRemoveFromIf non-null, to remove from.
charToRemoveThe character to remove.
Returns
A newly created string with every occurrence of charToRemove removed. Throws an exception if strToRemoveFrom is NULL.

◆ RemoveCharactersFromString() [2/2]

wchar_t * Ace::RemoveCharactersFromString ( const wchar_t *  strToRemoveFrom,
const wchar_t &  charToRemove 
)
static

Removes any occurrence of charToRemove from strToRemoveFrom.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
const wchar_t* data = L"誰かがそこにいることを決心し、それからもっと似ているように見えることはありますか?";
wchar_t* removedCharData = Ace::RemoveCharactersFromString(data, L'か');
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%ls\n", removedCharData);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
_aligned_free(removedCharData);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:誰がそこにいることを決心し、それらもっと似ているように見えることはあります?

Parameters
[in,out]strToRemoveFromIf non-null, to remove from.
charToRemoveThe character to remove.
Returns
A newly created string with every occurrence of charToRemove removed. Throws an exception if strToRemoveFrom is NULL.

◆ RemoveCharactersFromStringInPlace() [1/2]

void Ace::RemoveCharactersFromStringInPlace ( char *  strToRemoveFrom,
const char &  charToRemove 
)
static

Removes any occurrence of charToRemove from strToRemoveFrom.

strToRemoveFrom must be an allocated string since this function works directly on it.

Author
Eddie O'Hagan
Date
6/12/2016
try
{
char* removedCharData = Ace::AllocateAndCopyString("Has anyone ever been as far as decided to be there and then look more like?");
printf("%s", removedCharData);
_aligned_free(removedCharData);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static void RemoveCharactersFromStringInPlace(char *strToRemoveFrom, const char &charToRemove)
Removes any occurrence of charToRemove from strToRemoveFrom.
Definition: Ace.cpp:18153

Output:Hs nyone ever been s fr s decided to be there nd then look more like?

Parameters
[in,out]strToRemoveFromIf non-null, to remove from.
charToRemoveThe character to remove.
Returns
Throws an exception if strToRemoveFrom is NULL.

◆ RemoveCharactersFromStringInPlace() [2/2]

void Ace::RemoveCharactersFromStringInPlace ( wchar_t *  strToRemoveFrom,
const wchar_t &  charToRemove 
)
static

Removes any occurrence of charToRemove from strToRemoveFrom.

strToRemoveFrom must be an allocated string since this function works directly on it.

Author
Eddie O'Hagan
Date
9/7/2016
try
{
wchar_t* data = Ace::AllocateAndCopyString(L"誰かがそこにいることを決心し、それからもっと似ているように見えることはありますか?");
wchar_t* removedCharData = Ace::RemoveCharactersFromStringInPlace(data, L'か');
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%ls\n", removedCharData);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
_aligned_free(removedCharData);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:誰がそこにいることを決心し、それらもっと似ているように見えることはあります?

Parameters
[in,out]strToRemoveFromIf non-null, to remove from.
charToRemoveThe character to remove.
Returns
Throws an exception if strToRemoveFrom is NULL.

◆ RemoveStringFromString() [1/2]

char * Ace::RemoveStringFromString ( const char *  strToRemoveFrom,
const char *  strToRemove,
const bool &  removeOnlyFirstOccurrence = false 
)
static

Removes the specified string (strToLookFor) from strToSearch and returns a newly allocated buffer containing the result.

Author
Eddie O'Hagan
Date
11/2/2016
try
{
char* retVal = Ace::RemoveStringFromString("Eddie has a small small dick.", "small ");
printf("%s\n", retVal);
_aligned_free(retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:Eddie has a dick.

Parameters
[in,out]strToSearchThe string to directly parse and modify.
[in]strToLookForThe substring to look for.
removeOnlyFirstOccurrenceTrue if only the first occurrence of strToLookFor should be removed.
Returns
Throws an exception if an error occurs.

◆ RemoveStringFromString() [2/2]

wchar_t * Ace::RemoveStringFromString ( const wchar_t *  strToRemoveFrom,
const wchar_t *  strToRemove,
const bool &  removeOnlyFirstOccurrence = false 
)
static

Removes the specified string (strToLookFor) from strToSearch and returns a newly allocated buffer containing the result.

Author
Eddie O'Hagan
Date
11/2/2016
try
{
wchar_t* retVal = Ace::RemoveStringFromString(L"Eddie has a small small dick.", L"small ");
printf("%ls\n", retVal);
_aligned_free(retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Eddie has a dick.

Parameters
[in,out]strToSearchThe string to directly parse and modify.
[in]strToLookForThe substring to look for.
removeOnlyFirstOccurrenceTrue if only the first occurrence of strToLookFor should be removed.
Returns
Throws an exception if an error occurs.

◆ RemoveStringFromStringInPlace() [1/2]

void Ace::RemoveStringFromStringInPlace ( char *  strToSearch,
const char *  strToLookFor,
const bool &  removeOnlyFirstOccurrence = false 
)
static

Removes the specified string (strToLookFor) by directly modifying strToSearch.

Author
Eddie O'Hagan
Date
4/4/2022
try
{
char* buffer = Ace::AllocateAndCopyString("small Eddie has a small small dick.small ");
printf("%s\n", buffer);
_aligned_free(buffer);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:Eddie has a dick.

Parameters
[in,out]strToSearchThe string to directly parse and modify.
[in]strToLookForThe substring to look for.
removeOnlyFirstOccurrenceTrue if only the first occurrence of strToLookFor should be removed.
Returns
Throws an exception if an error occurs.

◆ RemoveStringFromStringInPlace() [2/2]

void Ace::RemoveStringFromStringInPlace ( wchar_t *  strToSearch,
const wchar_t *  strToLookFor,
const bool &  removeOnlyFirstOccurrence = false 
)
static

Removes the specified string (strToLookFor) by directly modifying strToSearch.

Author
Eddie O'Hagan
Date
4/4/2022
try
{
wchar_t* buffer;
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
buffer = (wchar_t*)Ace::AllocateAndCopyString(L"小さ エディ は 小さ 小さ な ペニス を 持っています。小さ ");
Ace::RemoveStringFromStringInPlace(buffer, L"小さ ");
wprintf(L"%ls\n", buffer);
_aligned_free(buffer);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:エディ は な ペニス を 持っています。

Parameters
[in,out]strToSearchThe string to directly parse and modify.
[in]strToLookForThe substring to look for.
removeOnlyFirstOccurrenceTrue if only the first occurrence of strToLookFor should be removed.
Returns
Throws an exception if an error occurs.

◆ ReplaceString() [1/4]

bool Ace::ReplaceString ( char *  destination,
const int &  destinationLength,
const char *  strToSearch,
const char *  strToLookFor,
const char *  strToReplaceWith,
const bool &  removeOnlyFirstOccurrence = false 
)
static

Attempts to remove the provided strToLookFor and replace it with the provided strToReplaceWith inside of the whole strToSearch.

The resulting string is then stored in the destination buffer.

Author
Eddie O'Hagan
Date
4/9/2022
try
{
char destinationBuffer[41] = { '\0' };
if (Ace::ReplaceString(destinationBuffer, 41, "|is Eddie is cool. is|", "is", "NOT COOL") == true)
{
printf("%s\n", destinationBuffer);
}
else
{
printf("%s\n", "Failed to replace string.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:|NOT COOL Eddie NOT COOL cool. NOT COOL|

Parameters
[out]destinationThe destination buffer to hold the resulting string.
[in]destinationLengthThe length in characters of the destination buffer.
[in]strToSearchThe string to directly parse and modify.
[in]strToLookForThe substring to look for.
[in]strToReplaceWithThe substring to replace with.
removeOnlyFirstOccurrenceTrue if only the first occurrence of strToLookFor should be removed.
Returns
true on success, false otherwise. Throws an exception if an error occurs.

◆ ReplaceString() [2/4]

char * Ace::ReplaceString ( const char *  strToSearch,
const char *  strToLookFor,
const char *  strToReplaceWith,
const bool &  removeOnlyFirstOccurrence = false 
)
static

Inserts strToReplaceWith in the position strToLookFor is located, then strToLookFor is removed.

A newly allocated string is then returned.

Author
Eddie O'Hagan
Date
4/9/2022
try
{
char* destinationBuffer = Ace::ReplaceString("|is Eddie is cool. is|", "is", "NOT COOL");
if (destinationBuffer != NULL)
{
printf("%s\n", destinationBuffer);
}
else
{
printf("%s\n", "Failed to replace string.");
}
_aligned_free(destinationBuffer);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:|NOT COOL Eddie NOT COOL cool. NOT COOL|

Parameters
[in]strToSearchThe string to look through.
[in]strToLookForThe substring to look for.
[in]strToReplaceWithThe substring to replace with.
removeOnlyFirstOccurrenceTrue if only the first occurrence of strToLookFor should be removed.
Returns
A newly created string with the change. Throws an exception if strToSearch or strToLookFor are NULL.

◆ ReplaceString() [3/4]

wchar_t * Ace::ReplaceString ( const wchar_t *  strToSearch,
const wchar_t *  strToLookFor,
const wchar_t *  strToReplaceWith,
const bool &  removeOnlyFirstOccurrence = false 
)
static

Inserts strToReplaceWith in the position strToLookFor is located, then strToLookFor is removed.

A newly allocated wide string is then returned.

Author
Eddie O'Hagan
Date
4/9/2022
try
{
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wchar_t* destinationBuffer = Ace::ReplaceString(L"|はい エディ はい かっこいいです 。はい|", L"はい", L"ありません");
if (destinationBuffer != NULL)
{
wprintf(L"%ls\n", destinationBuffer);
}
else
{
printf("%s\n", "Failed to replace string.");
}
_aligned_free(destinationBuffer);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:|ありません エディ ありません かっこいいです 。ありません|

Parameters
[in]strToSearchThe wide string to look through.
[in]strToLookForThe substring to look for.
[in]strToReplaceWithThe substring to replace with.
removeOnlyFirstOccurrenceTrue if only the first occurrence of strToLookFor should be removed.
Returns
A newly created wide string with the change. Throws an exception if strToSearch or strToLookFor are NULL.

◆ ReplaceString() [4/4]

bool Ace::ReplaceString ( wchar_t *  destination,
const int &  destinationLength,
const wchar_t *  strToSearch,
const wchar_t *  strToLookFor,
const wchar_t *  strToReplaceWith,
const bool &  removeOnlyFirstOccurrence = false 
)
static

Attempts to remove the provided strToLookFor and replace it with the provided strToReplaceWith inside of the whole strToSearch.

The resulting string is then stored in the destination buffer.

Author
Eddie O'Hagan
Date
4/9/2022
try
{
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wchar_t dest[33] = { '\0' };
if (Ace::ReplaceString(dest, 33, L"|はい エディ はい かっこいいです 。はい|", L"はい", L"ありません") == true)
{
wprintf(L"%ls\n", dest);
}
else
{
printf("%s\n", "Failed to replace string.");
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:|ありません エディ ありません かっこいいです 。ありません|

Parameters
[out]destinationThe destination buffer to hold the resulting string.
[in]strToSearchThe string to directly parse and modify.
[in]strToLookForThe substring to look for.
[in]strToReplaceWithThe substring to replace with.
removeOnlyFirstOccurrenceTrue if only the first occurrence of strToLookFor should be removed.
Returns
true on success, false otherwise. Throws an exception if an error occurs.

◆ RetrieveDataBetweenTags() [1/8]

bool Ace::RetrieveDataBetweenTags ( char *  destination,
const char *  fileData,
const char *  startTag,
const char *  endTag 
)
static

Finds the XML data between the startTag and endTag and returns it.

Author
Eddie O'Hagan
Date
4/15/2022
try
{
char tagData[14] = { '\0' };
char data[217];
if (Ace::ReadTextFile(data, "C://Config.xml", 0, 217) == true)
{
if (Ace::RetrieveDataBetweenTags(tagData, data, "<position>", "</position>") == true)
{
printf("Data between tags:%s\n", tagData);
}
else
{
printf("%s\n", "Failed to retrieve data between tags.");
}
}
else
{
printf("%s\n", "Failed to read text file.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:Data between tags:0.1, 2.3, 2.2

Parameters
[in]destinationA buffer to contain the retrieved data.
[in]fileDataA string containing the data to be parsed.
[in]startTagA string representing the tag to start from.
[in]endTagA string representing the tag to end on.
Returns
true if the retrieval was successful, false otherwise. Throws an exception if error occurs.

◆ RetrieveDataBetweenTags() [2/8]

bool Ace::RetrieveDataBetweenTags ( char *  destination,
const char *  fileData,
const int &  startTagIndex,
const int &  endTagIndex 
)
static

Finds the XML data between the startTagIndex and endTagIndex and returns it.

Author
Eddie O'Hagan
Date
4/15/2022
try
{
int startIndex;
int endIndex;
char tagData[14] = { '\0' };
char data[217];
if (Ace::ReadTextFile(data, "C://Config.xml", 0, 217) == true)
{
startIndex = Ace::IndexOf(data, "<position>") + strlen("<position>");
endIndex = Ace::IndexOf(data, "</position>");
if (Ace::RetrieveDataBetweenTags(tagData, data, startIndex, endIndex) == true)
{
printf("Data between tags:%s\n", tagData);
}
else
{
printf("%s\n", "Failed to retrieve data between tags.");
}
}
else
{
printf("%s\n", "Failed to read text file.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Data between tags:0.1, 2.3, 2.2

Parameters
[in]destinationA buffer to contain the retrieved data.
[in]fileDataA string containing the data to be parsed.
[in]startTagIndexIndex of where to start reading in.
[in]endTagIndexIndex of where to end reading data.
Returns
true if the retrieval was successfull, false otherwise. Throws an exception if error occurs.

◆ RetrieveDataBetweenTags() [3/8]

char * Ace::RetrieveDataBetweenTags ( const char *  fileData,
const char *  startTag,
const char *  endTag 
)
static

Finds the XML data between the startTag and endTag and returns it.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* data = Ace::ReadTextFile("C:\\Config.xml");
char* tagData = Ace::RetrieveDataBetweenTags(data, "<position>", "</position>");
printf("Data between tags:%s\n", tagData);
_aligned_free(tagData);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Data between tags:0.1, 2.3, 2.2

Parameters
[in]fileDataA string containing the data to be parsed.
[in]startTagA string representing the tag to start from.
[in]endTagA string representing the tag to end on.
Returns
A Buffer containing the data between startTag + startTag.length() and endTag. Throws an exception if error occurs.

◆ RetrieveDataBetweenTags() [4/8]

char * Ace::RetrieveDataBetweenTags ( const char *  fileData,
const int &  startTagIndex,
const int &  endTagIndex 
)
static

Finds the XML data between the startTagIndex and endTagIndex and returns it.

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* data = Ace::ReadTextFile("C://Config.xml");
int startIndex = Ace::IndexOf(data, "<position>") + strlen("<position>");
int endIndex = Ace::IndexOf(data, "</position>");
char* tagData = Ace::RetrieveDataBetweenTags(data, startIndex, endIndex);
printf("Data between tags:%s\n", tagData);
_aligned_free(tagData);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Data between tags:0.1, 2.3, 2.2

Parameters
[in]fileDataA string containing the data to be parsed.
[in]startTagIndexIndex of where to start reading in.
[in]endTagIndexIndex of where to end reading data.
Returns
A Buffer containing the data between startTagIndex and endTagIndex. Throws an exception if error occurs.

◆ RetrieveDataBetweenTags() [5/8]

wchar_t * Ace::RetrieveDataBetweenTags ( const wchar_t *  fileData,
const int &  startTagIndex,
const int &  endTagIndex 
)
static

Finds the XML data between the startTagIndex and endTagIndex and returns it.

Author
Eddie O'Hagan
Date
9/8/2016
try
{
wchar_t* data = Ace::ReadTextFileW(L"C://配置.xml");
int startIndex = Ace::IndexOf(data, L"<立場>") + wcslen(L"<立場>");
int endIndex = Ace::IndexOf(data, L"</立場>");
wchar_t* tagData = Ace::RetrieveDataBetweenTags(data, startIndex, endIndex);
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"タグ間のデータ:%ls\n", tagData);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
_aligned_free(tagData);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:タグ間のデータ:0.1, 2.3, 2.2

Parameters
[in]fileDataA wide string containing the data to be parsed.
[in]startTagIndexIndex of where to start reading in.
[in]endTagIndexIndex of where to end reading data.
Returns
A Buffer containing the data between startTagIndex and endTagIndex. Throws an exception if error occurs.

◆ RetrieveDataBetweenTags() [6/8]

wchar_t * Ace::RetrieveDataBetweenTags ( const wchar_t *  fileData,
const wchar_t *  startTag,
const wchar_t *  endTag 
)
static

Finds the XML data between the startTag and endTag and returns it.

Author
Eddie O'Hagan
Date
9/8/2016
try
{
wchar_t* data = Ace::ReadTextFileW(L"C:\\配置.xml");
wchar_t* tagData = Ace::RetrieveDataBetweenTags(data, L"<立場>", L"</立場>");
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"タグ間のデータ:%ls\n", tagData);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
_aligned_free(tagData);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:タグ間のデータ:0.1, 2.3, 2.2

Parameters
[in]fileDataA string containing the data to be parsed.
[in]startTagA string representing the tag to start from.
[in]endTagA string representing the tag to end on.
Returns
A Buffer containing the data between startTag + startTag.length() and endTag. Throws an exception if error occurs.

◆ RetrieveDataBetweenTags() [7/8]

bool Ace::RetrieveDataBetweenTags ( wchar_t *  destination,
const wchar_t *  fileData,
const int &  startTagIndex,
const int &  endTagIndex 
)
static

Finds the XML data between the startTagIndex and endTagIndex and returns it.

Author
Eddie O'Hagan
Date
4/15/2022
try
{
int startIndex;
int endIndex;
wchar_t tagData[28] = { L'\0' };
wchar_t data[870];
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
if (Ace::ReadTextFileW(data, L"C:\\配置.xml", 0, 870) == true)
{
startIndex = Ace::IndexOf(data, L"<立場>") + wcslen(L"<立場>");
endIndex = Ace::IndexOf(data, L"</立場>");
if (Ace::RetrieveDataBetweenTags(tagData, data, startIndex, endIndex) == true)
{
wprintf(L"タグ間のデータ:%ls\n", tagData);
}
else
{
printf("%s\n", "Error: Failed to retrieve data between tags.");
}
}
else
{
printf("%s\n", "Error: Failed to read text file.");
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:タグ間のデータ:0.1, 2.3, 2.2

Parameters
[in]destinationA buffer to contain the retrieved data.
[in]fileDataA string containing the data to be parsed.
[in]startTagIndexIndex of where to start reading in.
[in]endTagIndexIndex of where to end reading data.
Returns
true if the retrieval was successfull, false otherwise. Throws an exception if error occurs.

◆ RetrieveDataBetweenTags() [8/8]

bool Ace::RetrieveDataBetweenTags ( wchar_t *  destination,
const wchar_t *  fileData,
const wchar_t *  startTag,
const wchar_t *  endTag 
)
static

Finds the XML data between the startTag and endTag and returns it.

Author
Eddie O'Hagan
Date
4/15/2022
try
{
wchar_t tagData[28] = { L'\0' };
wchar_t data[870];
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
if (Ace::ReadTextFileW(data, L"C:\\配置.xml", 0, 870) == true)
{
if (Ace::RetrieveDataBetweenTags(tagData, data, L"<立場>", L"</立場>") == true)
{
wprintf(L"タグ間のデータ:%ls\n", tagData);
}
else
{
printf("%s\n", "Error: Failed to retrieve data between tags.");
}
}
else
{
printf("%s\n", "Error: Failed to read text file.");
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:タグ間のデータ:0.1, 2.3, 2.2

Parameters
[in]destinationA buffer to contain the retrieved data.
[in]fileDataA string containing the data to be parsed.
[in]startTagA string representing the tag to start from.
[in]endTagA string representing the tag to end on.
Returns
true if the retrieval was successful, false otherwise. Throws an exception if error occurs.

◆ RetrieveDataChunksBetweenTags() [1/4]

bool Ace::RetrieveDataChunksBetweenTags ( char **  destination,
const char *  fileData,
const char *  startTag,
const char *  endTag 
)
static

Finds a series of XML data between startTag and endTag.

For example, if we were reading in an XML file that looked like this: <Models> <Model> <position>0.1, 2.3, 2.2</position> <rotation>20.0, 0.0, 0.0, 1.0</rotation> </Model> <Model> <position>3.0, 4.0, 5.0</position> <rotation>0.0, 30.0, 0.0, 1.0</rotation> </Model> </Models>

And the start and end tags were "<Model>" and "</Model>" respectively; then the function will return an array containing: Array[0]="<position>0.1, 2.3, 2.2</position> <rotation>20.0, 0.0, 0.0, 1.0</rotation>"

Array[1]="<position>3.0, 4.0, 5.0</position> <rotation>0.0, 30.0, 0.0, 1.0</rotation>"

Author
Eddie O'Hagan
Date
4/23/2022
try
{
const int numChunks = 2;
const int chunkLength = 83;
int destinationIndex;
char* destination[numChunks];
char data[217];
for (destinationIndex = 0; destinationIndex < numChunks; destinationIndex++)
{
destination[destinationIndex] = (char*)Ace::_Aligned_Calloc(chunkLength * sizeof(char));
}
if (Ace::ReadTextFile(data, "C://Config.xml", 0, 217) == true)
{
if (Ace::RetrieveDataChunksBetweenTags(destination, data, "<Model>", "</Model>") == true)
{
for (destinationIndex = 0; destinationIndex < numChunks; destinationIndex++)
{
printf("Array[%d]:%s\n", destinationIndex, destination[destinationIndex]);
_aligned_free(destination[destinationIndex]);
}
}
else
{
printf("%s\n", "Error: Failed to retrieve data chunks between tags.");
}
}
else
{
printf("%s\n", "Error: Failed to read config file.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:Array[0]=<position>0.1, 2.3, 2.2</position> <rotation>20.0, 0.0, 0.0, 1.0</rotation>

Array[1]=<position>3.0, 4.0, 5.0</position> <rotation>0.0, 30.0, 0.0, 1.0</rotation>

Parameters
[in]destinationThe string array to contain all of the strings.
[in]fileDataA string containing the data to be parsed.
[in]startTagA string representing the tag to start from.
[in]endTagA string representing the tag to end on.
Returns
true if successful, false otherwise. Throws an exception if error occurs.

◆ RetrieveDataChunksBetweenTags() [2/4]

char ** Ace::RetrieveDataChunksBetweenTags ( const char *  fileData,
const char *  startTag,
const char *  endTag,
int &  outFinalBufferSize 
)
static

Finds a series of XML data between startTag and endTag.

For example, if we were reading in an XML file that looked like this: <Models> <Model> <position>0.1, 2.3, 2.2</position> <rotation>20.0, 0.0, 0.0, 1.0</rotation> </Model> <Model> <position>3.0, 4.0, 5.0</position> <rotation>0.0, 30.0, 0.0, 1.0</rotation> </Model> </Models>

And the start and end tags were "<Model>" and "</Model>" respectively; then the function will return an array containing: Array[0]="<position>0.1, 2.3, 2.2</position> <rotation>20.0, 0.0, 0.0, 1.0</rotation>"

Array[1]="<position>3.0, 4.0, 5.0</position> <rotation>0.0, 30.0, 0.0, 1.0</rotation>"

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* data = Ace::ReadTextFile("C://Config.xml");
int tagDataSize = 0;
char** tagData = Ace::RetrieveDataChunksBetweenTags(data, "<Model>", "</Model>", tagDataSize);
for (int currIndex = 0; currIndex < tagDataSize; currIndex++)
{
printf("Array[%d]:%s\n", currIndex, tagData[currIndex]);
_aligned_free(tagData[currIndex]);
}
_aligned_free(tagData);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Array[0]=<position>0.1, 2.3, 2.2</position> <rotation>20.0, 0.0, 0.0, 1.0</rotation>

Array[1]=<position>3.0, 4.0, 5.0</position> <rotation>0.0, 30.0, 0.0, 1.0</rotation>

Parameters
[in]fileDataA string containing the data to be parsed.
[in]startTagA string representing the tag to start from.
[in]endTagA string representing the tag to end on.
[out]outFinalBufferSizeSize of the out final buffer.
Returns
A newly allocated string array containing the data between each startTag and endTag found. Throws an exception if error occurs.

◆ RetrieveDataChunksBetweenTags() [3/4]

wchar_t ** Ace::RetrieveDataChunksBetweenTags ( const wchar_t *  fileData,
const wchar_t *  startTag,
const wchar_t *  endTag,
int &  outFinalBufferSize 
)
static

Finds a series of XML data between startTag and endTag.

For example, if we were reading in an XML file that looked like this: <モデルス> <モデル> <立場>0.1, 2.3, 2.2</> <回転>20.0, 0.0, 0.0, 1.0</> </> <モデル> <立場>3.0, 4.0, 5.0</> <回転>0.0, 30.0, 0.0, 1.0</> </> </>

And the start and end tags were "<Model>" and "</Model>" respectively; then the function will return an array containing: アレイ[0]: <立場>0.1, 2.3, 2.2</> <回転>20.0, 0.0, 0.0, 1.0</>

アレイ[1]: <立場>3.0, 4.0, 5.0</> <回転>0.0, 30.0, 0.0, 1.0</>

Author
Eddie O'Hagan
Date
9/8/2016
try
{
wchar_t* data = Ace::ReadTextFileW(L"C://配置.xml");
int tagDataSize = 0;
wchar_t** tagData = Ace::RetrieveDataChunksBetweenTags(data, L"<モデル>", L"</モデル>", tagDataSize);
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
for (int currIndex = 0; currIndex < tagDataSize; currIndex++)
{
wprintf(L"アレイ[%d]:%ls\n", currIndex, tagData[currIndex]);
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
for (int currIndex = 0; currIndex < tagDataSize; currIndex++)
{
_aligned_free(tagData[currIndex]);
}
_aligned_free(tagData);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:アレイ[0]: <立場>0.1, 2.3, 2.2</> <回転>20.0, 0.0, 0.0, 1.0</>

アレイ[1]: <立場>3.0, 4.0, 5.0</> <回転>0.0, 30.0, 0.0, 1.0</>

Parameters
[in]fileDataA wide string containing the data to be parsed.
[in]startTagA wide string representing the tag to start from.
[in]endTagA wide string representing the tag to end on.
[out]outFinalBufferSizeSize of the out final buffer.
Returns
A newly allocated wide string array containing the data between each startTag and endTag found. Throws an exception if error occurs.

◆ RetrieveDataChunksBetweenTags() [4/4]

bool Ace::RetrieveDataChunksBetweenTags ( wchar_t **  destination,
const wchar_t *  fileData,
const wchar_t *  startTag,
const wchar_t *  endTag 
)
static

Finds a series of XML data between startTag and endTag.

For example, if we were reading in an XML file that looked like this: <モデルス> <モデル> <立場>0.1, 2.3, 2.2</> <回転>20.0, 0.0, 0.0, 1.0</> </> <モデル> <立場>3.0, 4.0, 5.0</> <回転>0.0, 30.0, 0.0, 1.0</> </> </>

And the start and end tags were "<Model>" and "</Model>" respectively; then the function will return an array containing: アレイ[0]: <立場>0.1, 2.3, 2.2</> <回転>20.0, 0.0, 0.0, 1.0</>

アレイ[1]: <立場>3.0, 4.0, 5.0</> <回転>0.0, 30.0, 0.0, 1.0</>

Author
Eddie O'Hagan
Date
4/23/2022
try
{
const int numChunks = 2;
const int chunkLength = 59;
int destinationIndex;
wchar_t* destination[numChunks];
wchar_t data[870];
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
for (destinationIndex = 0; destinationIndex < numChunks; destinationIndex++)
{
destination[destinationIndex] = (wchar_t*)Ace::_Aligned_Calloc(chunkLength * sizeof(wchar_t));
}
if (Ace::ReadTextFileW(data, L"C://配置.xml", 0, 870) == true)
{
if (Ace::RetrieveDataChunksBetweenTags(destination, data, L"<モデル>", L"</モデル>") == true)
{
for (destinationIndex = 0; destinationIndex < numChunks; destinationIndex++)
{
wprintf(L"アレイ[%d]:%ls\n", destinationIndex, destination[destinationIndex]);
_aligned_free(destination[destinationIndex]);
}
}
else
{
printf("%s\n", "Error: Failed to retrieve data chunks between tags.");
}
}
else
{
printf("%s\n", "Error: Failed to read config file.");
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:アレイ[0]: <立場>0.1, 2.3, 2.2</> <回転>20.0, 0.0, 0.0, 1.0</>

アレイ[1]: <立場>3.0, 4.0, 5.0</> <回転>0.0, 30.0, 0.0, 1.0</>

Parameters
[in]destinationThe string array to contain all of the strings.
[in]fileDataA wide string containing the data to be parsed.
[in]startTagA wide string representing the tag to start from.
[in]endTagA wide string representing the tag to end on.
Returns
true if successful, false otherwise. Throws an exception if error occurs.

◆ RetrieveFileNames() [1/4]

vector< char * > Ace::RetrieveFileNames ( const char *  fullFilePath)
static

Returns all the names of the files inside a folder, Ignores non files like folders.

Author
Eddie O'Hagan
Date
7/9/2016
try
{
const char* imageFilePath = "C:\\Images\\180Panoramic";
vector<char*> fileNames = Ace::RetrieveFileNames(imageFilePath);
for (size_t i = 0; i < fileNames.size(); i++)
{
printf("%s\n", fileNames[i]);
_aligned_free(fileNames[i]);
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:sky.jpg mountans.png dontread.txt

Parameters
[in]fullFilePathDirectory to look inside.
Returns
A vector array containing all the file names in the folder. Throws an exception if fullFilePath is NULL.

◆ RetrieveFileNames() [2/4]

vector< wchar_t * > Ace::RetrieveFileNames ( const wchar_t *  fullFilePath)
static

Returns all the names of the files inside a folder, Ignores non files like folders.

Author
Eddie O'Hagan
Date
9/8/2016
try
{
const wchar_t* imageFilePath = L"C:\\Images\\180Panoramic";
vector<wchar_t*> fileNames = Ace::RetrieveFileNames(imageFilePath);
for (size_t i = 0; i < fileNames.size(); i++)
{
printf("%ls\n", fileNames[i]);
_aligned_free(fileNames[i]);
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:sky.jpg mountans.png tits.gtfo dontread.txt

Parameters
[in]fullFilePathDirectory to look inside.
Returns
A vector array containing all the file names in the folder. Throws an exception if fullFilePath is NULL.

◆ RetrieveFileNames() [3/4]

bool Ace::RetrieveFileNames ( vector< WIN32_FIND_DATAA > &  destination,
const char *  fullFilePath 
)
static

Returns all the names of the files(s) in a folder.

Author
Eddie O'Hagan
Date
4/24/2022
try
{
vector<WIN32_FIND_DATAA> fileNames;
if (Ace::RetrieveFileNames(fileNames, "C:\\Images") == true)
{
for (int index = 0; index < fileNames.size(); index++)
{
printf("%s\n", fileNames[index].cFileName);
}
}
else
{
printf("%s\n", "Failed to retrieve file names.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:sky.jpg mountans.png tits.gtfo dontread.txt

Parameters
[in]destinationA vector array to contain all the files found.
[in]fullFilePathDirectory to look inside.
Returns
true if the process was a success, false otherwise. Throws an exception if fullFilePath is NULL.

◆ RetrieveFileNames() [4/4]

bool Ace::RetrieveFileNames ( vector< WIN32_FIND_DATAW > &  destination,
const wchar_t *  fullFilePath 
)
static

Returns all the names of the files(s) in a folder.

Author
Eddie O'Hagan
Date
4/24/2022
try
{
vector<WIN32_FIND_DATAW> fileNames;
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
if (Ace::RetrieveFileNames(fileNames, L"C:\\画像") == true)
{
for (size_t i = 0; i < fileNames.size(); i++)
{
wprintf(L"%ls\n", fileNames[i].cFileName);
}
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:さけ.bmp りんご.bmp バナナ.bmp

Parameters
[in]destinationA vector array to contain all the files found.
[in]fullFilePathDirectory to look inside.
Returns
true if the process was a success, false otherwise. Throws an exception if fullFilePath is NULL.

◆ RetrieveFolderNames() [1/4]

vector< char * > Ace::RetrieveFolderNames ( const char *  fullFilePath)
static

Returns all the names of the sub-folder(s) in a folder.

Author
Eddie O'Hagan
Date
6/1/2016
try
{
char* imageFilePath = "C:\\Images";
vector<char*> folderNames = Ace::RetrieveFolderNames(imageFilePath);
for (size_t i = 0; i < folderNames.size(); i++)
{
printf("%s\n", folderNames[i]);
_aligned_free(folderNames[i]);
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static vector< char * > RetrieveFolderNames(const char *fullFilePath)
Returns all the names of the sub-folder(s) in a folder.
Definition: Ace.cpp:20593

Output:180 panoramics 360 panoramics photospheres

Parameters
[in]fullFilePathDirectory to look inside.
Returns
A vector array containing all the sub-folder names in the folder. Throws an exception if fullFilePath is NULL.

◆ RetrieveFolderNames() [2/4]

vector< wchar_t * > Ace::RetrieveFolderNames ( const wchar_t *  fullFilePath)
static

Returns all the names of the sub-folder(s) in a folder.

Author
Eddie O'Hagan
Date
9/8/2016
try
{
const wchar_t* imageFilePath = L"C:\\画像";
vector<wchar_t*> folderNames = Ace::RetrieveFolderNames(imageFilePath);
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
for (size_t i = 0; i < folderNames.size(); i++)
{
wprintf(L"%ls\n", folderNames[i]);
_aligned_free(folderNames[i]);
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:お尻 りんご オレンジ

Parameters
[in]fullFilePathDirectory to look inside.
Returns
A vector array containing all the sub-folder names in the folder. Throws an exception if fullFilePath is NULL.

◆ RetrieveFolderNames() [3/4]

bool Ace::RetrieveFolderNames ( vector< WIN32_FIND_DATAA > &  destination,
const char *  fullFilePath 
)
static

Retrieves and stores all the names of the sub-folder(s) in a folder.

Author
Eddie O'Hagan
Date
4/25/2022
try
{
vector<WIN32_FIND_DATAA> folderNames;
if (Ace::RetrieveFolderNames(folderNames, "C:\\Pictures") == true)
{
for (int index = 0; index < folderNames.size(); index++)
{
printf("%s\n", folderNames[index].cFileName);
}
}
else
{
printf("%s\n", "Failed to retrieve folder names.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:180 panoramics 360 panoramics photospheres

Parameters
[in]destinationA vector array to store all the sub-folder names in the folder.
[in]fullFilePathDirectory to look inside.
Returns
true if the process was successful, false otherwise. Throws an exception if an error occurs.

◆ RetrieveFolderNames() [4/4]

bool Ace::RetrieveFolderNames ( vector< WIN32_FIND_DATAW > &  destination,
const wchar_t *  fullFilePath 
)
static

Retrieves and stores all the names of the sub-folder(s) in a folder.

Author
Eddie O'Hagan
Date
4/25/2022
try
{
vector<WIN32_FIND_DATAW> folderNames;
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
if (Ace::RetrieveFolderNames(folderNames, L"C:\\画像") == true)
{
for (size_t i = 0; i < folderNames.size(); i++)
{
wprintf(L"%ls\n", folderNames[i].cFileName);
}
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:お尻 りんご オレンジ

Parameters
[in]destinationA vector array to store all the sub-folder names in the folder.
[in]fullFilePathDirectory to look inside.
Returns
true if the process was successful, false otherwise. Throws an exception if an error occurs.

◆ ReverseString() [1/2]

char * Ace::ReverseString ( const char *  strToReverse)
static

Creates a new string containing all the characters from strToReverse in reverse order.

For example: "ABCDEF" will return "FEDCBA".

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* data = Ace::ReverseString("ABCDEF");
printf("%s\n", data);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static char * ReverseString(const char *strToReverse)
Creates a new string containing all the characters from strToReverse in reverse order.
Definition: Ace.cpp:21236

Output:FEDCBA

Parameters
[in]strToReverseA string to reverse.
Returns
A newly created string containing the reverse of strToReverse. Throws an exception if strToReverse is NULL.

◆ ReverseString() [2/2]

wchar_t * Ace::ReverseString ( const wchar_t *  strToReverse)
static

Creates a new wide string containing all the characters from strToReverse in reverse order.

For example: "ABCDEF" will return "FEDCBA".

Author
Eddie O'Hagan
Date
9/8/2016
try
{
wchar_t* data = Ace::ReverseString(L"あいうえお");
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%ls\n", data);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:おえういあ

Parameters
[in]strToReverseA wide string to reverse.
Returns
A newly created wide string containing the reverse of strToReverse. Throws an exception of strToReverse is NULL.

◆ ReverseStringInPlace() [1/2]

void Ace::ReverseStringInPlace ( char *  strToReverse)
static

Directly modifies strToReverse to have all its characters in reverse order.

For example: "ABCDEF" will return "FEDCBA".

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* data = Ace::AllocateAndCopyString("ABCDEF");
printf("%s\n", data);
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static void ReverseStringInPlace(char *strToReverse)
Directly modifies strToReverse to have all its characters in reverse order.
Definition: Ace.cpp:21370

Output:FEDCBA

Parameters
[in,out]strToReverseA preallocated string to reverse. Throws an exception of strToReverse is NULL.

◆ ReverseStringInPlace() [2/2]

void Ace::ReverseStringInPlace ( wchar_t *  strToReverse)
static

Directly modifies strToReverse to have all its characters in reverse order.

For example: "ABCDEF" will return "FEDCBA".

Author
Eddie O'Hagan
Date
9/8/2016
try
{
wchar_t* data = Ace::AllocateAndCopyString(L"あいうえお");
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%ls\n", data);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
_aligned_free(data);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:おえういあ

Parameters
[in,out]strToReverseA preallocated string to reverse. Throws an exception of strToReverse is NULL.

◆ RoundToNearestInteger() [1/4]

long Ace::RoundToNearestInteger ( const double &  num)
static

Rounds the floating-point argument num to an integer value, using the current rounding mode.

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/5/2016
try
{
long result = Ace::RoundToNearestInteger(3.5);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:4

Parameters
numNumber to round.
Returns
The num rounded using the current rounding mode. If a mathematical error occurs then an exception is thrown.

◆ RoundToNearestInteger() [2/4]

long Ace::RoundToNearestInteger ( const float &  num)
static

Rounds the floating-point argument num to an integer value, using the current rounding mode.

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
long result = Ace::RoundToNearestInteger(3.5f);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:4

Parameters
numNumber to round.
Returns
The num rounded using the current rounding mode. If a mathematical error occurs then then an exception is thrown.

◆ RoundToNearestInteger() [3/4]

long Ace::RoundToNearestInteger ( const int &  num)
static

Rounds the floating-point argument num to an integer value, using the current rounding mode.

This function is somewhat useless but provided for completeness. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/19/2016
try
{
long result = Ace::RoundToNearestInteger(3);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:3

Parameters
numNumber to round.
Returns
The num rounded using the current rounding mode. If a mathematical error occurs then an exception is thrown.

◆ RoundToNearestInteger() [4/4]

long Ace::RoundToNearestInteger ( const long &  num)
static

Rounds the floating-point argument num to an integer value, using the current rounding mode.

This function is somewhat useless but provided for completeness. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::RoundToNearestInteger((long)3);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:3

Parameters
numNumber to round.
Returns
The num rounded using the current rounding mode. If a mathematical error occurs then an exception is thrown.

◆ RoundUp() [1/4]

long Ace::RoundUp ( const double &  num)
static

Calculates the nearest integer value to num (in integer format), rounding halfway cases away from zero, regardless of the current rounding mode.

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/5/2016
try
{
long result = Ace::RoundUp(3.5);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:4

Parameters
numNumber to round.
Returns
The nearest integer value to num, rounding halfway cases away from zero. If a mathematical error occurs then an exception is thrown.

◆ RoundUp() [2/4]

long Ace::RoundUp ( const float &  num)
static

Calculates the nearest integer value to num (in integer format), rounding halfway cases away from zero, regardless of the current rounding mode.

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
long result = Ace::RoundUp(3.5f);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:4

Parameters
numNumber to round.
Returns
The nearest integer value to num, rounding halfway cases away from zero. If a mathematical error occurs then an exception is thrown.

◆ RoundUp() [3/4]

long Ace::RoundUp ( const int &  num)
static

Calculates the nearest integer value to num (in integer format), rounding halfway cases away from zero, regardless of the current rounding mode.

This function is somewhat useless but provided for completeness. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
long result = Ace::RoundUp(3);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:3

Parameters
numNumber to round.
Returns
The nearest integer value to num, rounding halfway cases away from zero. If a mathematical error occurs then an exception is thrown.

◆ RoundUp() [4/4]

long Ace::RoundUp ( const long &  num)
static

Calculates the nearest integer value to num (in integer format), rounding halfway cases away from zero, regardless of the current rounding mode.

This function is somewhat useless but provided for completeness. Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::RoundUp((long)3);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:3

Parameters
numNumber to round.
Returns
The nearest integer value to num, rounding halfway cases away from zero. If a mathematical error occurs then an exception is thrown.

◆ ShowMessageBox() [1/2]

void Ace::ShowMessageBox ( const HWND &  hWindow,
const char *  message,
const char *  title = "Error" 
)
static

Displays a standard message box with a message, title, and an OK button.

Author
Eddie O'Hagan
Date
10/31/2016
try
{
Ace::ShowMessageBox(NULL, "Hello Eddie!", "Message Box Name");
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:(Shows a message box with the message "Hello Eddie!" and the title of "Message Box Name").

Parameters
hWindowThe parent window to the message box (Can be NULL).
messageThe message to display in the message box (Can be NULL).
titleThe title to use in the message box window (Can be NULL).
Returns
Throws an exception if an error is encountered.

◆ ShowMessageBox() [2/2]

void Ace::ShowMessageBox ( const HWND &  hWindow,
const wchar_t *  message,
const wchar_t *  title = L"Error" 
)
static

Displays a standard message box with a message, title, and an OK button.

Author
Eddie O'Hagan
Date
10/31/2016
try
{
Ace::ShowMessageBox(NULL, L"こにちは エヂイ!", L"メッセージボックス名");
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:(Shows a message box with the message "こにちは エヂイ!" and the title of "メッセージボックス名").

Parameters
hWindowThe parent window to the message box (Can be NULL).
messageThe message to display in the message box (Can be NULL).
titleThe title to use in the message box window (Can be NULL).
Returns
Throws an exception if an error is encountered.

◆ Sin() [1/4]

double Ace::Sin ( const double &  numInRadians)
static

Calculates the Sin in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
const double PI = 3.14159265;
double angleInRadians = PI / 4.0;
double result = Ace::Sin(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double Sin(const double &numInRadians)
Calculates the Sin in compliance with CERT Coding Standard.
Definition: Ace.cpp:22039

Output:angleInRadians:0.785398 result:0.707107

Parameters
numInRadiansNumber in radians to calculate Sin for.
Returns
The Sin of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ Sin() [2/4]

float Ace::Sin ( const float &  numInRadians)
static

Calculates the Sin in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
const double PI = 3.14159265;
float angleInRadians = PI / 4.0;
float result = Ace::Sin(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0.785398 result:0.707107

Parameters
numInRadiansNumber in radians to calculate Sin for.
Returns
The Sin of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ Sin() [3/4]

int Ace::Sin ( const int &  numInRadians)
static

Calculates the Sin in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
const double PI = 3.14159265;
int angleInRadians = PI / 4.0;
int result = Ace::Sin(angleInRadians);
printf("angleInRadians:%d result:%d\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber in radians to calculate Sin for.
Returns
The Sin of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ Sin() [4/4]

long Ace::Sin ( const long &  numInRadians)
static

Calculates the Sin in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
const double PI = 3.14159265;
long angleInRadians = PI / 4.0;
long result = Ace::Sin(angleInRadians);
printf("angleInRadians:%ld result:%ld\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber in radians to calculate Sin for.
Returns
The Sin of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ SinH() [1/4]

double Ace::SinH ( const double &  numInRadians)
static

Calculates the SinH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/4/2016
try
{
const double PI = 3.14159265;
double angleInRadians = PI / 4.0;
double result = Ace::SinH(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double SinH(const double &numInRadians)
Calculates the SinH in compliance with CERT Coding Standard.
Definition: Ace.cpp:22275

Output:angleInRadians:0.785398 result:0.868671

Parameters
numInRadiansNumber in radians to calculate SinH for.
Returns
The SinH of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ SinH() [2/4]

float Ace::SinH ( const float &  numInRadians)
static

Calculates the SinH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
const double PI = 3.14159265;
float angleInRadians = PI / 4.0;
float result = Ace::SinH(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0.785398 result:0.868671

Parameters
numInRadiansNumber in radians to calculate SinH for.
Returns
The SinH of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ SinH() [3/4]

int Ace::SinH ( const int &  numInRadians)
static

Calculates the SinH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
const double PI = 3.14159265;
int angleInRadians = PI / 4.0;
int result = Ace::SinH(angleInRadians);
printf("angleInRadians:%d result:%d\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber in radians to calculate SinH for.
Returns
The SinH of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ SinH() [4/4]

long Ace::SinH ( const long &  numInRadians)
static

Calculates the SinH in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
const double PI = 3.14159265;
long angleInRadians = PI / 4.0;
long result = Ace::SinH(angleInRadians);
printf("angleInRadians:%ld result:%ld\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber in radians to calculate SinH for.
Returns
The SinH of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ Smallest() [1/4]

double Ace::Smallest ( const double &  numOne,
const double &  numTwo 
)
static

Calculates the smaller of the two values and returns the smaller one.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
double retVal = Ace::Smallest(5.002, 5.01);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:5.002000

Parameters
numOneNumber to compare.
numTwoOther number to compare.
Returns
The smaller of the two values.

◆ Smallest() [2/4]

float Ace::Smallest ( const float &  numOne,
const float &  numTwo 
)
static

Calculates the smaller of the two values and returns the smaller one.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
float retVal = Ace::Smallest(5.002f, 5.01f);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:5.002000

Parameters
numOneNumber to compare.
numTwoOther number to compare.
Returns
The smaller of the two values.

◆ Smallest() [3/4]

int Ace::Smallest ( const int &  numOne,
const int &  numTwo 
)
static

Calculates the smaller of the two values and returns the smaller one.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int retVal = Ace::Smallest(5, 7);
printf("%d\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:5

Parameters
numOneNumber to compare.
numTwoOther number to compare.
Returns
The smaller of the two values.

◆ Smallest() [4/4]

long Ace::Smallest ( const long &  numOne,
const long &  numTwo 
)
static

Calculates the smaller of the two values and returns the smaller one.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long retVal = Ace::Smallest((long)5, (long)7);
printf("%ld\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:5

Parameters
numOneNumber to compare.
numTwoOther number to compare.
Returns
The smaller of the two values.

◆ SquareRoot() [1/4]

double Ace::SquareRoot ( const double &  num)
static

Returns the Square Root of the provided number.

If the number provided is negative, -1 is returned.

Author
Eddie O'Hagan
Date
9/29/2016
try
{
double squareRoot = Ace::SquareRoot(144.0);
printf("%f\n", squareRoot);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double SquareRoot(const double &num)
Returns the Square Root of the provided number.
Definition: Ace.cpp:22634

Output:12.000000000

Parameters
[in]numThe number to take the Square Root of.
Returns
If num is negative; an exception is thrown, else the Square Root is returned.

◆ SquareRoot() [2/4]

float Ace::SquareRoot ( const float &  num)
static

Returns the Square Root of the provided number.

If the number provided is negative, -1 is returned.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float squareRoot = Ace::SquareRoot(144.0f);
printf("%f\n", squareRoot);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:12.000000000

Parameters
[in]numThe number to take the Square Root of.
Returns
If num is negative; an exception is thrown, else the Square Root is returned.

◆ SquareRoot() [3/4]

int Ace::SquareRoot ( const int &  num)
static

Returns the Square Root of the provided number.

If the number provided is negative, -1 is returned.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int squareRoot = Ace::SquareRoot(144);
printf("%d\n", squareRoot);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:12

Parameters
[in]numThe number to take the Square Root of.
Returns
If num is negative; an exception is thrown, else the Square Root is returned.

◆ SquareRoot() [4/4]

long Ace::SquareRoot ( const long &  num)
static

Returns the Square Root of the provided number.

If the number provided is negative, -1 is returned.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long squareRoot = Ace::SquareRoot((long)144);
printf("%ld\n", squareRoot);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:12

Parameters
[in]numThe number to take the Square Root of.
Returns
If num is negative; an exception is thrown, else the Square Root is returned.

◆ SubString() [1/4]

bool Ace::SubString ( char *  destination,
const char *  str,
const int &  startIndex,
const int &  upToButNotIncludingIndex = INT_MAX 
)
static

Returns a string containing the characters between startIndex and upToButNotIncludingIndex.

Instead of dynamically allocating a buffer, This function uses a provided destination buffer to store the substring. If upToButNotIncludingIndex is not provided, then the string stored is everything from startIndex to the end of the string.

Here's an example: str = "Happiness" startIndex = 3 upToButNotIncludingIndex = 8 then the output would be "pines".

Author
Eddie O'Hagan
Date
4/3/2022
try
{
char substr[256] = { L'\0' };
if (Ace::SubString(substr, "Happiness", 3, 8) == true)
{
printf("%s\n", substr);
}
else
{
printf("%s\n", "Failed to get substring");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:pines

Parameters
[in]destinationThe Destination Buffer to store the retrieved sub-string.
[in]strThe string to parse.
[in]startIndexThe (0 based) index of where to start parsing str.
[in]upToButNotIncludingIndexThe (0 based) index of where to stop.
Returns
true if the substring was retrieved successfully, false otherwise. Throws an exception if error occurs.

◆ SubString() [2/4]

char * Ace::SubString ( const char *  str,
const int &  startIndex,
const int &  upToButNotIncludingIndex = INT_MAX 
)
static

Returns a string containing the characters between startIndex and upToButNotIncludingIndex.

Unlike strstr(), this function creates a new string and returns it. If upToButNotIncludingIndex is not provided, then the string returned is everything from startIndex to the end of the string.

Here's an example: str = "Happiness" startIndex = 3 upToButNotIncludingIndex = 8 then the output would be "pines".

Author
Eddie O'Hagan
Date
5/7/2016
try
{
char* substr = Ace::SubString("Happiness", 3, 8);
printf("%s\n", substr);
_aligned_free(substr);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:pines

Parameters
[in]strThe string to parse.
[in]startIndexThe (0 based) index of where to start parsing str.
[in]upToButNotIncludingIndexThe (0 based) index of where to stop.
Returns
A newly created string containing the characters from startIndex to upToButNotIncludingIndex. Throws an exception if error occurs.

◆ SubString() [3/4]

wchar_t * Ace::SubString ( const wchar_t *  str,
const int &  startIndex,
const int &  upToButNotIncludingIndex = INT_MAX 
)
static

Returns a wide string containing the characters between startIndex and upToButNotIncludingIndex.

Unlike strstr(), this function creates a new string and returns it. If upToButNotIncludingIndex is not provided, then the string returned is everything from startIndex to the end of the string.

Here's an example: str = "私は日本語を話せません。" startIndex = 3 upToButNotIncludingIndex = 8 then the output would be "本語を話せ".

Author
Eddie O'Hagan
Date
9/5/2016
try
{
wchar_t* substr = Ace::SubString(L"私は日本語を話せません。", 3, 8);
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%ls\n", substr);
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
_aligned_free(substr);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:本語を話せ

Parameters
[in]strThe wide string to parse.
[in]startIndexThe (0 based) index of where to start parsing str.
[in]upToButNotIncludingIndexThe (0 based) index of where to stop.
Returns
A newly created wide string containing the characters from startIndex to upToButNotIncludingIndex. Throws an exception if error occurs.

◆ SubString() [4/4]

bool Ace::SubString ( wchar_t *  destination,
const wchar_t *  str,
const int &  startIndex,
const int &  upToButNotIncludingIndex = INT_MAX 
)
static

Returns a string containing the characters between startIndex and upToButNotIncludingIndex.

Instead of dynamically allocating a buffer, This function uses a provided destination buffer to store the substring. If upToButNotIncludingIndex is not provided, then the string stored is everything from startIndex to the end of the string.

Here's an example: str = "私は日本語を話せません。" startIndex = 3 upToButNotIncludingIndex = 8 then the output would be "本語を話せ".

Author
Eddie O'Hagan
Date
4/3/2022
try
{
wchar_t substr[256] = { L'\0' };
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
if (Ace::SubString(substr, L"私は日本語を話せません。", 3, 8) == true)
{
wprintf(L"%s\n", substr);
}
else
{
printf("%s\n", "Failed to get substring");
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:本語を話せ

Parameters
[in]destinationThe Destination Buffer to store the retrieved sub-string.
[in]strThe string to parse.
[in]startIndexThe (0 based) index of where to start parsing str.
[in]upToButNotIncludingIndexThe (0 based) index of where to stop.
Returns
true if the substring was retrieved successfully, false otherwise. Throws an exception if error occurs.

◆ Tan() [1/4]

double Ace::Tan ( const double &  numInRadians)
static

Calculates the Tangent (Tan) of numInRadians in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
const double PI = 3.14159265;
double angleInRadians = PI / 4.0;
double result = Ace::Tan(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double Tan(const double &numInRadians)
Calculates the Tangent (Tan) of numInRadians in compliance with CERT Coding Standard.
Definition: Ace.cpp:23196

Output:angleInRadians:0.785398 result:1.000000

Parameters
numInRadiansNumber to use to calculate its tangent.
Returns
The Tangent (tan) of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ Tan() [2/4]

float Ace::Tan ( const float &  numInRadians)
static

Calculates the Tangent (Tan) of numInRadians in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
const double PI = 3.14159265;
float angleInRadians = PI / 4.0;
float result = Ace::Tan(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0.785398 result:1.000000

Parameters
numInRadiansNumber to use to calculate its tangent.
Returns
The Tangent (tan) of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ Tan() [3/4]

int Ace::Tan ( const int &  numInRadians)
static

Calculates the Tangent (Tan) of numInRadians in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
const double PI = 3.14159265;
int angleInRadians = PI / 4.0;
int result = Ace::Tan(angleInRadians);
printf("angleInRadians:%d result:%d\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber to use to calculate its tangent.
Returns
The Tangent (tan) of numInRadians. If a mathematical error occurs then exception is thrown.

◆ Tan() [4/4]

long Ace::Tan ( const long &  numInRadians)
static

Calculates the Tangent (Tan) of numInRadians in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
const double PI = 3.14159265;
long angleInRadians = PI / 4.0;
long result = Ace::Tan(angleInRadians);
printf("angleInRadians:%ld result:%ld\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber to use to calculate its tangent.
Returns
The Tangent (tan) of numInRadians. If a mathematical error occurs then exception is thrown.

◆ TanH() [1/4]

double Ace::TanH ( const double &  numInRadians)
static

Calculates The Hyperbolic Tangent (TanH) of numInRadians in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
const double PI = 3.14159265;
double angleInRadians = PI / 4.0;
double result = Ace::TanH(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double TanH(const double &numInRadians)
Calculates The Hyperbolic Tangent (TanH) of numInRadians in compliance with CERT Coding Standard.
Definition: Ace.cpp:23436

Output:angleInRadians:0.785398 result:0.655794

Parameters
numInRadiansNumber to use to calculate its hyperbolic tangent.
Returns
The Hyperbolic Tangent (tan) of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ TanH() [2/4]

float Ace::TanH ( const float &  numInRadians)
static

Calculates The Hyperbolic Tangent (TanH) of numInRadians in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
const double PI = 3.14159265;
float angleInRadians = PI / 4.0;
float result = Ace::TanH(angleInRadians);
printf("angleInRadians:%f result:%f\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0.785398 result:0.655794

Parameters
numInRadiansNumber to use to calculate its hyperbolic tangent.
Returns
The Hyperbolic Tangent (tan) of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ TanH() [3/4]

int Ace::TanH ( const int &  numInRadians)
static

Calculates The Hyperbolic Tangent (TanH) of numInRadians in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
const double PI = 3.14159265;
int angleInRadians = PI / 4.0;
int result = Ace::TanH(angleInRadians);
printf("angleInRadians:%d result:%d\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber to use to calculate its hyperbolic tangent.
Returns
The Hyperbolic Tangent (tan) of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ TanH() [4/4]

long Ace::TanH ( const long &  numInRadians)
static

Calculates The Hyperbolic Tangent (TanH) of numInRadians in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
const double PI = 3.14159265;
long angleInRadians = PI / 4.0;
long result = Ace::TanH(angleInRadians);
printf("angleInRadians:%ld result:%ld\n", angleInRadians, result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:angleInRadians:0 result:0

Parameters
numInRadiansNumber to use to calculate its hyperbolic tangent.
Returns
The Hyperbolic Tangent (tan) of numInRadians. If a mathematical error occurs then an exception is thrown.

◆ Tokenize() [1/4]

bool Ace::Tokenize ( char **  destination,
const char *  strToTokenize,
const char *  delimiter,
int &  outNumTokensFound 
)
static

Breaks up a string and stores of all the strings between each delimiter into the destination buffer.

For example: "Shit,Piss, Cunt,Cock-sucker,Mother_Fucker,and tits" And the delimiter was "," then the function would return: Array[0] = "Shit" Array[1] = "Piss" Array[2] = " Cunt" Array[3] = "Cock-sucker" Array[4] = "Mother_Fucker" Array[5] = "and tits"

Author
Eddie O'Hagan
Date
4/26/2022
try
{
int index;
int numItemsFound;
const char* data = "Shit, Piss, Cunt, Cock - sucker, Mother_Fucker, and tits";
char* items[6];
for (index = 0; index < 6; index++)
{
items[index] = (char*)Ace::_Aligned_Calloc(14 * sizeof(char));
}
if (Ace::Tokenize(items, data, ",", numItemsFound) == true)
{
for (index = 0; index < 6; index++)
{
printf("Array[%d]:%s\n", index, items[index]);
_aligned_free(items[index]);
}
}
else
{
printf("%s\n", "Failed to tokenize data.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:Array[0]:Shit Array[1]: Piss Array[2]: Cunt Array[3]: Cock - sucker Array[4]: Mother_Fucker Array[5]: and tits

Parameters
[in,out]destinationAn array to store the strings broken up from strToTokenize.
[in,out]strToTokenizeA string to break up into an array.
[in,out]delimiterA string/character used to separate each string in strToTokenize.
[in,out]outNumTokensFoundNumber of strings added to the final array.
Returns
true on success, false otherwise. Throws an exception if an error occurs.

◆ Tokenize() [2/4]

char ** Ace::Tokenize ( const char *  strToTokenize,
const char *  delimiter,
int &  outNumTokensFound 
)
static

Breaks up a string and returns an array of all the strings between each delimiter.

For example: "Shit,Piss, Cunt,Cock-sucker,Mother_Fucker,and tits" And the delimiter was "," then the function would return: Array[0] = "Shit" Array[1] = "Piss" Array[2] = " Cunt" Array[3] = "Cock-sucker" Array[4] = "Mother_Fucker" Array[5] = "and tits"

Author
Eddie O'Hagan
Date
5/7/2016
try
{
int numItems = 0;
const char* data = "Shit, Piss, Cunt, Cock - sucker, Mother_Fucker, and tits";
char** items = Ace::Tokenize(data, ",", numItems);
for (int currIndex = 0; currIndex < numItems; currIndex++)
{
printf("Array[%d]:%s\n", currIndex, items[currIndex]);
_aligned_free(items[currIndex]);
}
_aligned_free(items);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Array[0]:Shit Array[1]: Piss Array[2]: Cunt Array[3]: Cock - sucker Array[4]: Mother_Fucker Array[5]: and tits

Parameters
[in,out]strToTokenizeA string to break up into an array.
[in,out]delimiterA string/character used to separate each string in strToTokenize.
[in,out]outNumTokensFoundNumber of strings added to the final array.
Returns
An array of strings broken up from strToTokenize. Throws an exception if an error occurs.

◆ Tokenize() [3/4]

wchar_t ** Ace::Tokenize ( const wchar_t *  strToTokenize,
const wchar_t *  delimiter,
int &  outNumTokensFound 
)
static

Breaks up a wide string and returns an array of all the wide strings between each delimiter.

For example: "たわごと、小便、おまんこ、コック-吸盤、マザー_ファッカー、そしておっぱい" And the delimiter was "、" then the function would return: アレイ[0]:たわごと アレイ[1]:小便 アレイ[2]:おまんこ アレイ[3]:コック-吸盤 アレイ[4]:マザー_ファッカー アレイ[5]:そしておっぱい

Author
Eddie O'Hagan
Date
9/8/2016
try
{
int numItems = 0;
const wchar_t* data = L"たわごと、小便、おまんこ、コック-吸盤、マザー_ファッカー、そしておっぱい";
wchar_t** items = Ace::Tokenize(data, L"、", numItems);
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
for (int currIndex = 0; currIndex < numItems; currIndex++)
{
wprintf(L"アレイ[%d]:%s\n", currIndex, items[currIndex]);
}
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
for (int currIndex = 0; currIndex < numItems; currIndex++)
{
_aligned_free(items[currIndex]);
}
_aligned_free(items);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:アレイ[0]:たわごと アレイ[1]:小便 アレイ[2]:おまんこ アレイ[3]:コック-吸盤 アレイ[4]:マザー_ファッカー アレイ[5]:そしておっぱい

Parameters
[in,out]strToTokenizeA wide string to break up into an array.
[in,out]delimiterA wide string/character used to separate each wide string in strToTokenize.
[in,out]outNumTokensFoundNumber of wide strings added to the final array.
Returns
An array of strings broken up from strToTokenize. Throws an exception if an error occurs.

◆ Tokenize() [4/4]

bool Ace::Tokenize ( wchar_t **  destination,
const wchar_t *  strToTokenize,
const wchar_t *  delimiter,
int &  outNumTokensFound 
)
static

Breaks up a string and stores of all the strings between each delimiter into the destination buffer.

For example: "たわごと、小便、おまんこ、コック-吸盤、マザー_ファッカー、そしておっぱい" And the delimiter was "、" then the function would return: アレイ[0]:たわごと アレイ[1]:小便 アレイ[2]:おまんこ アレイ[3]:コック-吸盤 アレイ[4]:マザー_ファッカー アレイ[5]:そしておっぱい

Author
Eddie O'Hagan
Date
4/26/2022
try
{
int index;
int numItemsFound;
const wchar_t* data = L"たわごと、小便、おまんこ、コック-吸盤、マザー_ファッカー、そしておっぱい";
wchar_t* items[6];
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
for (index = 0; index < 6; index++)
{
items[index] = (wchar_t*)Ace::_Aligned_Calloc(14 * sizeof(wchar_t));
}
if (Ace::Tokenize(items, data, L"、", numItemsFound) == true)
{
for (index = 0; index < 6; index++)
{
wprintf(L"アレイ[%d]:%s\n", index, items[index]);
}
}
else
{
printf("%s\n", "Failed to tokenize data.");
}
for (index = 0; index < 6; index++)
{
_aligned_free(items[index]);
}
}
else
{
printf("%s\n", "Failed to change windows font.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:アレイ[0]:たわごと アレイ[1]:小便 アレイ[2]:おまんこ アレイ[3]:コック-吸盤 アレイ[4]:マザー_ファッカー アレイ[5]:そしておっぱい

Parameters
[in,out]destinationAn array to store the strings broken up from strToTokenize.
[in,out]strToTokenizeA string to break up into an array.
[in,out]delimiterA string/character used to separate each string in strToTokenize.
[in,out]outNumTokensFoundNumber of strings added to the final array.
Returns
true on success, false otherwise. Throws an exception if an error occurs.

◆ Truncate() [1/2]

double Ace::Truncate ( const double &  num)
static

Removes everything after the decimal point.

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
double retVal = Ace::Truncate(2.849543);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double Truncate(const double &num)
Removes everything after the decimal point.
Definition: Ace.cpp:24240

Output:2.000000

Parameters
numNumber to truncate.
Returns
The truncated version of num. If a mathematical error occurs then an exception is thrown.

◆ Truncate() [2/2]

float Ace::Truncate ( const float &  num)
static

Removes everything after the decimal point.

Created in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/9/2016
try
{
float retVal = Ace::Truncate(2.849543f);
printf("%f\n", retVal);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:2.000000

Parameters
numNumber to truncate.
Returns
The truncated version of num. If a mathematical error occurs then an exception is thrown.

◆ TwoToTheXPower() [1/4]

double Ace::TwoToTheXPower ( const double &  power)
static

Calculates 2^power in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/5/2016
try
{
double result = Ace::TwoToTheXPower(6.0);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
static double TwoToTheXPower(const double &power)
Calculates 2^power in compliance with CERT Coding Standard.
Definition: Ace.cpp:24355

Output:64.000000

Parameters
powerNumber to raise 2 to.
Returns
The value of 2^power. If a mathematical error occurs then an exception is thrown.

◆ TwoToTheXPower() [2/4]

float Ace::TwoToTheXPower ( const float &  power)
static

Calculates 2^power in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/6/2016
try
{
float result = Ace::TwoToTheXPower(6.0f);
printf("%f\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:64.000000

Parameters
powerNumber to raise 2 to.
Returns
The value of 2^power. If a mathematical error occurs then an exception is thrown.

◆ TwoToTheXPower() [3/4]

int Ace::TwoToTheXPower ( const int &  power)
static

Calculates 2^power in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/20/2016
try
{
int result = Ace::TwoToTheXPower(4);
printf("%d\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:16

Parameters
powerNumber to raise 2 to.
Returns
The value of 2^power. If a mathematical error occurs then an exception is thrown.

◆ TwoToTheXPower() [4/4]

long Ace::TwoToTheXPower ( const long &  power)
static

Calculates 2^power in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
7/23/2023
try
{
long result = Ace::TwoToTheXPower((long)4);
printf("%ld\n", result);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:16

Parameters
powerNumber to raise 2 to.
Returns
The value of 2^power. If a mathematical error occurs then an exception is thrown.

◆ Validate() [1/2]

bool Ace::Validate ( const HWND &  hWnd,
const HRESULT &  result,
const char *  message,
const char *  title = "ERROR" 
)
static

Returns false and displays an error window if result is an error (i.e.

FAILED). Otherwise returns true.

Author
Eddie O'Hagan
Date
10/18/2016
try
{
HRESULT hResult = -1;
bool result = Ace::Validate(NULL, hResult, "Ace Error: Windows function encountered error.", "Error Window");
if (result == true)
{
printf("%s\n", "Windows function succeeded.");
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:(Message box appears and displays the provided ERROR message.)

Parameters
hWndHandle of the window.
resultThe result to validate.
[in]messageThe message to display if failure.
[in]titleThe title for the display window if failure.
Returns
false if error, true otherwise. Throws an exception if ShowMessageBox() encounters an error.

◆ Validate() [2/2]

bool Ace::Validate ( const HWND &  hWnd,
const HRESULT &  result,
const wchar_t *  message,
const wchar_t *  title = L"ERROR" 
)
static

Returns false and displays an error window if result is an error (i.e.

FAILED). Otherwise returns true.

Author
Eddie O'Hagan
Date
10/18/2016
try
{
HRESULT hResult = -1;
bool result = Ace::Validate(NULL, hResult, L"エースエラー:Windows関数でエラーが発生しました。", L"エラーウィンドウ");
if (result == true)
{
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == true)
{
wprintf(L"%ls\n", L"Windows関数は成功しました。");
}
else
{
printf("%s\n", "Error: Failed to change windows font.");
}
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:(Message box appears and displays the provided error message.)

Parameters
hWndHandle of the window.
resultThe result to validate.
[in]messageThe message to display if failure.
[in]titleThe title for the display window if failure.
Returns
false if error, true otherwise. Throws an exception if ShowMessageBox() encounters an error.

◆ WriteBinaryFile()

size_t Ace::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 
)
static

Opens a file for writing and returns the number of items/elements written to the file.

Created in compliance with the CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/13/2016
try
{
int rectIndex;
const int numRectangles = 3;
RECT* currRect;
RECT myRectangles[numRectangles];
//Create 3 rectangles with different values.
for (rectIndex = 0; rectIndex < numRectangles; rectIndex++)
{
myRectangles[rectIndex].left = rectIndex;
myRectangles[rectIndex].right = rectIndex + 1;
myRectangles[rectIndex].top = rectIndex * rectIndex;
myRectangles[rectIndex].bottom = rectIndex / 2;
printf("Writing Rect[%d] to file with values: L%d R%d T%d B%d \n",
rectIndex,
myRectangles[rectIndex].left,
myRectangles[rectIndex].right,
myRectangles[rectIndex].top,
myRectangles[rectIndex].bottom);
Ace::WriteBinaryFile("C:\\rectangleData.bin", &myRectangles[rectIndex], sizeof(RECT), "ab");
}
//Read in those created rectangles, we expect to get the same values back as we originally wrote.
for (rectIndex = 0; rectIndex < numRectangles; rectIndex++)
{
currRect = (RECT*)Ace::ReadBinaryFile("C:\\rectangleData.bin", sizeof(RECT), MAX_STRING_BUFFER_SIZE, "rb", rectIndex * sizeof(RECT));
printf("Reading Rect[%d] from the file with values: L%d R%d T%d B%d \n",
rectIndex,
currRect->left,
currRect->right,
currRect->top,
currRect->bottom);
_aligned_free(currRect);
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:Writing Rect[0] to file with values: L0 R1 T0 B0 Writing Rect[1] to file with values: L1 R2 T1 B0 Writing Rect[2] to file with values: L2 R3 T4 B1 Reading Rect[0] from the file with values: L0 R1 T0 B0 Reading Rect[1] from the file with values: L1 R2 T1 B0 Reading Rect[2] from the file with values: L2 R3 T4 B1

Parameters
[in]filePathThe path to the file.
bufferToWriteThe data to be written.
bufferSizeMaximum number of bytes to read.
[in]modeThe mode for fopen_s ("w" for write, "w+" for read/write, etc).
seekOffsetNumber of bytes to offset from origin.
seekOriginPosition used as reference for the offset (SEEK_SET represents beginning of file).
[out]outEndCursorPosThe value returned by ftell() after doing the read.
Returns
The buffer containing the file data of size numBytesToRead. Throws an exception if error occurs.

◆ WriteBinaryFileW()

size_t Ace::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 
)
static

Opens a file for writing and returns the number of items/elements written to the file.

Created in compliance with the CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/13/2016
try
{
int rectIndex;
const int numRectangles = 3;
RECT* currRect;
RECT myRectangles[numRectangles];
//Change windows font to display console output in Japanese.
UINT fontWeight = FW_NORMAL;
UINT fontFamily = DEFAULT_PITCH | FF_MODERN;
bool success = Ace::ChangeWindowsConsoleFont(L"Meiryo", L"ja_JP.UTF-8", fontFamily, fontWeight, 12, 20);
if (success == false)
{
printf("%s\n", "Error: Failed to change windows font.");
}
//Create 3 rectangles with different values.
for (rectIndex = 0; rectIndex < numRectangles; rectIndex++)
{
myRectangles[rectIndex].left = rectIndex;
myRectangles[rectIndex].right = rectIndex + 1;
myRectangles[rectIndex].top = rectIndex * rectIndex;
myRectangles[rectIndex].bottom = rectIndex / 2;
wprintf(L"長方形を書く[%d] 値をファイルする: L%d R%d T%d B%d \n",
rectIndex,
myRectangles[rectIndex].left,
myRectangles[rectIndex].right,
myRectangles[rectIndex].top,
myRectangles[rectIndex].bottom);
Ace::WriteBinaryFileW(L"C:\\長方形データ.bin", &myRectangles[rectIndex], sizeof(RECT), L"ab");
}
//Read in those created rectangles, we expect to get the same values back as we originally wrote.
for (rectIndex = 0; rectIndex < numRectangles; rectIndex++)
{
currRect = (RECT*)Ace::ReadBinaryFileW(L"C:\\長方形データ.bin", sizeof(RECT), MAX_STRING_BUFFER_SIZE, L"rb", rectIndex * sizeof(RECT));
wprintf(L"長方形を読む[%d] 値を持つファイルから: L%d R%d T%d B%d \n",
rectIndex,
currRect->left,
currRect->right,
currRect->top,
currRect->bottom);
_aligned_free(currRect);
}
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}

Output:長方形を書く[0] 値をファイルする: L0 R1 T0 B0 長方形を書く[1] 値をファイルする: L1 R2 T1 B0 長方形を書く[2] 値をファイルする: L2 R3 T4 B1 長方形を読む[0] 値を持つファイルから: L0 R1 T0 B0 長方形を読む[1] 値を持つファイルから: L1 R2 T1 B0 長方形を読む[2] 値を持つファイルから: L2 R3 T4 B1

Parameters
[in]filePathThe path to the file.
bufferToWriteThe data to be written.
bufferSizeMaximum number of bytes to read.
[in]modeThe mode for fopen_s ("w" for write, "w+" for read/write, etc).
seekOffsetNumber of bytes to offset from origin.
seekOriginPosition used as reference for the offset (SEEK_SET represents beginning of file).
[out]outEndCursorPosThe value returned by ftell() after doing the read.
Returns
The buffer containing the file data of size numBytesToRead. Throws an exception if error occurs.

◆ WriteTextFile()

size_t Ace::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 
)
static

Opens a file for writing and returns the number of items/elements written to the file.

Created in compliance with the CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/13/2016
try
{
char* buffer = Ace::AllocateAndCopyString("In a row?!");
size_t bufferSize = strlen(buffer) * sizeof(char);
size_t retVal = Ace::WriteTextFile("C:\\dicks.txt", buffer, bufferSize, "a");
_aligned_free(buffer);
buffer = Ace::ReadTextFile("C:\\dicks.txt");
printf("%s\n", buffer);
_aligned_free(buffer);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:dicksdicksdicksdicksdicksdicksdick8=>In a row?!

Parameters
[in]filePathThe path to the file.
[in]bufferToWriteThe data to be written.
bufferSizeSize of the buffer in bytes.
[in]modeThe mode for fopen_s ("w" for write, "w+" for read/write, etc).
seekOffsetEither zero, or a value returned by ftell().
seekOriginPosition used as reference for the offset (SEEK_SET represents beginning of file).
[out]outEndCursorPosThe value returned by ftell() after doing the read.
Returns
The number of items/elements written to the file. Throws an exception if error occurs.

◆ WriteTextFileW()

size_t Ace::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 
)
static

Opens a file for writing and returns the number of items/elements written to the file.

Created in compliance with the CERT Coding Standard.

Author
Eddie O'Hagan
Date
10/13/2016
try
{
wchar_t* buffer = Ace::AllocateAndCopyString(L"いい ですよ。");
size_t bufferSize = wcslen(buffer) * sizeof(wchar_t);
size_t retVal = Ace::WriteTextFileW(L"C:\\jap.txt", buffer, bufferSize, L"a, ccs=UTF-8");
_aligned_free(buffer);
buffer = Ace::ReadTextFileW(L"C:\\jap.txt");
MessageBoxW(NULL, buffer, NULL, 0);
_aligned_free(buffer);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output:(A message box showing: わたし わ エドワド オ’ハゲン です。 これ は なん です か?いい ですよ。)

Parameters
[in]filePathThe path to the file.
[in]bufferToWriteThe data to be written.
bufferSizeSize of the buffer in bytes.
[in]modeThe mode for fopen_s ("w" for write, "w+" for read/write, etc).
seekOffsetEither zero, or a value returned by ftell().
seekOriginPosition used as reference for the offset (SEEK_SET represents beginning of file).
[out]outEndCursorPosThe value returned by ftell() after doing the read.
Returns
The number of items/elements written to the file. Throws an exception if error occurs.

◆ ZeroOutMemory()

bool Ace::ZeroOutMemory ( void *  bufferToZero,
const size_t &  sizeOfBufferInBytes 
)
static

Assigns 0 to every slot in the buffer (aka Zeroing out the memory) in compliance with CERT Coding Standard.

Author
Eddie O'Hagan
Date
2/26/2022
try
{
char* buffer = (char*)Ace::_Aligned_Malloc(1024);
if (strcpy_s(buffer, 1024, "My name is Eddie and I like spaghetti.") != 0)
{
throw "Error: Failed to copy string.";
}
printf("Before Zero Out:%s\n", buffer);
Ace::ZeroOutMemory(buffer, 1024);
printf("After Zero Out:%s\n", buffer);
_aligned_free(buffer);
}
catch (char* exceptionMessage)
{
printf("%s\n", exceptionMessage);
}
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

Output: Before Zero Out: My name is Eddie and I like spaghetti. After Zero Out:

Parameters
bufferToZeroThe buffer to zero out.
sizeOfBufferInBytesThe size of the buffer in bytes.
Returns
True if the buffer was successfully zeroed out, false otherwise.

The documentation for this class was generated from the following files: