Compare commits

..

10 Commits

Author SHA1 Message Date
3f592f73e8 Documented Array and Vector containers.
Some checks failed
Build & Release / Linux-AMD64-Build (push) Failing after 4s
Build & Release / Linux-AARCH64-Build (push) Has been cancelled
2024-02-01 20:26:30 -08:00
80744abcc3 Documented Array and Vector containers. 2024-02-01 20:09:58 -08:00
0996f16482 URI class is now documented. 2024-02-01 20:03:10 -08:00
c7ddeff3fb Type class is now documented. 2024-02-01 20:00:27 -08:00
227188243e Fixed UDP/TCP sockets and documented BaseObj class. 2024-02-01 19:56:06 -08:00
c2cbb35cdf UDP and TCP sockets are documented. 2024-02-01 19:36:28 -08:00
57c806ee8c Fixed calls to DNS::Resolve. 2024-02-01 17:34:21 -08:00
e48a3fd750 Documented and improved DNS::Resolve. Readme has been adjusted to changes. 2024-02-01 17:24:38 -08:00
beaa7cb034 Added a default log callback and attached the console at start. 2024-02-01 17:12:55 -08:00
6fa7729253 Added and adjusted docs for Str class. 2024-02-01 17:04:57 -08:00
25 changed files with 3227 additions and 166 deletions

Binary file not shown.

View File

@ -12,9 +12,13 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v3
- name: Generating Documentation
run: |
doxygen ehs-docs-config.doxyfile
- name: Installing Dependencies
run: |
sudo pacman -S --noconfirm zip alsa-lib libxcb xcb-util-cursor
sudo pacman -S --noconfirm doxygen zip alsa-lib libxcb xcb-util-cursor
- name: Building/Compiling Project
run: |
@ -30,7 +34,7 @@ jobs:
mv libEHS.a lib
- name: Zipping Binaries
run: zip -r ehs-linux-amd64.zip include bin lib
run: zip -r ehs-linux-amd64.zip include bin lib docs
- uses: https://github.com/actions/setup-go@v4
with:
@ -51,7 +55,11 @@ jobs:
uses: actions/checkout@v3
- name: Installing Dependencies
run: sudo apt install -y zip libasound2-dev libxcb1-dev libxcb-xinput-dev libxcb-cursor-dev
run: sudo apt install -y doxygen zip libasound2-dev libxcb1-dev libxcb-xinput-dev libxcb-cursor-dev
- name: Generating Documentation
run: |
doxygen ehs-docs-config.doxyfile
- name: Building/Compiling Project
run: |
@ -67,7 +75,7 @@ jobs:
mv libEHS.a lib
- name: Zipping Binaries
run: zip -r ehs-linux-aarch64.zip include bin lib
run: zip -r ehs-linux-aarch64.zip include bin lib docs
- uses: https://github.com/actions/setup-go@v4
with:

View File

@ -221,7 +221,7 @@ add_executable(StrToHash src/StrToHash.cpp)
target_include_directories(EHS PUBLIC ${PROJECT_SOURCE_DIR}/include)
set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIRECTORY}/Libraries/EHS")
set(CMAKE_INSTALL_PREFIX "/usr/local")
install(TARGETS EHS DESTINATION lib)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include)

View File

@ -71,24 +71,6 @@ Wayland Window System. Wayland support is currently not fully supported yet, use
#include <ehs/EHS.h>
#include <ehs/io/Console.h>
void LogRaised(const ehs::Log& log)
{
ehs::Array<ehs::Str_8> tags = log.GetTags(); // Retrieves the tags from the log such as line number, function, etc...
ehs::Str_8 result = "{";
for (ehs::UInt_32 i = 0; i < tags.Size(); ++i)
{
result += tags[i];
if (i != tags.Size() - 1)
result += ", ";
}
result += "} (" + ehs::Str_8::FromNum(log.GetCode()) + "): " + log.GetMsg(); // Adds the error code and message from the log.
ehs::Console::Write_8(result);
}
ehs::Int_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer)
{
// Simple identifying meta-data for the logger.
@ -96,10 +78,6 @@ ehs::Int_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer
*appVerId = "Release"; // The app's version prefix; i.e. Alpha, Beta or Release as an example.
*appVer = {1, 0, 0}; // The app's version major, minor and patch number.
ehs::Console::Attach(); // Attach to the console.
ehs::Log::SetCallback(LogRaised); // Sets the log callback function for outputting the information to console.
ehs::Console::Write_8("How old are you?"); // Write to the console in UTF_8 character encoding.
ehs::Str_8 response = ehs::Console::Read_8(); // Read from the console in UTF_8 character encoding.

2854
ehs-docs-config.doxyfile Normal file

File diff suppressed because it is too large Load Diff

View File

@ -227,6 +227,9 @@ namespace ehs
data[b] = std::move(tmp);
}
/// Inserts a value at the specified index.
/// @param [in] index The index to insert the value at.
/// @param [in] value The value to add.
void Insert(const N index, const T value)
{
N newSize = 0;
@ -251,6 +254,9 @@ namespace ehs
size = newSize;
}
/// Removes a value at the specified index.
/// @param [in] index The index to remove a value.
/// @returns The value that was removed.
T Remove(const N index)
{
T popped = {};
@ -383,6 +389,7 @@ namespace ehs
return Pop();
}
/// Releases the resources of the array.
void Clear()
{
if (!data)
@ -418,6 +425,8 @@ namespace ehs
return size;
}
/// Retrieves the index at the end of the array.
/// @returns The index.
N End() const
{
return size - 1;

View File

@ -28,25 +28,47 @@ namespace ehs
bool operator!=(const BaseObj& base) const;
/// Retrieves the class hierarchy.
/// @returns The hierarchy array.
const Type* GetHierarchy() const;
/// Retrieves the class hierarchy size.
/// @returns The hierarchy size.
UInt_64 GetHierarchySize() const;
/// Checks if this class derives from another.
/// @param [in] typeHashId The type hash id to look for.
/// @returns True if found.
bool HasType(UInt_64 typeHashId) const;
/// Checks if this class derives from another.
/// @param [in] typeId The type id to look for.
/// @returns True if found.
bool HasType(const Char_8* typeId) const;
/// Retrieves the top class' information.
/// @returns The Type object containing the class information.
Type GetType() const;
/// Retrieves the top class' string name, size.
/// @returns The name size.
UInt_64 GetTypeIdSize() const;
/// Retrieves the top class' string name.
/// @returns The name.
const Char_8* GetTypeId() const;
/// Retrieves the top class' hashed name.
/// @returns The hashed name.
UInt_64 GetTypeHashId() const;
/// Clones the object onto the heap.
/// @returns The cloned object.
virtual BaseObj* Clone() const;
protected:
/// Adds the class name to the class hierarchy.
/// @param [in] id The name of the class to add.
void AddType(const Char_8* id);
};
}

