diff options
Diffstat (limited to 'Src/WAT')
-rw-r--r-- | Src/WAT/WAT.cpp | 6 | ||||
-rw-r--r-- | Src/WAT/WAT.h | 197 | ||||
-rw-r--r-- | Src/WAT/WAT.vcxproj | 255 | ||||
-rw-r--r-- | Src/WAT/WAT.vcxproj.filters | 45 | ||||
-rw-r--r-- | Src/WAT/framework.h | 3 | ||||
-rw-r--r-- | Src/WAT/wa_bits_operation.cpp | 38 | ||||
-rw-r--r-- | Src/WAT/wa_files.cpp | 94 | ||||
-rw-r--r-- | Src/WAT/wa_logger.h | 55 | ||||
-rw-r--r-- | Src/WAT/wa_strings.cpp | 709 | ||||
-rw-r--r-- | Src/WAT/wat_nodeptr.h | 23 |
10 files changed, 1425 insertions, 0 deletions
diff --git a/Src/WAT/WAT.cpp b/Src/WAT/WAT.cpp new file mode 100644 index 00000000..6128a6c7 --- /dev/null +++ b/Src/WAT/WAT.cpp @@ -0,0 +1,6 @@ +// WAT.cpp : Defines the functions for the static library. +// +#include "framework.h" + + + diff --git a/Src/WAT/WAT.h b/Src/WAT/WAT.h new file mode 100644 index 00000000..f0889a2b --- /dev/null +++ b/Src/WAT/WAT.h @@ -0,0 +1,197 @@ +#pragma once + +#ifndef _WA_FILE_HEADER +#define _WA_FILE_HEADER + +#include <stdio.h> + +#include <sys/stat.h> +#include <string> +#include <string.h> +#include <algorithm> +#include <cstring> +#include <cstdarg> +#include <cwchar> +#include <wchar.h> +#include <fstream> +#include <io.h> +#include <iostream> +#include <streambuf> + +#include <vector> +#include <map> + +#include <cstddef> +#include <sys/stat.h> + +#define DEFAULT_STR_BUFFER_SIZE 1024 + +//namespace fs = std::experimental::filesystem; + +namespace wa +{ + namespace files + { + bool file_exists( const char *p_filename ); + bool file_exists( const std::string &p_filename ); + bool file_exists( const wchar_t *p_filename ); + + int file_size( const char *p_filename ); + int file_size( const wchar_t *p_filename ); + + bool folder_exists( const char* p_folder ); + + bool getFilenamesFromFolder( std::vector<std::string> &p_result, const std::string &p_folder_path, const std::string &p_reg_ex, const size_t p_limit = 100 ); + } + + namespace strings + { + namespace convert + { + // + // to const char* + // + const char* to_char( const wchar_t *p_message ); + const char* to_char( const std::wstring p_message ); + + + // + // to const wchar_t* + // + const wchar_t *to_wchar( const char *p_message ); + + + // + // to std::string + // + std::string to_string( const char *p_message ); + std::string to_string( const wchar_t *p_message ); + std::string to_string( const std::wstring p_message ); + + + // + // to std::wstring + // + std::wstring to_wstring( const char *p_message ); + std::wstring to_wstring( const wchar_t *p_message ); + std::wstring to_wstring( const std::string p_message ); + + } + + void replace( std::string &p_string, const std::string &p_from, const std::string &p_to ); + void replace( char *p_string, const char *p_from, const char *p_to ); + void replace( wchar_t *p_string, const wchar_t *p_from, const wchar_t *p_to ); + + void replaceAll( std::string &p_string, const std::string &p_from, const std::string &p_to ); + void replaceAll( char *p_string, const char *p_from, const char *p_to ); + void replaceAll( wchar_t *p_string, const wchar_t *p_from, const wchar_t *p_to ); + + std::string create_string( const char *Format, ... ); + std::string create_string( const wchar_t *Format, ... ); + std::string create_string( const std::string Format, ... ); + + class wa_string + { + public: + wa_string( const char *p_initial = NULL ); + wa_string( const wchar_t *p_initial = NULL ); + wa_string( const std::string &p_initial ); + wa_string( const std::wstring &p_initial ); + + void operator = ( const char *p_value ); + void operator = ( const wchar_t *p_value ); + void operator = ( const std::string &p_value ); + void operator = ( const std::wstring &p_value ); + + bool operator == ( const char *p_value ) const; + bool operator == ( const wchar_t *p_value ) const; + bool operator == ( const std::string &p_value ) const; + bool operator == ( const std::wstring &p_value ) const; + + bool operator != ( const char *p_value ) const; + bool operator != ( const wchar_t *p_value ) const; + bool operator != ( const std::string &p_value ) const; + bool operator != ( const int p_value ) const; + + wa_string operator + ( const char *p_value ); + wa_string operator + ( const wchar_t *p_value ); + wa_string operator + ( const std::string &p_value ); + wa_string operator + ( const std::wstring &p_value); + wa_string operator + ( const int p_value ); + + wa_string append( const char *p_value ); + wa_string append( const wchar_t *p_value ); + wa_string append( const std::string &p_value ); + wa_string append( const std::wstring &p_value ); + wa_string append( const wa_string p_value); + wa_string append( const int p_value ); + + const std::string GetA() const; + const std::wstring GetW() const; + + void clear() { _wa_string.clear(); } + + unsigned int lengthA() const; + unsigned int lengthW() const; + unsigned int lengthS() const; + unsigned int lengthWS() const; + + bool contains( const char *p_value ); + bool contains( const wchar_t *p_value ); + bool contains( const std::string &p_value ); + bool contains( const std::wstring &p_value ); + + wa_string replace( const char *p_from, const char *p_to ); + wa_string replace( const wchar_t *p_from, const wchar_t *p_to ); + wa_string replace( const std::string &p_from, const std::string &p_to ); + wa_string replace( const std::wstring &p_from, const std::wstring &p_to ); + + wa_string replaceAll( const char *p_from, const char *p_to ); + wa_string replaceAll( const wchar_t *p_from, const wchar_t *p_to ); + wa_string replaceAll( const std::string &p_from, const std::string &p_to ); + wa_string replaceAll( const std::wstring &p_from, const std::wstring &p_to ); + + bool startsWith( const char *l_head ) const; + bool startsWith( const wchar_t *l_head ) const; + bool startsWith( const std::string &l_head ) const; + bool startsWith( const std::wstring &l_head ) const; + + bool endsWith( const char *l_tail ) const; + bool endsWith( const wchar_t *l_tail ) const; + bool endsWith( const std::string &l_tail ) const; + bool endsWith( const std::wstring &l_tail ) const; + + int findFirst( const char *l_text ) const; + int findFirst( const wchar_t *l_text ) const; + int findFirst( const std::string &l_text ) const; + int findFirst( const std::wstring &l_text ) const; + + int findLast( const char *l_text ) const; + int findLast( const wchar_t *l_text ) const; + int findLast( const std::string &l_text ) const; + int findLast( const std::wstring &l_text ) const; + + int find( const std::wstring &l_text ) const; + + std::wstring mid( const int p_start, const int p_length ) const; + + bool empty() const { return _wa_string.empty(); } + + wa_string toUpper(); + + + private: + std::wstring _wa_string; + + }; + } + + namespace bits_operation + { + unsigned char* GetBits(unsigned char* Source, unsigned int NbrOfBits, unsigned int* BufferSize); + wa::strings::wa_string PrintInBinary(unsigned char* buffer, unsigned int size); + } +} + +#endif // !_WA_FILE_HEADER + diff --git a/Src/WAT/WAT.vcxproj b/Src/WAT/WAT.vcxproj new file mode 100644 index 00000000..0ca33a52 --- /dev/null +++ b/Src/WAT/WAT.vcxproj @@ -0,0 +1,255 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <VCProjectVersion>16.0</VCProjectVersion> + <Keyword>Win32Proj</Keyword> + <ProjectGuid>{c5714908-a71f-4644-bd95-aad8ee7914da}</ProjectGuid> + <RootNamespace>WAT</RootNamespace> + <WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v142</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v142</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Label="Vcpkg"> + <VcpkgEnableManifest>false</VcpkgEnableManifest> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <SDLCheck>true</SDLCheck> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ConformanceMode>true</ConformanceMode> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile> + </PrecompiledHeaderFile> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <SupportJustMyCode>false</SupportJustMyCode> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <AdditionalIncludeDirectories>..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem> + </SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Lib> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ConformanceMode>true</ConformanceMode> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile> + </PrecompiledHeaderFile> + <DebugInformationFormat>None</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <AdditionalIncludeDirectories>..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + <WholeProgramOptimization>false</WholeProgramOptimization> + </ClCompile> + <Link> + <SubSystem> + </SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Lib> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <SDLCheck>true</SDLCheck> + <PreprocessorDefinitions>_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ConformanceMode>true</ConformanceMode> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile> + </PrecompiledHeaderFile> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <SupportJustMyCode>false</SupportJustMyCode> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + </ClCompile> + <Link> + <SubSystem> + </SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Lib> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <PreprocessorDefinitions>NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ConformanceMode>true</ConformanceMode> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + <PrecompiledHeaderFile> + </PrecompiledHeaderFile> + <DebugInformationFormat>None</DebugInformationFormat> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WholeProgramOptimization>false</WholeProgramOptimization> + </ClCompile> + <Link> + <SubSystem> + </SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + <Lib> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Lib> + <ProjectReference> + <LinkLibraryDependencies>true</LinkLibraryDependencies> + </ProjectReference> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="framework.h" /> + <ClInclude Include="WAT.h" /> + <ClInclude Include="wa_logger.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="WAT.cpp" /> + <ClCompile Include="wat_nodeptr.h" /> + <ClCompile Include="wa_bits_operation.cpp" /> + <ClCompile Include="wa_files.cpp" /> + <ClCompile Include="wa_strings.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Src/WAT/WAT.vcxproj.filters b/Src/WAT/WAT.vcxproj.filters new file mode 100644 index 00000000..8d342dc6 --- /dev/null +++ b/Src/WAT/WAT.vcxproj.filters @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="framework.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="wa_logger.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="WAT.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="WAT.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="wa_files.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="wa_strings.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="wa_bits_operation.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="wat_nodeptr.h"> + <Filter>Header Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Src/WAT/framework.h b/Src/WAT/framework.h new file mode 100644 index 00000000..3209b4ab --- /dev/null +++ b/Src/WAT/framework.h @@ -0,0 +1,3 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers diff --git a/Src/WAT/wa_bits_operation.cpp b/Src/WAT/wa_bits_operation.cpp new file mode 100644 index 00000000..9688cfc6 --- /dev/null +++ b/Src/WAT/wa_bits_operation.cpp @@ -0,0 +1,38 @@ +#include "WAT.h" + + +unsigned char* wa::bits_operation::GetBits(unsigned char* Source, unsigned int NbrOfBits, unsigned int* BufferSize) +{ + // check for wrong parameter + if (Source == nullptr || NbrOfBits == 0 || BufferSize == nullptr) + return nullptr; + + // variable + unsigned int bitMask = 0; + unsigned int nbrOfByteToRead = 1 + (NbrOfBits-1) / 8; + unsigned char* bufferToReturn = (unsigned char*)malloc(nbrOfByteToRead); + memset(bufferToReturn, 0, nbrOfByteToRead); + *BufferSize = nbrOfByteToRead; + // copy all bytes + if (nbrOfByteToRead > 1) + { + memcpy(bufferToReturn, Source, nbrOfByteToRead - 1); + } + // copy the specific end bits + bitMask = (1 << NbrOfBits - ((nbrOfByteToRead - 1)*8)) - 1; + bufferToReturn[nbrOfByteToRead - 1] = Source[nbrOfByteToRead - 1] & bitMask; + return bufferToReturn; +} + +wa::strings::wa_string wa::bits_operation::PrintInBinary(unsigned char* buffer, unsigned int size) +{ + wa::strings::wa_string ToReturn = ""; + for (unsigned int NbrOfByte = 0; NbrOfByte < size; ++NbrOfByte) + { + for (int IndexBit = 0; IndexBit < 8; ++IndexBit) + ToReturn.append((buffer[NbrOfByte] & (1 << IndexBit)) ? "1" : "0"); + ToReturn.append(" ' "); + } + return ToReturn; + +} diff --git a/Src/WAT/wa_files.cpp b/Src/WAT/wa_files.cpp new file mode 100644 index 00000000..84e0a1fa --- /dev/null +++ b/Src/WAT/wa_files.cpp @@ -0,0 +1,94 @@ +#include "WAT.h" + +bool wa::files::file_exists( const char *p_filename ) +{ + if ( p_filename == NULL ) + return false; + + + struct stat l_buffer; + return ( stat( p_filename, &l_buffer ) == 0 ); +} + +bool wa::files::file_exists( const std::string &p_filename ) +{ + return wa::files::file_exists( p_filename.c_str() ); +} + +bool wa::files::file_exists( const wchar_t *p_filename ) +{ + return wa::files::file_exists( wa::strings::convert::to_string( p_filename ) ); +} + + +int wa::files::file_size( const char *p_filename ) +{ + int l_file_size = -1; + + struct stat l_file_info{}; + + + if ( !stat( p_filename, &l_file_info ) ) + l_file_size = l_file_info.st_size; + + + return l_file_size; +} + +int wa::files::file_size( const wchar_t *p_filename ) +{ + std::string l_filename = wa::strings::convert::to_string( p_filename ); + + return file_size( l_filename.c_str() ); +} + + +bool wa::files::folder_exists( const char *p_folder ) +{ + struct stat info; + + if ( stat( p_folder, &info) != 0 ) + return false; + else if ( info.st_mode & S_IFDIR ) + return true; + else + return false; +} + + +bool wa::files::getFilenamesFromFolder( std::vector<std::string> &p_result, const std::string &p_folder_path, const std::string &p_reg_ex, const size_t p_limit ) +{ + _finddata_t l_file_info; + std::string l_file_pattern = p_folder_path + "\\" + p_reg_ex; + + intptr_t l_handle = _findfirst( l_file_pattern.c_str(), &l_file_info ); + //If folder_path exsist, using l_file_pattern will find at least two files "." and "..", + //of which "." means current dir and ".." means parent dir + if ( l_handle != -1 ) + { + //iteratively check each file or sub_directory in current folder + do + { + std::string l_file_name = l_file_info.name; //from char array to string + //check whtether it is a sub direcotry or a file + if ( l_file_info.attrib & _A_SUBDIR ) + { + if ( l_file_name != "." && l_file_name != ".." ) + wa::files::getFilenamesFromFolder( p_result, p_folder_path + "\\" + l_file_name, p_reg_ex ); + } + else + p_result.push_back( p_folder_path + "\\" + l_file_name ); + + } while ( _findnext( l_handle, &l_file_info ) == 0 && p_result.size() < p_limit - 1 ); + + + _findclose( l_handle ); + + return true; + } + + // + _findclose( l_handle ); + + return false; +} diff --git a/Src/WAT/wa_logger.h b/Src/WAT/wa_logger.h new file mode 100644 index 00000000..3eb2b8fe --- /dev/null +++ b/Src/WAT/wa_logger.h @@ -0,0 +1,55 @@ +#pragma once + +#ifndef _WA_LOGGER_HEADER +#define _WA_LOGGER_HEADER + +#include <iostream> + +#include "spdlog/spdlog.h" +#include "spdlog/async.h" //support for async logging. +#include "spdlog/sinks/basic_file_sink.h" + +#include "WAT.h" + +#include "..\Winamp\buildType.h" + +std::shared_ptr<spdlog::logger> init_log() +{ + std::string l_app_version( STR_WINAMP_FILEVER ); + wa::strings::replaceAll( l_app_version, ",", "." ); + + std::string l_app_data_folder( getenv( "APPDATA" ) ); + l_app_data_folder.append( "\\Winamp\\winamp.log" ); + + auto my_wa_logger = spdlog::basic_logger_mt( l_app_version.c_str(), l_app_data_folder.c_str()); + + spdlog::set_default_logger( my_wa_logger ); + spdlog::set_level( spdlog::level::trace ); + + return my_wa_logger; +} + + +static std::shared_ptr<spdlog::logger> wa_logger = init_log(); + + +#ifdef _DEBUG +#define LOG_DEBUG(text) spdlog::debug( wa::strings::convert::to_string( text ) ); +#define LOG_INFO(text) spdlog::info( wa::strings::convert::to_string( text ) ); +#define LOG_WARN(text) spdlog::warn( wa::strings::convert::to_string( text ) ); +#define LOG_ERROR(text) spdlog::error( wa::strings::convert::to_string( text ) ); +#define LOG_CRITICAL(text) spdlog::critical( wa::strings::convert::to_string( text ) ); +#else +#define LOG_DEBUG(text) /* nop */ +#define LOG_INFO(text) /* nop */ +#define LOG_WARN(text) /* nop */ +#define LOG_ERROR(text) spdlog::error( wa::strings::convert::to_string( text ) ); +#define LOG_CRITICAL(text) spdlog::critical( wa::strings::convert::to_string( text ) ); +#endif // _DEBUG + + +wchar_t _log_message_w[ DEFAULT_STR_BUFFER_SIZE ]; +char _log_message_a[ DEFAULT_STR_BUFFER_SIZE ]; +std::string _log_message; + +#endif // !_WA_LOGGER_HEADER
\ No newline at end of file diff --git a/Src/WAT/wa_strings.cpp b/Src/WAT/wa_strings.cpp new file mode 100644 index 00000000..dedc6316 --- /dev/null +++ b/Src/WAT/wa_strings.cpp @@ -0,0 +1,709 @@ +#include "WAT.h" + +// +// to const char* +// +const char *wa::strings::convert::to_char( const wchar_t *p_message ) +{ + std::wstring l_message_w( p_message ); + std::string l_message( l_message_w.begin(), l_message_w.end() ); + + return _strdup( l_message.c_str() ); +} + +const char *wa::strings::convert::to_char( const std::wstring p_message ) +{ + std::string l_message = wa::strings::convert::to_string( p_message ); + + return _strdup( l_message.c_str() ); +} + + +// +// to const wchar_t* +// +const wchar_t *wa::strings::convert::to_wchar( const char *p_message ) +{ + std::string l_message( p_message ); + std::wstring l_message_w( l_message.begin(), l_message.end() ); + + return _wcsdup( l_message_w.c_str() ); +} + + +// +// to std::string +// +std::string wa::strings::convert::to_string( const char *p_message ) +{ + std::string l_message( p_message ); + + return l_message; +} + +std::string wa::strings::convert::to_string( const wchar_t *p_message ) +{ + std::wstring l_message_w( p_message ); + std::string l_message( l_message_w.begin(), l_message_w.end() ); + + return l_message; +} + +std::string wa::strings::convert::to_string( const std::wstring p_message ) +{ + std::string l_message( p_message.begin(), p_message.end() ); + + return l_message; +} + + +// +// to std::wstring +// +std::wstring wa::strings::convert::to_wstring( const char *p_message ) +{ + std::string l_message_w( p_message ); + std::wstring l_message( l_message_w.begin(), l_message_w.end() ); + + return l_message; +} + +std::wstring wa::strings::convert::to_wstring( const wchar_t *p_message ) +{ + std::wstring l_message( p_message ); + + return l_message; +} + +std::wstring wa::strings::convert::to_wstring( const std::string p_message ) +{ + std::wstring l_message( p_message.begin(), p_message.end() ); + + return l_message; +} + + +// +// replace +// +void wa::strings::replace( std::string &p_string, const std::string &p_from, const std::string &p_to ) +{ + if ( p_from.empty() ) + return; + + size_t start_pos = p_string.find( p_from ); + + if ( start_pos == std::string::npos ) + return; + + p_string.replace( start_pos, p_from.length(), p_to ); + + return; +} + +void wa::strings::replace( char *p_string, const char *p_from, const char *p_to ) +{ + std::string l_string( p_string ); + + wa::strings::replace( l_string, std::string( p_from ), std::string( p_to ) ); + + p_string = (char *)l_string.c_str(); +} + +void wa::strings::replace( wchar_t *p_string, const wchar_t *p_from, const wchar_t *p_to ) +{ + std::string l_string = wa::strings::convert::to_string( p_string ); + + wa::strings::replace( l_string, wa::strings::convert::to_string( p_from ), wa::strings::convert::to_string( p_to ) ); + + std::wstring l_wstring = wa::strings::convert::to_wstring( l_string ); + + p_string = (wchar_t *)( l_wstring.c_str() ); +} + + +// +// replaceAll +// +void wa::strings::replaceAll( std::string &p_string, const std::string &p_from, const std::string &p_to ) +{ + if ( p_from.empty() ) + return; + + size_t start_pos = 0; + while ( ( start_pos = p_string.find( p_from, start_pos ) ) != std::string::npos ) + { + p_string.replace( start_pos, p_from.length(), p_to ); + start_pos += p_to.length(); // In case 'p_to' contains 'p_from', like replacing 'x' with 'yx' + } +} + +void wa::strings::replaceAll( char *p_string, const char *p_from, const char *p_to ) +{ + std::string l_string( p_string ); + + wa::strings::replaceAll( l_string, std::string( p_from ), std::string( p_to ) ); + + p_string = (char *)l_string.c_str(); +} + +void wa::strings::replaceAll( wchar_t *p_string, const wchar_t *p_from, const wchar_t *p_to ) +{ + std::string l_string = wa::strings::convert::to_string( p_string ); + + wa::strings::replaceAll( l_string, wa::strings::convert::to_string( p_from ), wa::strings::convert::to_string( p_to ) ); + + std::wstring l_wstring = wa::strings::convert::to_wstring( l_string ); + + p_string = (wchar_t *)( l_wstring.c_str() ); +} + + +// +// create_string +// + +std::string wa::strings::create_string( const char *Format, ... ) +{ + char _log_message_a[ DEFAULT_STR_BUFFER_SIZE ]; + va_list args; + va_start( args, Format ); + snprintf( _log_message_a, DEFAULT_STR_BUFFER_SIZE, Format, args ); + + return std::string( _log_message_a ); +} + +std::string wa::strings::create_string( const wchar_t *Format, ... ) +{ + wchar_t _log_message_w[ DEFAULT_STR_BUFFER_SIZE ]; + va_list args; + va_start( args, Format ); + _vsnwprintf( _log_message_w, DEFAULT_STR_BUFFER_SIZE, Format, args ); + + return wa::strings::convert::to_string( _log_message_w ); +} + +std::string wa::strings::create_string( const std::string Format, ... ) +{ + va_list args; + va_start( args, Format ); + + return create_string( Format.c_str(), args ); +} + + + + + + +//===================================================================================================================== +// +// wa_string::wa_string (constructor) +// +wa::strings::wa_string::wa_string( const char *p_initial ) +{ + if ( p_initial == NULL ) + _wa_string.clear(); + else + _wa_string = wa::strings::convert::to_wstring( p_initial ); +} + +wa::strings::wa_string::wa_string( const wchar_t *p_initial ) +{ + if ( p_initial == NULL ) + _wa_string.clear(); + else + _wa_string = std::wstring( p_initial ); +} + +wa::strings::wa_string::wa_string( const std::string &p_initial ) +{ + _wa_string = wa::strings::convert::to_wstring( p_initial ); +} + +wa::strings::wa_string::wa_string( const std::wstring &p_initial ) +{ + _wa_string = p_initial; +} + + +// +// wa_string::operator= +// +void wa::strings::wa_string::operator=( const char *p_value ) +{ + _wa_string = wa::strings::convert::to_wstring( p_value ); +} + +void wa::strings::wa_string::operator=( const wchar_t *p_value ) +{ + _wa_string = std::wstring( p_value ); +} + +void wa::strings::wa_string::operator=( const std::string &p_value ) +{ + _wa_string = wa::strings::convert::to_wstring( p_value ); +} + +void wa::strings::wa_string::operator=( const std::wstring &p_value ) +{ + _wa_string = p_value; +} + + +// +// wa_string::operator== +// +bool wa::strings::wa_string::operator==( const char *p_value ) const +{ + std::string l_wa_string( wa::strings::convert::to_string( _wa_string ) ); + + return l_wa_string.compare( p_value ) == 0; +} + +bool wa::strings::wa_string::operator==( const wchar_t *p_value ) const +{ + return _wa_string.compare( p_value ) == 0; +} + +bool wa::strings::wa_string::operator==( const std::string &p_value ) const +{ + std::string l_wa_string( wa::strings::convert::to_string( _wa_string ) ); + + return l_wa_string.compare( p_value ) == 0; +} + +bool wa::strings::wa_string::operator==( const std::wstring &p_value ) const +{ + return _wa_string.compare( p_value ) == 0; +} + + +// +// wa_string::operator!= +// +bool wa::strings::wa_string::operator!=( const char *p_value ) const +{ + std::string l_wa_string( wa::strings::convert::to_string( _wa_string ) ); + + return l_wa_string.compare( p_value ) != 0; +} + +bool wa::strings::wa_string::operator!=( const wchar_t *p_value ) const +{ + return _wa_string.compare( p_value ) != 0; +} + +bool wa::strings::wa_string::operator!=( const std::string &p_value ) const +{ + std::string l_wa_string( wa::strings::convert::to_string( _wa_string ) ); + + return l_wa_string.compare( p_value ) != 0; +} + +bool wa::strings::wa_string::operator!=( const int p_value ) const +{ + return std::to_wstring( p_value ).compare( _wa_string ) != 0; +} + + +// +// wa_string::operator+ +// +wa::strings::wa_string wa::strings::wa_string::operator+( const char *p_value ) +{ + _wa_string.append( wa::strings::convert::to_wstring( p_value ) ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::operator+( const wchar_t *p_value ) +{ + _wa_string.append( p_value ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::operator+( const std::string &p_value ) +{ + _wa_string.append( wa::strings::convert::to_wstring( p_value ) ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::operator+( const std::wstring &p_value ) +{ + _wa_string.append( p_value ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::operator+( const int p_value ) +{ + append( p_value ); + + return *this; +} + + +// +// wa_string::append +// +wa::strings::wa_string wa::strings::wa_string::append( const char *p_value ) +{ + _wa_string.append( wa::strings::convert::to_wstring( p_value ) ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::append( const wchar_t *p_value ) +{ + _wa_string.append( p_value ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::append( const std::string &p_value ) +{ + _wa_string.append( wa::strings::convert::to_wstring( p_value ) ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::append( const std::wstring &p_value ) +{ + _wa_string.append( p_value ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::append( const wa_string p_value ) +{ + _wa_string.append(p_value.GetW().c_str()); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::append( const int p_value ) +{ +#ifdef WIN32 + // max size is 4294967295 is 10 character + wchar_t temp[ 11 ] = { 0 }; +#elif WIN64 + // maxsize 9223372036854775807 is 19 + wchar_t temp[ 20 ] = { 0 }; +#endif + + _itow( p_value, temp, 10 ); + _wa_string.append( temp ); + + return *this; +} + + +// wa_string::GetA +const std::string wa::strings::wa_string::GetA() const +{ + return wa::strings::convert::to_string( _wa_string ); +} + +// wa_string::GetW +const std::wstring wa::strings::wa_string::GetW() const +{ + return _wa_string; +} + + +// +// wa_string::lengthA +// +unsigned int wa::strings::wa_string::lengthA() const +{ + return strlen( wa::strings::convert::to_char( _wa_string ) ); +} + +unsigned int wa::strings::wa_string::lengthW() const +{ + return wcslen( _wa_string.c_str() ); +} + +unsigned int wa::strings::wa_string::lengthS() const +{ + std::string l_wa_string = wa::strings::convert::to_string( _wa_string ); + + return l_wa_string.length(); +} + +unsigned int wa::strings::wa_string::lengthWS() const +{ + return _wa_string.length(); +} + + +// +// wa_string::replace +// +bool wa::strings::wa_string::contains( const char *p_value ) +{ + std::string l_value( p_value ); + + return this->contains( l_value ); +} + +bool wa::strings::wa_string::contains( const wchar_t *p_value ) +{ + std::string l_value = wa::strings::convert::to_string( p_value ); + + return this->contains( l_value ); +} + +bool wa::strings::wa_string::contains( const std::string &p_value ) +{ + std::string l_wa_string = wa::strings::convert::to_string( _wa_string ); + + return ( l_wa_string.find( p_value ) != std::string::npos ); +} + +bool wa::strings::wa_string::contains( const std::wstring &p_value ) +{ + std::string l_value = wa::strings::convert::to_string( p_value ); + + return this->contains( l_value ); +} + + +// +// wa_string::replace +// +wa::strings::wa_string wa::strings::wa_string::replace( const char *p_from, const char *p_to ) +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + wa::strings::replace( l_string, std::string( p_from ), std::string( p_to ) ); + + _wa_string = wa::strings::convert::to_wstring( l_string ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::replace( const wchar_t *p_from, const wchar_t *p_to ) +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + wa::strings::replace( l_string, wa::strings::convert::to_string( p_from ), wa::strings::convert::to_string( p_to ) ); + + _wa_string = wa::strings::convert::to_wstring( l_string ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::replace( const std::string &p_from, const std::string &p_to ) +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + wa::strings::replace( l_string, p_from, p_to ); + + _wa_string = wa::strings::convert::to_wstring( l_string ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::replace( const std::wstring &p_from, const std::wstring &p_to ) +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + wa::strings::replace( l_string, wa::strings::convert::to_string( p_from), wa::strings::convert::to_string( p_to ) ); + + _wa_string = wa::strings::convert::to_wstring( l_string ); + + return *this; +} + + +// +// wa_string::replaceAll +// +wa::strings::wa_string wa::strings::wa_string::replaceAll( const char *p_from, const char *p_to ) +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + wa::strings::replaceAll( l_string, std::string( p_from ), std::string( p_to ) ); + + _wa_string = wa::strings::convert::to_wstring( l_string ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::replaceAll( const wchar_t *p_from, const wchar_t *p_to ) +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + wa::strings::replaceAll( l_string, wa::strings::convert::to_string( p_from ), wa::strings::convert::to_string( p_to ) ); + + _wa_string = wa::strings::convert::to_wstring( l_string ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::replaceAll( const std::string &p_from, const std::string &p_to ) +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + wa::strings::replaceAll( l_string, p_from, p_to ); + + _wa_string = wa::strings::convert::to_wstring( l_string ); + + return *this; +} + +wa::strings::wa_string wa::strings::wa_string::replaceAll( const std::wstring &p_from, const std::wstring &p_to ) +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + wa::strings::replaceAll( l_string, wa::strings::convert::to_string( p_from ), wa::strings::convert::to_string( p_to ) ); + + _wa_string = wa::strings::convert::to_wstring( l_string ); + + return *this; +} + + +// +// wa_string::startsWith +// +bool wa::strings::wa_string::startsWith( const char *l_head ) const +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + return ( l_string.substr( 0, std::strlen( l_head ) ).compare( l_head ) == 0 ); +} + +bool wa::strings::wa_string::startsWith( const wchar_t *l_head ) const +{ + return ( _wa_string.substr( 0, wcslen( l_head ) ).compare( l_head ) == 0 ); +} + +bool wa::strings::wa_string::startsWith( const std::string &l_head ) const +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + return ( l_string.substr( 0, l_head.size() ).compare( l_head ) == 0 ); +} + +bool wa::strings::wa_string::startsWith( const std::wstring &l_head ) const +{ + return ( _wa_string.substr( 0, l_head.size() ).compare( l_head ) == 0 ); +} + + +// +// wa_string::endsWith +// +bool wa::strings::wa_string::endsWith( const char *l_tail ) const +{ + // TODO + + return false; +} + +bool wa::strings::wa_string::endsWith( const wchar_t *l_tail ) const +{ + // TODO + + return false; +} + +bool wa::strings::wa_string::endsWith( const std::string &l_tail ) const +{ + // TODO + + return false; +} + +bool wa::strings::wa_string::endsWith( const std::wstring &l_tail ) const +{ + // TODO + + return false; +} + + +// +// wa_string::findFirst +// +int wa::strings::wa_string::findFirst( const char *l_text ) const +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + return l_string.find_first_of( l_text ); +} + +int wa::strings::wa_string::findFirst( const wchar_t *l_text ) const +{ + return _wa_string.find_first_of( l_text ); +} + +int wa::strings::wa_string::findFirst( const std::string &l_text ) const +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + return l_string.find_first_of( l_text ); +} + +int wa::strings::wa_string::findFirst( const std::wstring &l_text ) const +{ + return _wa_string.find_first_of( l_text ); +} + + +// +// wa_string::findLast +// +int wa::strings::wa_string::findLast( const char *l_text ) const +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + return l_string.find_last_of( l_text ); +} + +int wa::strings::wa_string::findLast( const wchar_t *l_text ) const +{ + return _wa_string.find_last_of( l_text ); +} + +int wa::strings::wa_string::findLast( const std::string &l_text ) const +{ + std::string l_string = wa::strings::convert::to_string( _wa_string ); + + return l_string.find_last_of( l_text ); +} + +int wa::strings::wa_string::findLast( const std::wstring &l_text ) const +{ + return _wa_string.find_last_of( l_text ); +} + + +// +// wa_string::find +// +int wa::strings::wa_string::find( const std::wstring &l_text ) const +{ + return _wa_string.find( l_text ); +} + + +// wa_string::mid +std::wstring wa::strings::wa_string::mid( const int p_start, const int p_length ) const +{ + return _wa_string.substr( p_start, p_length ); +} + + +// wa_string::toUpper +wa::strings::wa_string wa::strings::wa_string::toUpper() +{ + std::transform( _wa_string.begin(), _wa_string.end(), _wa_string.begin(), ::toupper ); + + return *this; +} diff --git a/Src/WAT/wat_nodeptr.h b/Src/WAT/wat_nodeptr.h new file mode 100644 index 00000000..27edc0e7 --- /dev/null +++ b/Src/WAT/wat_nodeptr.h @@ -0,0 +1,23 @@ +#pragma once +#ifndef _WA_LISTS_NODEPTR +#define _WA_LISTS_NODEPTR + +namespace wa +{ + namespace lists + { + struct node_ptr + { + node_ptr* next; + node_ptr* prev; + + node_ptr() : + next(0), prev(0) + { + + } + }; + } +} + +#endif
\ No newline at end of file |