From f391fe3c994f9a7f89345cf3d3fa0d6e0487646c Mon Sep 17 00:00:00 2001 From: Mordred Date: Sat, 27 Oct 2018 22:51:16 +0200 Subject: [PATCH] Boost removed from all tools --- src/common/Logging/Logger.cpp | 6 ++- src/tools/discovery_parser/CMakeLists.txt | 9 ++-- src/tools/discovery_parser/main.cpp | 36 ++++++++-------- src/tools/event_object_parser/CMakeLists.txt | 5 +-- src/tools/event_object_parser/main.cpp | 45 ++++++++++---------- src/tools/exd_common_gen/CMakeLists.txt | 12 ++---- src/tools/exd_common_gen/main.cpp | 35 +++++++++------ src/tools/mob_parse/CMakeLists.txt | 8 +--- src/tools/mob_parse/main.cpp | 10 +---- src/tools/pcb_reader/CMakeLists.txt | 7 +-- src/tools/pcb_reader/main.cpp | 33 +++++++------- 11 files changed, 98 insertions(+), 108 deletions(-) diff --git a/src/common/Logging/Logger.cpp b/src/common/Logging/Logger.cpp index 231b33a9..0f8c2c24 100644 --- a/src/common/Logging/Logger.cpp +++ b/src/common/Logging/Logger.cpp @@ -7,7 +7,8 @@ // #include -namespace Core { +namespace Core +{ Logger::Logger() @@ -34,7 +35,8 @@ void Logger::init() std::vector sinks { stdout_sink, daily_sink }; - auto logger = std::make_shared< spdlog::async_logger >( "logger", sinks.begin(), sinks.end(), spdlog::thread_pool(), spdlog::async_overflow_policy::block ); + auto logger = std::make_shared< spdlog::async_logger >( "logger", sinks.begin(), sinks.end(), + spdlog::thread_pool(), spdlog::async_overflow_policy::block ); spdlog::register_logger( logger ); diff --git a/src/tools/discovery_parser/CMakeLists.txt b/src/tools/discovery_parser/CMakeLists.txt index 8aab97d5..e75e09b0 100644 --- a/src/tools/discovery_parser/CMakeLists.txt +++ b/src/tools/discovery_parser/CMakeLists.txt @@ -2,11 +2,8 @@ cmake_minimum_required(VERSION 2.6) cmake_policy(SET CMP0015 NEW) project(Tool_discovery_parser) -set(SAPPHIRE_BOOST_VER 1.63.0) -set(SAPPHIRE_BOOST_FOLDER_NAME boost_1_63_0) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../bin/") - file(GLOB SERVER_PUBLIC_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*" "${CMAKE_CURRENT_SOURCE_DIR}/BMP-DDS_Converter/*" @@ -30,10 +27,10 @@ set_target_properties(discovery_parser PROPERTIES ) if (UNIX) - target_link_libraries (discovery_parser common xivdat pthread mysqlclient dl z) + target_link_libraries (discovery_parser common xivdat pthread mysqlclient dl z stdc++fs) else() - target_link_libraries (discovery_parser common xivdat libmysql zlib1) + target_link_libraries (discovery_parser common xivdat mysql zlib) endif() -target_link_libraries(discovery_parser ${Boost_LIBRARIES} ${Boost_LIBRARIES}) + diff --git a/src/tools/discovery_parser/main.cpp b/src/tools/discovery_parser/main.cpp index 62165a2e..17efbed0 100644 --- a/src/tools/discovery_parser/main.cpp +++ b/src/tools/discovery_parser/main.cpp @@ -9,6 +9,9 @@ #include #include #include +#include + +#include #include "pcb.h" #include "lgb.h" @@ -22,7 +25,6 @@ #include #include #include -#include // garbage to ignore models bool ignoreModels = false; @@ -162,17 +164,17 @@ void getMapExdEntries( uint32_t zoneId ) case DataType::float32: 8 case DataType::uint64: 9 */ - auto territory = *boost::get< uint16_t >( &fields.at( 14 ) ); + auto territory = std::get< uint16_t >( fields.at( 14 ) ); if( territory != zoneId ) continue; - auto mapZoneIndex = *boost::get< int8_t >( &fields.at( 2 ) ); - auto hierarchy = *boost::get< uint8_t >( &fields.at( 3 ) ); - auto pathStr = *boost::get< std::string >( &fields.at( 5 ) ); - auto sizeFactor = *boost::get< uint16_t >( &fields.at( 6 ) ); - auto mapOffsetX = *boost::get< int16_t >( &fields.at( 7 ) ); - auto mapOffsetY = *boost::get< int16_t >( &fields.at( 8 ) ); - auto discoveryIdx = *boost::get< int16_t >( &fields.at( 12 ) ); - auto discoveryCompleteBitmask = *boost::get< uint32_t >( &fields.at( 13 ) ); + auto mapZoneIndex = std::get< int8_t >( fields.at( 2 ) ); + auto hierarchy = std::get< uint8_t >( fields.at( 3 ) ); + auto pathStr = std::get< std::string >( fields.at( 5 ) ); + auto sizeFactor = std::get< uint16_t >( fields.at( 6 ) ); + auto mapOffsetX = std::get< int16_t >( fields.at( 7 ) ); + auto mapOffsetY = std::get< int16_t >( fields.at( 8 ) ); + auto discoveryIdx = std::get< int16_t >( fields.at( 12 ) ); + auto discoveryCompleteBitmask = std::get< uint32_t >( fields.at( 13 ) ); char texStr[255]; auto teriStr = pathStr.substr( 0, pathStr.find_first_of( '/' ) ); char discoveryFileName[255]; @@ -247,19 +249,19 @@ std::string zoneNameToPath( const std::string& name ) for( auto& row : rows ) { auto& fields = row.second; - auto teriName = *boost::get< std::string >( - &fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::TerritoryType ) ) ); + auto teriName = std::get< std::string >( + fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::TerritoryType ) ) ); if( teriName.empty() ) continue; - auto teriPath = *boost::get< std::string >( - &fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::Path ) ) ); + auto teriPath = std::get< std::string >( + fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::Path ) ) ); ZoneInfo info; info.id = row.first; info.path = teriPath; info.name = teriName; zoneInfoMap[ row.first ] = info; - if( !found && boost::iequals( name, teriName ) ) + if( !found && ( Core::Util::toLowerCopy( name ) == Core::Util::toLowerCopy( teriName ) ) ) { found = true; path = teriPath; @@ -271,7 +273,7 @@ std::string zoneNameToPath( const std::string& name ) { for( const auto& entry : zoneInfoMap ) { - if( found = boost::iequals( name, entry.second.name ) ) + if( found = Core::Util::toLowerCopy( name ) == Core::Util::toLowerCopy( entry.second.name ) ) { path = entry.second.path; zoneId = entry.second.id; @@ -304,7 +306,7 @@ void loadEobjNames() { auto id = row.first; auto& fields = row.second; - auto name = *boost::get< std::string >( &fields.at( 0 ) ); + auto name = std::get< std::string >( fields.at( 0 ) ); eobjNameMap[ id ] = name; } } diff --git a/src/tools/event_object_parser/CMakeLists.txt b/src/tools/event_object_parser/CMakeLists.txt index b3d39c4e..b6e41fe7 100644 --- a/src/tools/event_object_parser/CMakeLists.txt +++ b/src/tools/event_object_parser/CMakeLists.txt @@ -24,10 +24,9 @@ set_target_properties(event_object_parser PROPERTIES ) if (UNIX) - target_link_libraries (event_object_parser common xivdat pthread mysqlclient dl z) + target_link_libraries (event_object_parser common xivdat pthread mysqlclient dl z stdc++fs) else() - target_link_libraries (event_object_parser common xivdat libmysql zlib1) + target_link_libraries (event_object_parser common xivdat mysql zlib) endif() -target_link_libraries(event_object_parser ${Boost_LIBRARIES} ${Boost_LIBRARIES}) diff --git a/src/tools/event_object_parser/main.cpp b/src/tools/event_object_parser/main.cpp index 1368d76c..1f5c2333 100644 --- a/src/tools/event_object_parser/main.cpp +++ b/src/tools/event_object_parser/main.cpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include "pcb.h" #include "lgb.h" @@ -21,9 +23,6 @@ #include #include #include -#include -#include -#include #include @@ -148,14 +147,14 @@ void dumpLevelExdEntries( uint32_t zoneId, const std::string& name = std::string { auto id = row.first; auto& fields = row.second; - auto x = *boost::get< float >( &fields.at( 0 ) ); - auto y = *boost::get< float >( &fields.at( 1 ) ); - auto z = *boost::get< float >( &fields.at( 2 ) ); - auto yaw = *boost::get< float >( &fields.at( 3 ) ); - auto radius = *boost::get< float >( &fields.at( 4 ) ); - auto type = *boost::get< uint8_t >( &fields.at( 5 ) ); - auto objectid = *boost::get< uint32_t >( &fields.at( 6 ) ); - auto zone = *boost::get< uint16_t >( &fields.at( 9 ) ); + auto x = std::get< float >( fields.at( 0 ) ); + auto y = std::get< float >( fields.at( 1 ) ); + auto z = std::get< float >( fields.at( 2 ) ); + auto yaw = std::get< float >( fields.at( 3 ) ); + auto radius = std::get< float >( fields.at( 4 ) ); + auto type = std::get< uint8_t >( fields.at( 5 ) ); + auto objectid = std::get< uint32_t >( fields.at( 6 ) ); + auto zone = std::get< uint16_t >( fields.at( 9 ) ); if( zone == zoneId ) { @@ -205,12 +204,12 @@ std::string zoneNameToPath( const std::string& name ) for( auto& row : exd.get_rows() ) { auto& fields = row.second; - auto teriName = *boost::get< std::string >( - &fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::TerritoryType ) ) ); + auto teriName = std::get< std::string >( + fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::TerritoryType ) ) ); if( teriName.empty() ) continue; - auto teriPath = *boost::get< std::string >( &fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::Path ) ) ); - if( !found && boost::iequals( name, teriName ) ) + auto teriPath = std::get< std::string >( fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::Path ) ) ); + if( !found && ( Core::Util::toLowerCopy( name) == Core::Util::toLowerCopy( teriName ) ) ) { path = teriPath; found = true; @@ -244,7 +243,7 @@ void loadEobjNames() { auto id = row.first; auto& fields = row.second; - auto name = *boost::get< std::string >( &fields.at( 0 ) ); + auto name = std::get< std::string >( fields.at( 0 ) ); if( !name.empty() ) eobjNameMap[ id ] = name; @@ -316,11 +315,11 @@ void loadAllInstanceContentEntries() auto id = row.first; auto& fields = row.second; - auto name = *boost::get< std::string >( &fields.at( 3 ) ); + auto name = std::get< std::string >( fields.at( 3 ) ); if( name.empty() ) continue; - auto type = *boost::get< uint8_t >( &fields.at( 0 ) ); - auto teri = *boost::get< uint32_t >( &fields.at( 9 ) ); + auto type = std::get< uint8_t >( fields.at( 0 ) ); + auto teri = std::get< uint32_t >( fields.at( 9 ) ); auto i = 0; while( ( i = name.find( ' ' ) ) != std::string::npos ) name = name.replace( name.begin() + i, name.begin() + i + 1, { '_' } ); @@ -331,7 +330,8 @@ void loadAllInstanceContentEntries() //zoneInstanceMap[zoneId].push_back( std::make_pair( id, name ) ); zoneDumpList.emplace( zoneNameMap[ teri ] ); - name.erase( boost::remove_if( name, boost::is_any_of( "★_ '()[]-\x1a\x1\x2\x1f\x1\x3.:" ) ), name.end() ); + std::string remove = "★_ '()[]-\x1a\x1\x2\x1f\x1\x3.:"; + Core::Util::eraseAllIn( name, remove ); name[ 0 ] = toupper( name[ 0 ] ); contentList.push_back( { id, name, zoneNameMap[ teri ], type } ); } @@ -584,8 +584,9 @@ int main( int argc, char* argv[] ) if( eobjNameMap.find( id ) != eobjNameMap.end() ) { name = eobjNameMap[ id ]; - name.erase( boost::remove_if( name, boost::is_any_of( "★_ '()[]-\x1a\x1\x2\x1f\x1\x3.:" ) ), - name.end() ); + std::string remove = "★_ '()[]-\x1a\x1\x2\x1f\x1\x3.:"; + Core::Util::eraseAllIn( name, remove ); + name[ 0 ] = toupper( name[ 0 ] ); } if( name.empty() ) diff --git a/src/tools/exd_common_gen/CMakeLists.txt b/src/tools/exd_common_gen/CMakeLists.txt index 5803c018..78f2714f 100644 --- a/src/tools/exd_common_gen/CMakeLists.txt +++ b/src/tools/exd_common_gen/CMakeLists.txt @@ -2,15 +2,12 @@ cmake_minimum_required(VERSION 2.6) cmake_policy(SET CMP0015 NEW) project(Tool_ExdCommonGen) -set(SAPPHIRE_BOOST_VER 1.63.0) -set(SAPPHIRE_BOOST_FOLDER_NAME boost_1_63_0) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../bin/") file(GLOB SERVER_PUBLIC_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*") file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*") -#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../bin/") add_executable(exd_common_gen ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES}) set_target_properties(exd_common_gen PROPERTIES @@ -24,13 +21,10 @@ set_target_properties(exd_common_gen PROPERTIES ) if (UNIX) - target_link_libraries (exd_common_gen common xivdat pthread mysqlclient dl z) + target_link_libraries (exd_common_gen common xivdat pthread mysqlclient dl z stdc++fs) else() - target_link_libraries (exd_common_gen common xivdat libmysql zlib) - - # ignore unchecked iterators warnings from msvc - add_definitions(-D_SCL_SECURE_NO_WARNINGS) + target_link_libraries (exd_common_gen common xivdat mysql zlib) endif() -target_link_libraries(exd_common_gen ${Boost_LIBRARIES} ${Boost_LIBRARIES}) + diff --git a/src/tools/exd_common_gen/main.cpp b/src/tools/exd_common_gen/main.cpp index 7eef7ead..469bd4ae 100644 --- a/src/tools/exd_common_gen/main.cpp +++ b/src/tools/exd_common_gen/main.cpp @@ -10,8 +10,8 @@ #include #include #include -#include #include +#include #include @@ -45,27 +45,34 @@ std::string generateEnum( const std::string& exd, int8_t nameIndex, const std::s { auto& fields = row.second; uint32_t id = row.first; - auto test = std::get< std::string >( fields.at( nameIndex ) ); - if( !test ) - continue; - auto str = *test; - str.erase( std::remove_if( str.begin(), str.end(), std::is_any_of( ",_-':!(){} \x02\x1f\x01\x03" ) ) ); - if( str.empty() ) - continue; - str[ 0 ] = std::toupper( str[ 0 ] ); - auto it = nameMap.find( str ); + std::string value; + try + { + value = std::get< std::string >( fields.at( nameIndex ) ); + } + catch( std::bad_variant_access& ) + { + continue; + } + + std::string remove = ",_-':!(){} \x02\x1f\x01\x03"; + Core::Util::eraseAllIn( value, remove ); + + value[ 0 ] = std::toupper( value[ 0 ] ); + + auto it = nameMap.find( value ); if( it != nameMap.end() ) { - nameMap[ str ]++; - str = str + std::to_string( nameMap[ str ] ); + nameMap[ value ]++; + value = value + std::to_string( nameMap[ value ] ); } else { - nameMap[ str ] = 0; + nameMap[ value ] = 0; } - result += " " + str + " = " + std::to_string( id ) + ",\n"; + result += " " + value + " = " + std::to_string( id ) + ",\n"; } diff --git a/src/tools/mob_parse/CMakeLists.txt b/src/tools/mob_parse/CMakeLists.txt index 42647570..06e8f9e6 100644 --- a/src/tools/mob_parse/CMakeLists.txt +++ b/src/tools/mob_parse/CMakeLists.txt @@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.6) cmake_policy(SET CMP0015 NEW) project(Tool_mob_parse) -set(SAPPHIRE_BOOST_VER 1.63.0) -set(SAPPHIRE_BOOST_FOLDER_NAME boost_1_63_0) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../bin/") @@ -24,10 +22,8 @@ set_target_properties(mob_parse PROPERTIES ) if (UNIX) - target_link_libraries (mob_parse common xivdat pthread mysqlclient dl z) + target_link_libraries (mob_parse common xivdat pthread mysqlclient dl z stdc++fs ) else() - target_link_libraries (mob_parse common xivdat libmysql zlib1) + target_link_libraries (mob_parse common xivdat mysql zlib) endif() -target_link_libraries(mob_parse ${Boost_LIBRARIES} ${Boost_LIBRARIES}) - diff --git a/src/tools/mob_parse/main.cpp b/src/tools/mob_parse/main.cpp index 119e4e67..c7de3b46 100644 --- a/src/tools/mob_parse/main.cpp +++ b/src/tools/mob_parse/main.cpp @@ -11,13 +11,7 @@ #include #include #include - -#include -#include -#include -#include -#include -#include +#include #include @@ -126,7 +120,7 @@ std::string binaryToHexString( uint8_t* pBinData, uint16_t size ) for( uint32_t i = 0; i < size; i++ ) { - outStr += boost::str( boost::format( "%|02X|" ) % ( int32_t ) ( pBinData[ i ] & 0xFF ) ); + outStr += Core::Util::intToHexString( pBinData[ i ] & 0xFF ); } return outStr; diff --git a/src/tools/pcb_reader/CMakeLists.txt b/src/tools/pcb_reader/CMakeLists.txt index c01d6c42..7a330175 100644 --- a/src/tools/pcb_reader/CMakeLists.txt +++ b/src/tools/pcb_reader/CMakeLists.txt @@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.6) cmake_policy(SET CMP0015 NEW) project(Tool_pcb_reader2) -set(SAPPHIRE_BOOST_VER 1.63.0) -set(SAPPHIRE_BOOST_FOLDER_NAME boost_1_63_0) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../bin/") @@ -24,10 +22,9 @@ set_target_properties(pcb_reader2 PROPERTIES ) if (UNIX) - target_link_libraries (pcb_reader2 common xivdat pthread mysqlclient dl z) + target_link_libraries (pcb_reader2 common xivdat pthread mysqlclient dl z stdc++fs ) else() - target_link_libraries (pcb_reader2 common xivdat libmysql zlib1) + target_link_libraries (pcb_reader2 common xivdat mysql zlib) endif() -target_link_libraries(pcb_reader2 ${Boost_LIBRARIES} ${Boost_LIBRARIES}) diff --git a/src/tools/pcb_reader/main.cpp b/src/tools/pcb_reader/main.cpp index 1ca8e8b5..7c92eb63 100644 --- a/src/tools/pcb_reader/main.cpp +++ b/src/tools/pcb_reader/main.cpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include "pcb.h" #include "lgb.h" @@ -21,7 +23,6 @@ #include #include #include -#include #endif @@ -132,14 +133,14 @@ void dumpLevelExdEntries( uint32_t zoneId, const std::string& name = std::string { auto id = row.first; auto& fields = row.second; - auto x = *boost::get< float >( &fields.at( 0 ) ); - auto y = *boost::get< float >( &fields.at( 1 ) ); - auto z = *boost::get< float >( &fields.at( 2 ) ); - auto yaw = *boost::get< float >( &fields.at( 3 ) ); - auto radius = *boost::get< float >( &fields.at( 4 ) ); - auto type = *boost::get< uint8_t >( &fields.at( 5 ) ); - auto objectid = *boost::get< uint32_t >( &fields.at( 6 ) ); - auto zone = *boost::get< uint16_t >( &fields.at( 9 ) ); + auto x = std::get< float >( fields.at( 0 ) ); + auto y = std::get< float >( fields.at( 1 ) ); + auto z = std::get< float >( fields.at( 2 ) ); + auto yaw = std::get< float >( fields.at( 3 ) ); + auto radius = std::get< float >( fields.at( 4 ) ); + auto type = std::get< uint8_t >( fields.at( 5 ) ); + auto objectid = std::get< uint32_t >( fields.at( 6 ) ); + auto zone = std::get< uint16_t >( fields.at( 9 ) ); if( zone == zoneId ) { @@ -189,12 +190,12 @@ std::string zoneNameToPath( const std::string& name ) for( auto& row : exd.get_rows() ) { auto& fields = row.second; - auto teriName = *boost::get< std::string >( - &fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::TerritoryType ) ) ); + auto teriName = std::get< std::string >( + fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::TerritoryType ) ) ); if( teriName.empty() ) continue; - auto teriPath = *boost::get< std::string >( &fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::Path ) ) ); - if( !found && boost::iequals( name, teriName ) ) + auto teriPath = std::get< std::string >( fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::Path ) ) ); + if( !found && ( Core::Util::toLowerCopy( name ) == Core::Util::toLowerCopy( teriName ) ) ) { path = teriPath; found = true; @@ -228,7 +229,7 @@ void loadEobjNames() { auto id = row.first; auto& fields = row.second; - auto name = *boost::get< std::string >( &fields.at( 0 ) ); + auto name = std::get< std::string >( fields.at( 0 ) ); eobjNameMap[ id ] = name; } } @@ -298,10 +299,10 @@ void loadAllInstanceContentEntries() auto id = row.first; auto& fields = row.second; - auto name = *boost::get< std::string >( &fields.at( 3 ) ); + auto name = std::get< std::string >( fields.at( 3 ) ); if( name.empty() ) continue; - auto teri = *boost::get< uint32_t >( &fields.at( 9 ) ); + auto teri = std::get< uint32_t >( fields.at( 9 ) ); auto i = 0; while( ( i = name.find( ' ' ) ) != std::string::npos ) name = name.replace( name.begin() + i, name.begin() + i + 1, { '_' } );