View File

@ -21,9 +21,9 @@ namespace ehs
UINT_8
};
DataType FromAudioBitDepth(const UInt_16 bitDepth);
DataType FromAudioBitDepth(UInt_16 bitDepth);
UInt_8 ToByteDepth(const DataType type);
UInt_8 ToByteDepth(DataType type);
UInt_8 ToBitDepth(const DataType type);
UInt_8 ToBitDepth(DataType type);
}

View File

@ -33,7 +33,7 @@ namespace ehs
public:
/// Frees any data created on the heap.
~Str()
~Str() override
{
delete[] data;
}
@ -84,6 +84,7 @@ namespace ehs
AddType("Str");
}
/// A move constructor.
Str(Str&& str) noexcept
: BaseObj((BaseObj&&)str), size(str.size), data(str.data)
{
@ -158,7 +159,7 @@ namespace ehs
/// Concatenates with the given C-style string.
/// @param [in] str The given C-style string.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N>& operator+=(const T* const str)
{
N inputSize = Len(str);
@ -180,7 +181,7 @@ namespace ehs
/// Concatenates with the given string object.
/// @param [in] str The given string object.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N>& operator+=(const Str<T, N>& str)
{
T* result = new T[size + str.size + 1];
@ -200,7 +201,7 @@ namespace ehs
/// Concatenates with the given number.
/// @param [in] num The given number to concatenate.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N>& operator+=(const SInt_64 num)
{
return operator+=(FromNum(num));
@ -208,7 +209,7 @@ namespace ehs
/// Concatenates with the given number.
/// @param [in] num The given number to concatenate.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N>& operator+=(const UInt_64 num)
{
return operator+=(FromNum(num));
@ -216,7 +217,7 @@ namespace ehs
/// Concatenates with the given number.
/// @param [in] num The given number to concatenate.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N>& operator+=(const SInt_32 num)
{
return operator+=(FromNum(num));
@ -224,7 +225,7 @@ namespace ehs
/// Concatenates with the given number.
/// @param [in] num The given number to concatenate.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N>& operator+=(const UInt_32 num)
{
return operator+=(FromNum(num));
@ -232,7 +233,7 @@ namespace ehs
/// Concatenates with the given number.
/// @param [in] num The given number to concatenate.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N>& operator+=(const SInt_16 num)
{
return operator+=(FromNum(num));
@ -240,7 +241,7 @@ namespace ehs
/// Concatenates with the given number.
/// @param [in] num The given number to concatenate.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N>& operator+=(const UInt_16 num)
{
return operator+=(FromNum(num));
@ -248,7 +249,7 @@ namespace ehs
/// Concatenates with the given number.
/// @param [in] num The given number to concatenate.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N>& operator+=(const SInt_8 num)
{
return operator+=(FromNum(num));
@ -256,7 +257,7 @@ namespace ehs
/// Concatenates with the given number.
/// @param [in] num The given number to concatenate.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N>& operator+=(const UInt_8 num)
{
return operator+=(FromNum(num));
@ -282,7 +283,7 @@ namespace ehs
/// Concatenates with the given number.
/// @param [in] num The given number to concatenate.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N>& operator+=(const float num)
{
return operator+=(FromNum(num));
@ -290,7 +291,7 @@ namespace ehs
/// Concatenates with the given number.
/// @param [in] num The given number to concatenate.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N>& operator+=(const double num)
{
return operator+=(FromNum(num));
@ -298,7 +299,7 @@ namespace ehs
/// Concatenates with the given number.
/// @param [in] num The given number to concatenate.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N>& operator+=(const long double num)
{
return operator+=(FromNum(num));
@ -306,7 +307,7 @@ namespace ehs
/// Concatenates with the given C-style string.
/// @param [in] str The given C-style string.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N> operator+(const T* const str) const
{
N inSize = Len(str);
@ -324,7 +325,7 @@ namespace ehs
/// Concatenates with the given string object.
/// @param [in] str The given string object.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N> operator+(const Str<T, N>& str) const
{
Str<T, N> result(size + str.size);
@ -339,64 +340,64 @@ namespace ehs
}
/// Concatenates with the given number.
/// @param [in] str The given number to Concatenate.
/// @returns The result.
/// @param [in] num The given number to Concatenate.
/// @returns The resulting string object.
Str<T, N> operator+(const SInt_64 num) const
{
return operator+(FromNum(num));
}
/// Concatenates with the given number.
/// @param [in] str The given number to Concatenate.
/// @returns The result.
/// @param [in] num The given number to Concatenate.
/// @returns The resulting string object.
Str<T, N> operator+(const UInt_64 num) const
{
return operator+(FromNum(num));
}
/// Concatenates with the given number.
/// @param [in] str The given number to Concatenate.
/// @returns The result.
/// @param [in] num The given number to Concatenate.
/// @returns The resulting string object.
Str<T, N> operator+(const SInt_32 num) const
{
return operator+(FromNum(num));
}
/// Concatenates with the given number.
/// @param [in] str The given number to Concatenate.
/// @returns The result.
/// @param [in] num The given number to Concatenate.
/// @returns The resulting string object.
Str<T, N> operator+(const UInt_32 num) const
{
return operator+(FromNum(num));
}
/// Concatenates with the given number.
/// @param [in] str The given number to Concatenate.
/// @returns The result.
/// @param [in] num The given number to Concatenate.
/// @returns The resulting string object.
Str<T, N> operator+(const SInt_16 num) const
{
return operator+(FromNum(num));
}
/// Concatenates with the given number.
/// @param [in] str The given number to Concatenate.
/// @returns The result.
/// @param [in] num The given number to Concatenate.
/// @returns The resulting string object.
Str<T, N> operator+(const UInt_16 num) const
{
return operator+(FromNum(num));
}
/// Concatenates with the given number.
/// @param [in] str The given number to Concatenate.
/// @returns The result.
/// @param [in] num The given number to Concatenate.
/// @returns The resulting string object.
Str<T, N> operator+(const SInt_8 num) const
{
return operator+(FromNum(num));
}
/// Concatenates with the given number.
/// @param [in] str The given number to Concatenate.
/// @returns The result.
/// @param [in] num The given number to Concatenate.
/// @returns The resulting string object.
Str<T, N> operator+(const UInt_8 num) const
{
return operator+(FromNum(num));
@ -421,29 +422,32 @@ namespace ehs
#endif
/// Concatenates with the given number.
/// @param [in] str The given number to Concatenate.
/// @returns The result.
/// @param [in] num The given number to Concatenate.
/// @returns The resulting string object.
Str<T, N> operator+(const float num) const
{
return operator+(FromNum(num));
}
/// Concatenates with the given number.
/// @param [in] str The given number to Concatenate.
/// @returns The result.
/// @param [in] num The given number to Concatenate.
/// @returns The resulting string object.
Str<T, N> operator+(const double num) const
{
return operator+(FromNum(num));
}
/// Concatenates with the given number.
/// @param [in] str The given number to Concatenate.
/// @returns The result.
/// @param [in] num The given number to Concatenate.
/// @returns The resulting string object.
Str<T, N> operator+(const long double num) const
{
return operator+(FromNum(num));
}
/// Compares with a another string. First comparing sizes.
/// @param [in] str The string object to compare with.
/// @returns Whether or not they are equal.
bool operator==(T* str) const
{
if (size != Len(str))
@ -535,7 +539,7 @@ namespace ehs
return size;
}
/// Finds a null terminator in the string and makes it the exact size if greater than.
/// Finds the null terminator in the string and makes it the exact size if greater than.
void ExactSize()
{
size = Len(data);
@ -594,6 +598,9 @@ namespace ehs
Util::Copy(data[dstOffset], src, srcSize * sizeof(T));
}
/// Inserts a string at a specified index.
/// @param [in] index The index to insert the string at.
/// @param [in] value The string to insert.
void Insert(const N index, const Str& value)
{
if (!value.size)
@ -616,6 +623,9 @@ namespace ehs
size = newSize;
}
/// Inserts a character at a specified index.
/// @param [in] index The index to insert the character at.
/// @param [in] value The character to insert.
void Insert(const N index, const T value)
{
N newSize = 0;
@ -641,6 +651,10 @@ namespace ehs
size = newSize;
}
/// Removes characters withing the given range.
/// @param [in] start The index to start.
/// @param [in] end The index to end.
/// @returns The removed string object.
Str Remove(const N start, const N end)
{
if (!size || start >= size || end > size || end <= start)
@ -664,6 +678,9 @@ namespace ehs
return popped;
}
/// Removes a character at the given index.
/// @param [in] index The index to remove a character.
/// @returns The character removed.
T Remove(const N index)
{
T popped = {};
@ -691,7 +708,6 @@ namespace ehs
/// Adds a value at the end of the string.
/// @param [in] value The character to push to the end of the string.
/// @note Automatically moves the null terminator after the value is pushed.
void Push(const Str<T, N> &value)
{
T* result = new T[size + value.size + 1];
@ -709,7 +725,6 @@ namespace ehs
/// Adds a value at the end of the string.
/// @param [in] value The C-style string to push to the end of the string.
/// @param [in] size The size of the given C-style string.
/// @note Automatically moves the null terminator after the value is pushed.
void Push(const T* const value, const N size)
{
T* result = new T[this->size + size + 1];
@ -726,7 +741,6 @@ namespace ehs
/// Adds a value at the end of the string.
/// @param [in] value The C-style string to push to the end of the string.
/// @note Automatically moves the null terminator after the value is pushed.
void Push(const T* const value)
{
N inSize = Len(value);
@ -745,7 +759,6 @@ namespace ehs
/// Adds a value at the end of the string.
/// @param [in] value The character to push to the end of the string.
/// @note Automatically moves the null terminator after the value is pushed.
void Push(const T value)
{
T* result = new T[size + 2];
@ -761,7 +774,7 @@ namespace ehs
++size;
}
/// Removes a value at the end of the array.
/// Removes the value at the end of the array.
/// @returns The value that was popped.
T Pop()
{
@ -794,7 +807,7 @@ namespace ehs
return (Byte*)data;
}
/// Changes all upper-case ASCII characters to lower-case.
/// Converts all upper-case ASCII characters to lower-case.
void ToLower()
{
for (N i = 0; i < size; ++i)
@ -802,8 +815,8 @@ namespace ehs
data[i] += 32;
}
/// Changes all upper-case ASCII characters to lower-case.
/// @returns The result.
/// Converts all upper-case ASCII characters to lower-case.
/// @returns The resulting string object.
Str<T, N> GetLower() const
{
Str<T, N> result(size);
@ -817,7 +830,7 @@ namespace ehs
return result;
}
/// Changes all lower-case ASCII characters to upper-case.
/// Converts all lower-case ASCII characters to upper-case.
void ToUpper()
{
for (N i = 0; i < size; ++i)
@ -825,8 +838,8 @@ namespace ehs
data[i] -= 32;
}
/// Changes all lower-case ASCII characters to upper-case.
/// @returns The result.
/// Converts all lower-case ASCII characters to upper-case.
/// @returns The resulting string object.
Str<T, N> GetUpper() const
{
Str<T, N> result(size);
@ -840,7 +853,7 @@ namespace ehs
return result;
}
/// Reverses the entire referenced string object.
/// Reverses the entire string object.
void Reverse()
{
if (size <= 1 || !data)
@ -859,7 +872,7 @@ namespace ehs
}
/// Reverses the entire string object.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N> GetReverse()
{
if (size <= 1 || !data)
@ -876,7 +889,7 @@ namespace ehs
/// Clips the string at the given index and with the given size.
/// @param [in] index The index to clip at.
/// @param [in] size The size for the clip starting from the index.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N> Sub(const N index, const N size = 0) const
{
if (index >= this->size)
@ -911,10 +924,10 @@ namespace ehs
}
}
/// Splits a string into an array with the given separator.
/// Splits a string into a Vector with the given separator.
/// @param [in] ide The given string as the separator.
/// @param [in] max The max amount of times to split the string.
/// @returns The result.
/// @returns The resulting string object.
Vector<Str<T, N>, N> Split(const Str<T, N>& ide, const N max = 0) const
{
Vector<Str<T, N>, N> result(0, 5);
@ -952,9 +965,9 @@ namespace ehs
return result;
}
/// Removes all instances of the given string object.
/// Removes all instances of the ide.
/// @param [in] ide The string to look for.
/// @returns The result.
/// @returns The resulting string object.
Str<T, N> RemoveAll(const Str<T, N>& ide) const
{
Str<T, N> result(size);
@ -981,6 +994,10 @@ namespace ehs
return result;
}
/// Replaces all instances of ide with the replacer.
/// @param [in] ide The string to look for.
/// @param [in] replacer The string placed.
/// @returns The resulting string object.
Str ReplaceAll(const Str& ide, const Str& replacer) const
{
Str<T, N> result;
@ -1068,6 +1085,10 @@ namespace ehs
return false;
}
/// Checks if the current string contains the given ide.
/// @param [in] ide The given ide to check for.
/// @param [in] pattern The search pattern to use.
/// @returns True if the current string does contain the ide.
bool Contains(const Str<T, N>& ide, const SearchPattern pattern = SearchPattern::LEFT_RIGHT) const
{
if (pattern == SearchPattern::LEFT_RIGHT)
@ -1117,6 +1138,10 @@ namespace ehs
return true;
}
/// Converts a number into hexadecimal string representation.
/// @tparam I The data type of the number given.
/// @param [in] num The number to convert.
/// @returns The resulting hexadecimal.
template<typename I = int>
static Str NumToHex(const I num)
{
@ -1133,6 +1158,10 @@ namespace ehs
return result;
}
/// Converts a string hexadecimal into a number.
/// @tparam I The data type of the number outputted.
/// @param [in] in The string to convert.
/// @returns The resulting number.
template<typename I = int>
static I HexToNum(const Str& in)
{
@ -1173,6 +1202,9 @@ namespace ehs
return neg ? -acc : acc;
}
/// Converts the current string from hexadecimal into a number.
/// @tparam I The data type of the number outputted.
/// @returns The resulting number.
template<typename I = int>
I HexToNum() const
{
@ -1216,7 +1248,7 @@ namespace ehs
/// Converts the string into a number.
/// @tparam I The resulting number's data type.
/// @returns The result.
/// @note Use "IsNum" before this if the referenced string object will not always be a number.
/// @note Use "IsNum" before this if the string object is not guaranteed to be a number.
template<typename I = N>
I ToDecimal() const
{
@ -1234,6 +1266,9 @@ namespace ehs
return r;
}
/// Converts the string into a floating point number.
/// @returns The resulting float.
/// @note Use "IsNum" before this if the string object is not guaranteed to be a number.
float ToFloat() const
{
N decPoint = size;
@ -1257,6 +1292,9 @@ namespace ehs
return result;
}
/// Converts the string into a double floating point number.
/// @returns The resulting double.
/// @note Use "IsNum" before this if the string object is not guaranteed to be a number.
double ToDouble() const
{
N decPoint = size;
@ -1280,6 +1318,9 @@ namespace ehs
return result;
}
/// Converts the string into a long double floating point number.
/// @returns The resulting long double.
/// @note Use "IsNum" before this if the string object is not guaranteed to be a number.
long double ToLDouble() const
{
N decPoint = size;
@ -1304,7 +1345,8 @@ namespace ehs
}
/// Converts the given number into a string.
/// @returns The result.
/// @param [in] num The given number to convert.
/// @returns The resulting string representation.
static Str<T, N> FromNum(const SInt_64 num)
{
if (num == 0)
@ -1339,7 +1381,8 @@ namespace ehs
}
/// Converts the given number into a string.
/// @returns The result.
/// @param [in] num The given number to convert.
/// @returns The resulting string representation.
static Str<T, N> FromNum(const UInt_64 num)
{
if (num == 0)
@ -1367,7 +1410,8 @@ namespace ehs
}
/// Converts the given number into a string.
/// @returns The result.
/// @param [in] num The given number to convert.
/// @returns The resulting string representation.
static Str<T, N> FromNum(const SInt_32 num)
{
if (num == 0)
@ -1402,7 +1446,8 @@ namespace ehs
}
/// Converts the given number into a string.
/// @returns The result.
/// @param [in] num The given number to convert.
/// @returns The resulting string representation.
static Str<T, N> FromNum(const UInt_32 num)
{
if (num == 0)
@ -1430,7 +1475,8 @@ namespace ehs
}
/// Converts the given number into a string.
/// @returns The result.
/// @param [in] num The given number to convert.
/// @returns The resulting string representation.
static Str<T, N> FromNum(const SInt_16 num)
{
if (num == 0)
@ -1465,7 +1511,8 @@ namespace ehs
}
/// Converts the given number into a string.
/// @returns The result.
/// @param [in] num The given number to convert.
/// @returns The resulting string representation.
static Str<T, N> FromNum(const UInt_16 num)
{
if (num == 0)
@ -1493,7 +1540,8 @@ namespace ehs
}
/// Converts the given number into a string.
/// @returns The result.
/// @param [in] num The given number to convert.
/// @returns The resulting string representation.
static Str<T, N> FromNum(const SInt_8 num)
{
if (num == 0)
@ -1528,7 +1576,8 @@ namespace ehs
}
/// Converts the given number into a string.
/// @returns The result.
/// @param [in] num The given number to convert.
/// @returns The resulting string representation.
static Str<T, N> FromNum(const UInt_8 num)
{
if (num == 0)
@ -1620,8 +1669,10 @@ namespace ehs
}
#endif
/// Converts the given float into a string.
/// @returns The result.
/// Converts the given floating point into a string.
/// @param [in] num The given floating point to convert.
/// @param [in] maxDecimals The max decimal places to add.
/// @returns The resulting string representation.
static Str<T, N> FromNum(const float num, const UInt_8 maxDecimals = 5)
{
SInt_64 whole = (SInt_64)num;
@ -1660,8 +1711,10 @@ namespace ehs
return result;
}
/// Converts the given double into a string.
/// @returns The result.
/// Converts the given double floating point into a string.
/// @param [in] num The given double floating point to convert.
/// @param [in] maxDecimals The max decimal places to add.
/// @returns The resulting string representation.
static Str<T, N> FromNum(const double num, const UInt_8 maxDecimals = 5)
{
SInt_64 whole = (SInt_64)num;
@ -1700,8 +1753,10 @@ namespace ehs
return result;
}
/// Converts the given long double into a string.
/// @returns The result.
/// Converts the given long double floating point into a string.
/// @param [in] num The given long double floating point to convert.
/// @param [in] maxDecimals The max decimal places to add.
/// @returns The resulting string representation.
static Str<T, N> FromNum(const long double num, const UInt_8 maxDecimals = 5)
{
SInt_64 whole = (SInt_64)num;
@ -1742,7 +1797,7 @@ namespace ehs
/// A 32-bit FNV-1a hash algorithm.
/// @param [in] str The string to hash.
/// @returns The resulting hash.
/// @returns The resulting hash. Zero if string does not contain any characters.
static UInt_32 Hash_32(const Str<T, N>& str)
{
if (!str.Size())
@ -1758,6 +1813,8 @@ namespace ehs
return hash;
}
/// A 32-bit FNV-1a hash algorithm.
/// @returns The resulting hash. Zero if string does not contain any characters.
UInt_32 Hash_32() const
{
if (!size)
@ -1775,7 +1832,7 @@ namespace ehs
/// A 64-bit FNV-1a hash algorithm.
/// @param [in] str The string to hash.
/// @returns The resulting hash.
/// @returns The resulting hash. Zero if string does not contain any characters.
static UInt_64 Hash_64(const Str<T, N>& str)
{
if (!str.Size())
@ -1791,6 +1848,8 @@ namespace ehs
return hash;
}
/// A 64-bit FNV-1a hash algorithm.
/// @returns The resulting hash. Zero if string does not contain any characters.
UInt_64 Hash_64() const
{
if (!size)
@ -1806,6 +1865,9 @@ namespace ehs
return hash;
}
/// Calculates the length of a C-Style string.
/// @param [in] str The C-Style string to calculate.
/// @returns The character count.
static N Len(const T* const str)
{
N count = 0;
@ -1814,6 +1876,10 @@ namespace ehs
return count;
}
/// Compares two C-style string with each other.
/// @param [in] a The first C-style string to compare.
/// @param [in] b The second C-style string to compare.
/// @returns True if both C-style strings are equal.
static bool Cmp(const T* const a, const T* const b)
{
N aSize = Len(a);

View File

@ -17,6 +17,8 @@ namespace ehs
public:
Type();
/// Constructs the object with the given class name.
/// @param [in] id The class name.
explicit Type(const Char_8* id);
Type(Type&& type) noexcept;
@ -39,12 +41,20 @@ namespace ehs
bool operator!=(const Char_8* inStr) const;
/// Retrieves the name size.
/// @returns The size.
UInt_64 GetSize() const;
/// Retrieves the name.
/// @returns The name.
const Char_8* GetId() const;
/// Retrieves the hashed name.
/// @returns The hashed name.
UInt_64 GetHashId() const;
/// Whether or not this object was properly constructed.
/// @returns The result.
bool IsValid() const;
private:

View File

@ -8,8 +8,14 @@ namespace ehs
class URI
{
public:
/// Encodes specialized characters in the URI.
/// @param [in] in The URI to encode.
/// @returns The encoded URI.
static Str_8 Encode(const Str_8& in);
/// Decodes specialized characters back into their readable format.
/// @param [in] in The URI to decode.
/// @returns The decoded URI.
static Str_8 Decode(const Str_8& in);
};
}

View File

@ -259,6 +259,8 @@ namespace ehs
return stride;
}
/// Retrieves the index at the end of the array.
/// @returns The index.
N End() const
{
return size ? size - 1 : size;
@ -617,7 +619,7 @@ namespace ehs
}
}
/// Clears all values in the vector object.
/// Releases the resources of the vector.
void Clear()
{
if (!size)

View File

@ -14,10 +14,10 @@ namespace ehs
protected:
AddrType addrType;
Str_8 localAddr;
unsigned short localPort;
UInt_16 localPort;
Str_8 remoteHostName;
Str_8 remoteAddr;
unsigned short remotePort;
UInt_16 remotePort;
bool connection;
bool bound;
bool listening;
@ -30,9 +30,12 @@ namespace ehs
virtual ~BaseTCP() = default;
/// Initializes the socket with the defaults.
BaseTCP();
BaseTCP(const AddrType addrType);
/// Properly initializes the socket.
/// @param [in] type The ip version to initialize the socket with.
BaseTCP(AddrType addrType);
BaseTCP(BaseTCP&& tcp) noexcept;
@ -42,22 +45,45 @@ namespace ehs
BaseTCP& operator=(const BaseTCP& tcp);
/// Explicitly initialize the socket.
virtual void Initialize() = 0;
/// Explicitly release resources before it falls off the stack.
virtual void Release() = 0;
virtual void Bind(const Str_8& address, unsigned short port) = 0;
/// Binds to socket to a specified address and port.
/// @param [in] address The ip address to bind to.
/// @param [in] port The port to bind to.
/// @note Used for servers.
virtual void Bind(const Str_8& address, UInt_16 port) = 0;
/// Listens for new incoming connections.
/// @note Used for servers.
virtual void Listen() = 0;
/// Accepts the new incoming connection.
/// @note Used for servers.
virtual BaseTCP* Accept() = 0;
virtual void Connect(const Str_8& address, const unsigned short port) = 0;
/// Connects to a server at the specified address and port.
/// @param [in] address The ip address to connect to.
/// @param [in] port The port to connect to.
/// @note Used for clients.
virtual void Connect(const Str_8& address, UInt_16 port) = 0;
virtual UInt_64 Send(const Byte* const buffer, const UInt_32 size) = 0;
/// Sends data to the connected endpoint.
/// @param [in] buffer The data to send to the endpoint.
/// @param [in] size The size in bytes of data being sent.
virtual UInt_64 Send(const Byte* buffer, UInt_32 size) = 0;
virtual UInt_64 Receive(Byte* const buffer, const UInt_32 size) = 0;
/// Receives data from the connected endpoint.
/// @param [out] buffer The incoming data from the endpoint.
/// @param [in] size The max size of the buffer in bytes to store the data.
/// @returns The size of the incoming data in bytes.
virtual UInt_64 Receive(Byte* buffer, UInt_32 size) = 0;
/// Sends a string to the connected endpoint.
/// @param [in] str The string to send to the endpoint.
void SendStr(const Str_8& str);
/// Sends a HTTP response to the connected endpoint.
@ -76,37 +102,61 @@ namespace ehs
/// @returns The request received.
Request RecvReq();
/// Retrieves the sockets ip version.
/// @returns The ip version.
AddrType GetAddressType() const;
/// Retrieves the bound ip address.
/// @returns The ip address.
Str_8 GetLocalAddress() const;
/// Retrieves the bound port.
/// @returns The port.
unsigned short GetLocalPort() const;
/// Retrieves the ip address of the connected endpoint.
/// @returns The ip address.
Str_8 GetRemoteAddress() const;
unsigned short GetRemotePort() const;
/// Retrieves the port of the connected endpoint.
/// @returns The port.
UInt_16 GetRemotePort() const;
/// Retrieves whether or not this socket is connected to a client endpoint.
/// @returns The result.
bool IsConnection() const;
/// Retrieves whether of not this socket is bound to an ip address and port.
/// @returns The result.
bool IsBound() const;
/// Retrieves whether or not this socket is listening for incoming connections.
/// @returns The result.
bool IsListening() const;
/// Retrieves whether or not this socket is connected to an endpoint.
/// @returns The result.
bool IsConnected() const;
virtual void SetBlocking(const bool blocking) = 0;
/// Sets whether or not the socket blocks the thread when receiving data.
/// @param [in] blocking Whether or not to block.
virtual void SetBlocking(bool blocking) = 0;
/// Retrieves whether or not when receiving data blocks the thread.
/// @returns The result.
virtual bool IsBlocking() const = 0;
/// Retrieves whether or not this socket was initialized.
/// @returns The result.
virtual bool IsValid() const = 0;
private:
Str_8 RecvHeader();
Str_8 RecvBody(const UInt_64 contentLength);
Str_8 RecvBody(UInt_64 contentLength);
UInt_64 RecvChunkSize();
Str_8 RecvChunk(const UInt_64 chunkSize);
Str_8 RecvChunk(UInt_64 chunkSize);
};
}

View File

@ -17,8 +17,11 @@ namespace ehs
public:
virtual ~BaseUDP() = default;
/// Initializes the socket with the defaults.
BaseUDP();
/// Properly initializes the socket.
/// @param [in] type The ip version to initialize the socket with.
BaseUDP(AddrType type);
BaseUDP(BaseUDP&& udp) noexcept;
@ -29,26 +32,57 @@ namespace ehs
BaseUDP& operator=(const BaseUDP& udp);
/// Explicitly release resources before it falls off the stack.
virtual void Release() = 0;
/// Binds to socket to a specified address and port.
/// @param [in] type The ip version to use.
/// @param [in] address The ip address to bind to.
/// @param [in] port The port to bind to.
/// @note Used for servers.
virtual void Bind(AddrType type, const Str_8& address, UInt_16 port) = 0;
/// Sends data to the endpoint.
/// @param [in] type The ip version of the endpoint.
/// @param [in] address The ip address of the endpoint.
/// @param [in] port The port of the endpoint is bound to.
virtual UInt_64 Send(AddrType type, const Str_8& address, UInt_16 port, const Byte* data, UInt_64 size) = 0;
/// Receives data from the endpoint.
/// @param [out] type The ip version of the endpoint.
/// @param [out] address The ip address of the endpoint.
/// @param [out] port The port of the endpoint.
/// @param [out] data The incoming data from the endpoint.
/// @param [in] size The max size of the buffer in bytes to store the data.
/// @returns The size of the incoming data in bytes.
virtual UInt_64 Receive(AddrType* type, Str_8* address, UInt_16* port, Byte* data, UInt_64 size) = 0;
/// Retrieves whether or not this socket is bound to an ip address and port.
/// @returns The result.
bool IsBound() const;
/// Sets whether or not the socket blocks the thread when receiving data.
/// @param [in] blocking Whether or not to block.
virtual void SetBlocking(bool blocking) = 0;
/// Retrieves whether or not when receiving data blocks the thread.
/// @returns The result.
virtual bool IsBlocking() const = 0;
/// Retrieves the bound ip version.
/// @returns The result.
AddrType GetLocalAddressType() const;
/// Retrieves the bound ip address.
/// @returns The bound ip address.
Str_8 GetLocalAddress() const;
/// Retrieves the bound port.
/// @returns The bound port.
UInt_16 GetLocalPort() const;
/// Retrieves whether or not this socket was initialized.
/// @returns The result.
virtual bool IsValid() const = 0;
};
}

View File

@ -9,6 +9,9 @@ namespace ehs
class DNS
{
public:
static Str_8 Resolve(const AddrType addrType, const Str_8& hostName);
/// Resolves a hostname to an ip address.
/// @param [in] hostname The given hostname to resolve.
/// @returns The resulting ip address.
static Str_8 Resolve(const Str_8& hostname);
};
}

View File

@ -22,7 +22,7 @@ namespace ehs
/// Default members initialization.
TCP();
TCP(const AddrType addrType);
TCP(AddrType addrType);
TCP(TCP&& tcp) noexcept;
@ -46,7 +46,7 @@ namespace ehs
/// @param [in] address The local IPv4 or IPv6 address to bind to. Resolves domain names. The given address can be empty, "127.0.0.1", or "localhost" to automatically find the appropriate device.
/// @param [in] port The port to bind to.
/// @note Requires the port given to be forwarded if this is called.
void Bind(const Str_8& address, unsigned short port) override;
void Bind(const Str_8& address, UInt_16 port) override;
/// Listens for incoming connections. Used for servers or PtP.
void Listen() override;
@ -58,23 +58,23 @@ namespace ehs
/// Connects to a TCP Socket that listens for incoming connections. Used for clients or PtP.
/// @param address The address of the listening TCP socket. Resolves domain names. The given address can be empty, "127.0.0.1", or "localhost" to automatically find the appropriate device.
/// @param port The port of the listening TCP socket.
void Connect(const Str_8& address, const unsigned short port) override;
void Connect(const Str_8& address, UInt_16 port) override;
/// Sends data in a C-style array with raw functionality. Meaning no internal help outside of native functions besides error checking.
/// @param [in] buffer The C-style array to send.
/// @param [in] size The size of the given C-style array.
/// @returns The size of the data actually sent in bytes.
UInt_64 Send(const Byte* const buffer, const UInt_32 size) override;
UInt_64 Send(const Byte* buffer, UInt_32 size) override;
/// Receives data in a C-style array with raw functionality. Meaning no internal help outside of native functions besides error checking.
/// @param [out] buffer The C-style array to receive with.
/// @param [in] size The size of the given C-style array.
/// @returns The size of the data actually received in bytes.
UInt_64 Receive(Byte* const buffer, const UInt_32 size) override;
UInt_64 Receive(Byte* buffer, UInt_32 size) override;
/// Sets whether or not receiving data blocks the next task.
/// @param [in] blocking Whether or not to block.
void SetBlocking(const bool blocking) override;
void SetBlocking(bool blocking) override;
/// Retrieves whether or not this socket will block when receiving data.
/// @returns The result.
@ -83,12 +83,12 @@ namespace ehs
bool IsValid() const override;
private:
void Bind_v6(const Str_8& address, unsigned short port);
void Bind_v6(const Str_8& address, UInt_16 port);
void Bind_v4(const Str_8& address, unsigned short port);
void Bind_v4(const Str_8& address, UInt_16 port);
void Connect_v6(const Str_8& address, unsigned short port);
void Connect_v6(const Str_8& address, UInt_16 port);
void Connect_v4(const Str_8& address, unsigned short port);
void Connect_v4(const Str_8& address, UInt_16 port);
};
}

View File

@ -46,7 +46,7 @@ namespace ehs
/// @param [in] address The local IPv4 or IPv6 address to bind to. Resolves domain names. The given address can be empty, "127.0.0.1", or "localhost" to automatically find the appropriate device.
/// @param [in] port The port to bind to.
/// @note Requires the port given to be forwarded if this is called.
void Bind(const Str_8& address, unsigned short port) override;
void Bind(const Str_8& address, UInt_16 port) override;
/// Listens for incoming connections. Used for servers or PtP.
void Listen() override;
@ -58,23 +58,23 @@ namespace ehs
/// Connects to a TCP Socket that listens for incoming connections. Used for clients or PtP.
/// @param address The address of the listening TCP socket. Resolves domain names. The given address can be empty, "127.0.0.1", or "localhost" to automatically find the appropriate device.
/// @param port The port of the listening TCP socket.
void Connect(const Str_8& address, const unsigned short port) override;
void Connect(const Str_8& address, UInt_16 port) override;
/// Sends data in a C-style array with raw functionality. Meaning no internal help outside of native functions besides error checking.
/// @param [in] buffer The C-style array to send.
/// @param [in] size The size of the given C-style array.
/// @returns The size of the data actually sent in bytes.
UInt_64 Send(const Byte* const buffer, const UInt_32 size) override;
UInt_64 Send(const Byte* buffer, UInt_32 size) override;
/// Receives data in a C-style array with raw functionality. Meaning no internal help outside of native functions besides error checking.
/// @param [out] buffer The C-style array to receive with.
/// @param [in] size The size of the given C-style array.
/// @returns The size of the data actually received in bytes.
UInt_64 Receive(Byte* const buffer, const UInt_32 size) override;
UInt_64 Receive(Byte* buffer, UInt_32 size) override;
/// Sets whether or not receiving data blocks the next task.
/// @param [in] blocking Whether or not to block.
void SetBlocking(const bool blocking) override;
void SetBlocking(bool blocking) override;
/// Retrieves whether or not this socket will block when receiving data.
/// @returns The result.
@ -83,12 +83,12 @@ namespace ehs
bool IsValid() const override;
private:
void Bind_v6(const Str_8& address, unsigned short port);
void Bind_v6(const Str_8& address, UInt_16 port);
void Bind_v4(const Str_8& address, unsigned short port);
void Bind_v4(const Str_8& address, UInt_16 port);
void Connect_v6(const Str_8& address, unsigned short port);
void Connect_v6(const Str_8& address, UInt_16 port);
void Connect_v4(const Str_8& address, unsigned short port);
void Connect_v4(const Str_8& address, UInt_16 port);
};
}

View File

@ -1,6 +1,7 @@
#include "ehs/EHS.h"
#include "ehs/Log.h"
#include "ehs/Version.h"
#include "ehs/io/Console.h"
#include "ehs/GarbageCollector.h"
#include "ehs/io/audio/Audio.h"
#include "ehs/io/img/Img.h"
@ -620,8 +621,30 @@ namespace ehs
}
}
void LogRaised(const ehs::Log& log)
{
ehs::Array<ehs::Str_8> tags = log.GetTags();
ehs::Str_8 result = "{";
for (ehs::UInt_32 i = 0; i < tags.Size(); ++i)
{
result += tags[i];
if (i != tags.Size() - 1)
result += ", ";
}
result += "} (" + ehs::Str_8::FromNum(log.GetCode()) + "): " + log.GetMsg();
ehs::Console::Write_8(result);
}
int main()
{
ehs::Console::Attach();
ehs::Log::SetCallback(LogRaised);
ehs::Audio::AddCodec({
"Waveform Audio",
"wav",

View File

@ -8,8 +8,6 @@ ehs::Int_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer
*appVerId = "Release";
*appVer = {1, 0, 0};
ehs::Console::Attach();
ehs::Vector<ehs::Str_8> args = ehs::Console::GetArgs_8();
if (args.Size() > 1)

View File

@ -12,7 +12,7 @@
namespace ehs
{
Str_8 DNS::Resolve(const AddrType addrType, const Str_8& hostName)
Str_8 DNS::Resolve(const Str_8& hostname)
{
#if defined(EHS_OS_WINDOWS)
WSADATA data = {};
@ -25,15 +25,9 @@ namespace ehs
}
#endif
addrinfo hints = {};
if (addrType == AddrType::IPV6)
hints.ai_family = AF_INET6;
else if (addrType == AddrType::IPV4)
hints.ai_family = AF_INET;
addrinfo* result = nullptr;
Int_32 code = getaddrinfo(hostName, nullptr, &hints, &result);
Int_32 code = getaddrinfo(hostname, nullptr, nullptr, &result);
if (code)
{
EHS_LOG_INT("Error", 1, "Failed to resolve host with error #" + Str_8::FromNum(code) + ".");
@ -49,22 +43,26 @@ namespace ehs
#endif
if (addrType == AddrType::IPV6)
if (result->ai_family == AF_INET6)
{
Char_8 ipResult[INET6_ADDRSTRLEN];
Str_8 ipResult(INET6_ADDRSTRLEN);
inet_ntop(result->ai_family, &((sockaddr_in6*)result->ai_addr)->sin6_addr, ipResult, INET6_ADDRSTRLEN);
ipResult.ExactSize();
freeaddrinfo(result);
return ipResult;
}
else if (addrType == AddrType::IPV4)
else if (result->ai_family == AF_INET)
{
Char_8 ipResult[INET_ADDRSTRLEN];
Str_8 ipResult(INET_ADDRSTRLEN);
inet_ntop(result->ai_family, &((sockaddr_in*)result->ai_addr)->sin_addr, ipResult, INET_ADDRSTRLEN);
ipResult.ExactSize();
freeaddrinfo(result);
return ipResult;

View File

@ -114,7 +114,7 @@ namespace ehs
hdl = EHS_INVALID_SOCKET;
}
void TCP::Bind(const Str_8& address, unsigned short port)
void TCP::Bind(const Str_8& address, UInt_16 port)
{
if (!IsValid() || bound || connection)
return;
@ -207,13 +207,13 @@ namespace ehs
return client;
}
void TCP::Connect(const Str_8& address, const unsigned short port)
void TCP::Connect(const Str_8& address, const UInt_16 port)
{
if (connection || !IsValid() || listening)
return;
remoteHostName = address;
remoteAddr = DNS::Resolve(addrType, address);
remoteAddr = DNS::Resolve(address);
remotePort = port;
if (addrType == AddrType::IPV6)
@ -331,7 +331,7 @@ namespace ehs
return hdl != EHS_INVALID_SOCKET;
}
void TCP::Bind_v6(const Str_8& address, unsigned short port)
void TCP::Bind_v6(const Str_8& address, UInt_16 port)
{
sockaddr_in6 result = {};
result.sin6_family = AF_INET6;
@ -367,7 +367,7 @@ namespace ehs
}
}
void TCP::Bind_v4(const Str_8& address, unsigned short port)
void TCP::Bind_v4(const Str_8& address, UInt_16 port)
{
sockaddr_in result = {};
result.sin_family = AF_INET;
@ -402,7 +402,7 @@ namespace ehs
}
}
void TCP::Connect_v6(const Str_8& address, unsigned short port)
void TCP::Connect_v6(const Str_8& address, UInt_16 port)
{
sockaddr_in6 result = {};
result.sin6_family = AF_INET6;
@ -439,7 +439,7 @@ namespace ehs
}
}
void TCP::Connect_v4(const Str_8& address, unsigned short port)
void TCP::Connect_v4(const Str_8& address, UInt_16 port)
{
sockaddr_in result = {};
result.sin_family = AF_INET;

View File

@ -137,7 +137,7 @@ namespace ehs
connected = false;
}
void TCP::Bind(const Str_8& address, unsigned short port)
void TCP::Bind(const Str_8& address, UInt_16 port)
{
if (!IsValid() || bound || connection)
return;
@ -236,7 +236,7 @@ namespace ehs
return client;
}
void TCP::Connect(const Str_8& address, const unsigned short port)
void TCP::Connect(const Str_8& address, const UInt_16 port)
{
if (connection || !IsValid() || listening)
return;
@ -352,7 +352,7 @@ namespace ehs
return hdl != EHS_INVALID_SOCKET;
}
void TCP::Bind_v6(const Str_8& address, unsigned short port)
void TCP::Bind_v6(const Str_8& address, UInt_16 port)
{
sockaddr_in6 result = {};
result.sin6_family = AF_INET6;
@ -388,7 +388,7 @@ namespace ehs
}
}
void TCP::Bind_v4(const Str_8& address, unsigned short port)
void TCP::Bind_v4(const Str_8& address, UInt_16 port)
{
sockaddr_in result = {};
result.sin_family = AF_INET;
@ -424,7 +424,7 @@ namespace ehs
}
}
void TCP::Connect_v6(const Str_8& address, unsigned short port)
void TCP::Connect_v6(const Str_8& address, UInt_16 port)
{
sockaddr_in6 result = {};
result.sin6_family = AF_INET6;
@ -461,7 +461,7 @@ namespace ehs
}
}
void TCP::Connect_v4(const Str_8& address, unsigned short port)
void TCP::Connect_v4(const Str_8& address, UInt_16 port)
{
sockaddr_in result = {};
result.sin_family = AF_INET;

View File

@ -42,7 +42,7 @@ namespace ehs
TCP server(AddrType::IPV4);
server.Initialize();
server.Bind(DNS::Resolve(server.GetAddressType(), "localhost"), 65534);
server.Bind(DNS::Resolve("localhost"), 65534);
server.Listen();
System::OpenURI(uri);

View File

@ -39,7 +39,7 @@ namespace ehs
scopesFinal;
TCP server(AddrType::IPV4);
server.Bind(DNS::Resolve(client.GetAddressType(), "localhost"), 65535);
server.Bind(DNS::Resolve("localhost"), 65535);
server.Listen();
System::OpenURI(uri);

View File

@ -54,7 +54,7 @@ namespace ehs
return;
client = TCP(ehs::AddrType::IPV4);
client.Connect(DNS::Resolve(AddrType::IPV4, "irc.chat.twitch.tv"), 6667);
client.Connect(DNS::Resolve("irc.chat.twitch.tv"), 6667);
client.SetBlocking(false);
Str_8 r("PASS oauth:" + token + "\r\n");