Remove unused function

This commit is contained in:
Chris Thrasher 2023-12-17 15:41:31 -07:00
parent d1eb21e04f
commit 22b518af1f
4 changed files with 15 additions and 107 deletions

View File

@ -165,8 +165,6 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
elseif(SFML_OS_MACOS)
enable_language(OBJC OBJCXX)
set(PLATFORM_SRC
${SRCROOT}/macOS/cpp_objc_conversion.h
${SRCROOT}/macOS/cpp_objc_conversion.mm
${SRCROOT}/macOS/cg_sf_conversion.hpp
${SRCROOT}/macOS/cg_sf_conversion.mm
${SRCROOT}/macOS/CursorImpl.hpp

View File

@ -34,7 +34,6 @@
#import <SFML/Window/macOS/SFWindowController.h>
#import <SFML/Window/macOS/Scaling.h>
#include <SFML/Window/macOS/WindowImplCocoa.hpp>
#import <SFML/Window/macOS/cpp_objc_conversion.h>
#include <SFML/System/Err.hpp>
#include <SFML/System/String.hpp>
@ -55,6 +54,21 @@ namespace sf::priv
namespace
{
bool isCursorHidden = false; // initially, the cursor is visible
NSString* sfStringToNSString(const sf::String& string)
{
const auto length = static_cast<std::uint32_t>(string.getSize() * sizeof(std::uint32_t));
const void* data = reinterpret_cast<const void*>(string.getData());
NSStringEncoding encoding;
if (NSHostByteOrder() == NS_LittleEndian)
encoding = NSUTF32LittleEndianStringEncoding;
else
encoding = NSUTF32BigEndianStringEncoding;
NSString* const str = [[NSString alloc] initWithBytes:data length:length encoding:encoding];
return [str autorelease];
}
}

View File

@ -1,44 +0,0 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2023 Marco Antognini (antognini.marco@gmail.com),
// Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/String.hpp>
#import <Foundation/Foundation.h>
#include <string>
////////////////////////////////////////////////////////////
/// \brief Returns a NSString construct with +stringWithCString:encoding:
///
////////////////////////////////////////////////////////////
NSString* stringToNSString(const std::string& string);
////////////////////////////////////////////////////////////
/// \brief Returns a NSString construct with +stringWithCString:encoding:
///
////////////////////////////////////////////////////////////
NSString* sfStringToNSString(const sf::String& string);

View File

@ -1,60 +0,0 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2023 Marco Antognini (antognini.marco@gmail.com),
// Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#import <SFML/Window/macOS/cpp_objc_conversion.h>
#include <SFML/System/Utf.hpp>
#import <Foundation/Foundation.h>
////////////////////////////////////////////////////////////
NSString* stringToNSString(const std::string& string)
{
std::string utf8;
utf8.reserve(string.size() + 1);
sf::Utf8::fromAnsi(string.begin(), string.end(), std::back_inserter(utf8));
NSString* const str = [NSString stringWithCString:utf8.c_str() encoding:NSUTF8StringEncoding];
return str;
}
////////////////////////////////////////////////////////////
NSString* sfStringToNSString(const sf::String& string)
{
const auto length = static_cast<std::uint32_t>(string.getSize() * sizeof(std::uint32_t));
const void* data = reinterpret_cast<const void*>(string.getData());
NSStringEncoding encoding;
if (NSHostByteOrder() == NS_LittleEndian)
encoding = NSUTF32LittleEndianStringEncoding;
else
encoding = NSUTF32BigEndianStringEncoding;
NSString* const str = [[NSString alloc] initWithBytes:data length:length encoding:encoding];
return [str autorelease];
}