mirror of
https://github.com/4ian/GDevelop.git
synced 2026-10-12 02:01:17 +00:00
Remove Utf8Tools.h
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
#include "GDCore/BuiltinExtensions/SpriteExtension/Sprite.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "GDCore/Events/Builtin/LinkEvent.h"
|
||||
#include "GDCore/IDE/Dialogs/EditLink.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "GDCore/IDE/Dialogs/EditExpressionDialog.h"
|
||||
#include "GDCore/IDE/Dialogs/EditStrExpressionDialog.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
namespace gd { class Project; }
|
||||
namespace gd { class Layout; }
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "GDCore/PlatformDefinition/Variable.h"
|
||||
#include "GDCore/Tools/HelpFileAccess.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
|
||||
namespace gd
|
||||
{
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "GDCore/Events/ExpressionMetadata.h"
|
||||
#include "GDCore/Tools/HelpFileAccess.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "EditExpressionDialog.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "GDCore/PlatformDefinition/Project.h"
|
||||
#include "GDCore/PlatformDefinition/Layout.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include <wx/help.h>
|
||||
|
||||
namespace gd
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "GDCore/PlatformDefinition/Layout.h"
|
||||
#include "GDCore/Events/ExpressionMetadata.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "GDCore/Tools/HelpFileAccess.h"
|
||||
#include "EditStrExpressionDialog.h"
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "GDCore/String.h"
|
||||
#include <iostream>
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "GDCore/IDE/CommonBitmapManager.h"
|
||||
#include "GDCore/IDE/InstructionSentenceFormatter.h"
|
||||
#include "ParameterControlsHelper.h"
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
#include "GDCore/IDE/wxTools/FileProperty.h"
|
||||
#include "GDCore/IDE/SkinHelper.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "GDCore/Tools/Log.h"
|
||||
#include "GDCore/IDE/Dialogs/DndResourcesEditor.h"
|
||||
#include "GDCore/IDE/wxTools/TreeItemStringData.h"
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <wx/dcclient.h>
|
||||
#include <wx/dcmemory.h>
|
||||
#include <wx/renderer.h>
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
#include "GDCore/PlatformDefinition/Platform.h"
|
||||
#include "GDCore/IDE/MetadataProvider.h"
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "GDCore/IDE/PlatformManager.h"
|
||||
#include "GDCore/IDE/wxTools/SafeYield.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "GDCore/Utf8/utf8.h"
|
||||
#include "GDCore/TinyXml/tinyxml.h"
|
||||
#include "GDCore/Tools/VersionWrapper.h"
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "GDCore/PlatformDefinition/Project.h"
|
||||
#include "GDCore/PlatformDefinition/ResourcesManager.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "GDCore/Serialization/Serializer.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/Tools/Log.h"
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
|
||||
#include <wx/intl.h>
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "GDCore/String.h"
|
||||
//Create a new macro to return UTF8 gd::String from a translation
|
||||
#if defined(_)
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
|
||||
#include <wx/log.h>
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#else
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
@@ -1,209 +0,0 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2015 Victor Levasseur ([email protected]).
|
||||
* This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "GDCore/Utf8/utf8.h"
|
||||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
|
||||
#include <wx/string.h>
|
||||
#endif
|
||||
|
||||
namespace gd
|
||||
{
|
||||
|
||||
namespace utf8
|
||||
{
|
||||
|
||||
std::string GD_CORE_API FromLocaleString( const std::string &str )
|
||||
{
|
||||
#if defined(WINDOWS)
|
||||
return FromSfString(sf::String(str)); //Don't need to use the current locale, on Windows, std::locale is always the C locale
|
||||
#else
|
||||
if(IsUTF8Locale())
|
||||
return str; //UTF8 is already the current locale
|
||||
else
|
||||
return FromSfString(sf::String(str, std::locale(""))); //Use the current locale (std::locale("")) for conversion
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string GD_CORE_API ToLocaleString( const std::string &utf8str )
|
||||
{
|
||||
#if defined(WINDOWS)
|
||||
return ToSfString(utf8str).toAnsiString();
|
||||
#else
|
||||
if(IsUTF8Locale())
|
||||
return utf8str; //UTF8 is already the current locale on Linux
|
||||
else
|
||||
return ToSfString(utf8str).toAnsiString(std::locale("")); //Use the current locale for conversion
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
|
||||
|
||||
std::string GD_CORE_API FromWxString( const wxString &str )
|
||||
{
|
||||
return std::string(str.ToUTF8().data());
|
||||
}
|
||||
|
||||
wxString GD_CORE_API ToWxString( const std::string &utf8str )
|
||||
{
|
||||
return wxString::FromUTF8(utf8str.c_str());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
std::string GD_CORE_API FromSfString( const sf::String &str )
|
||||
{
|
||||
std::string utf8str;
|
||||
::utf8::utf32to8(str.begin(), str.end(), std::back_inserter(utf8str));
|
||||
|
||||
return utf8str;
|
||||
}
|
||||
|
||||
sf::String GD_CORE_API ToSfString( const std::string &utf8str )
|
||||
{
|
||||
std::basic_string<sf::Uint32> utf32str;
|
||||
::utf8::utf8to32(utf8str.begin(), utf8str.end(), std::back_inserter(utf32str));
|
||||
|
||||
return sf::String(utf32str);
|
||||
}
|
||||
|
||||
std::wstring GD_CORE_API ToWString( const std::string &utf8str )
|
||||
{
|
||||
std::wstring wstr;
|
||||
|
||||
#ifdef WINDOWS //std::wstring is an UTF16 string on Windows
|
||||
::utf8::utf8to16(utf8str.begin(), utf8str.end(), std::back_inserter(wstr));
|
||||
#else //and a UTF32 string on other OSes
|
||||
::utf8::utf8to32(utf8str.begin(), utf8str.end(), std::back_inserter(wstr));
|
||||
#endif
|
||||
|
||||
return wstr;
|
||||
}
|
||||
|
||||
std::string GD_CORE_API FromWString( const std::wstring &wstr )
|
||||
{
|
||||
std::string utf8str;
|
||||
|
||||
#ifdef WINDOWS //std::wstring is an UTF16 string on Windows
|
||||
::utf8::utf16to8(wstr.begin(), wstr.end(), std::back_inserter(utf8str));
|
||||
#else //and a UTF32 string on other OSes
|
||||
::utf8::utf32to8(wstr.begin(), wstr.end(), std::back_inserter(utf8str));
|
||||
#endif
|
||||
|
||||
return utf8str;
|
||||
}
|
||||
|
||||
std::string GD_CORE_API ReplaceInvalid( const std::string &utf8str )
|
||||
{
|
||||
std::string validStr;
|
||||
|
||||
try
|
||||
{
|
||||
::utf8::replace_invalid(utf8str.begin(), utf8str.end(), std::back_inserter(validStr));
|
||||
}
|
||||
catch(const std::exception &exc)
|
||||
{
|
||||
std::cout << "[UTF8] invalid codepoint replacement warning : " << exc.what() << std::endl;
|
||||
}
|
||||
|
||||
return validStr;
|
||||
}
|
||||
|
||||
std::size_t GD_CORE_API StrLength( const std::string &utf8str )
|
||||
{
|
||||
return ::utf8::distance(utf8str.begin(), utf8str.end());
|
||||
}
|
||||
|
||||
std::string GD_CORE_API SubStr( const std::string &utf8str, std::size_t pos, std::size_t len )
|
||||
{
|
||||
auto it = utf8str.begin();
|
||||
|
||||
//Move to pos
|
||||
try
|
||||
{
|
||||
::utf8::advance(it, pos, utf8str.end());
|
||||
}
|
||||
catch(const ::utf8::not_enough_room &exc)
|
||||
{
|
||||
throw std::out_of_range("[UTF8] substr starting position is greater than the original string size");
|
||||
}
|
||||
|
||||
//Copy needed code points to the new string
|
||||
std::string utf8substr;
|
||||
for(int i = 0; i < len && it != utf8str.end(); i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Append the character
|
||||
::utf8::append(::utf8::next(it, utf8str.end()), std::back_inserter(utf8substr));
|
||||
}
|
||||
catch(const std::exception &exc)
|
||||
{
|
||||
std::cout << "[UTF8] SubStr : " << exc.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return utf8substr;
|
||||
}
|
||||
|
||||
std::size_t GD_CORE_API Find( const std::string &utf8str, const std::string &search, std::size_t pos )
|
||||
{
|
||||
//Find where is really "pos" in the UTF8 string
|
||||
auto it = utf8str.begin();
|
||||
try
|
||||
{
|
||||
::utf8::advance(it, pos, utf8str.end());
|
||||
}
|
||||
catch(const std::exception &exc)
|
||||
{
|
||||
return std::string::npos;
|
||||
}
|
||||
|
||||
//Search using the standard method
|
||||
std::size_t findPos = utf8str.find(search, std::distance(utf8str.begin(), it)); //Use the real distance in bytes in the standard find method
|
||||
|
||||
if(findPos != std::string::npos)
|
||||
return ::utf8::distance(utf8str.begin(), utf8str.begin() + findPos); //Return the position (considering UTF8 multibyte char)
|
||||
else
|
||||
return std::string::npos;
|
||||
}
|
||||
|
||||
std::size_t GD_CORE_API RFind( const std::string &utf8str, const std::string &search, std::size_t pos )
|
||||
{
|
||||
//Find where is really "pos" in the UTF8 string
|
||||
auto it = utf8str.begin();
|
||||
try
|
||||
{
|
||||
::utf8::advance(it, pos + 1, utf8str.end()); //We need to get to the next character (because it will be included in the search)
|
||||
--it; //Make it pointing to the end of the previous codepoint (that's why we needed the character next to "pos")
|
||||
}
|
||||
catch(const ::utf8::not_enough_room &exc)
|
||||
{
|
||||
//If the position is after the end of the string, we need to search the whole string
|
||||
it = utf8str.end();
|
||||
}
|
||||
|
||||
//Search using the standard method
|
||||
std::size_t findPos = utf8str.rfind(search, std::distance(utf8str.begin(), it)); //Use the real distance in bytes in the standard rfind method
|
||||
|
||||
if(findPos != std::string::npos)
|
||||
return ::utf8::distance(utf8str.begin(), utf8str.begin() + findPos); //Return the position (considering UTF8 multibyte char)
|
||||
else
|
||||
return std::string::npos;
|
||||
}
|
||||
|
||||
bool GD_CORE_API IsUTF8Locale()
|
||||
{
|
||||
return (std::locale("").name().find("UTF-8") != std::string::npos);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,239 +0,0 @@
|
||||
#ifndef GDCORE_UTF8TOOLS_H
|
||||
#define GDCORE_UTF8TOOLS_H
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2015 Victor Levasseur ([email protected]).
|
||||
* This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <SFML/System/String.hpp>
|
||||
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
|
||||
class wxString;
|
||||
#endif
|
||||
|
||||
/** \file */
|
||||
|
||||
/**
|
||||
* \defgroup utf8support UTF8 Tools
|
||||
* \brief Contains functions to deal with UTF8 encoded std::string used by GDevelop (GDCore) and GDCpp games.
|
||||
* \code
|
||||
* #include "GDCore/Utf8Tools.h"
|
||||
* \endcode
|
||||
* GDevelop uses std::strings to store its character strings. These strings are encoded in UTF8. As UTF8 is a variable size encoding,
|
||||
* some of the default std::string function can not be used anymore (size, substr, ...).
|
||||
* There are also other functions to convert from/to other string classes (like sf::String and wxString) as their default conversion methods
|
||||
* assumes that std::strings are encoded in the current locale (and that is not the case as there are encoded in UTF8).
|
||||
*
|
||||
* \warning std::strings containing file or folder paths are not encoded in the OS locale (it is not needed).
|
||||
* This does not mean that it can not be encoded in UTF8. In fact, on most Linux OSes, the locale is UTF8, so, paths will still be encoded in UTF8.
|
||||
* On Windows, the locale is not UTF8 but an ASCII codepage so paths will be encoded in an ASCII codepage.
|
||||
*
|
||||
* \section utf8translations How to handle translations correctly ? Difference between _() and _() ?
|
||||
* As all std::strings are encoded in UTF8, GDevelop can not rely on the default conversion between std::string and wxString.
|
||||
* So, each of these two macros creates a translatable string but not the same type of string.
|
||||
* - _() creates a translatable string as an std::string (useful for actions/conditions declaration and everywhere a std::string is needed)
|
||||
* - _() creates a translatable string as an wxString (useful everywhere a wxString is needed, like in GUI)
|
||||
* \warning If you use the wrong macro, the compilation might still work but strange behaviors with special characters might occur (particulary on Windows).
|
||||
*
|
||||
* \section howtouseutf8 How to use UTF8 strings ?
|
||||
* Although UTF8 strings are stored inside std::string, some utility functions should be used instead of std::string methods.
|
||||
* As UTF8 characters can be represented by a variable length array of char, the std::string::size() method is invalidated (it will return
|
||||
* the amount of bytes representing the string) and gd::utf8::StrLength should be used instead.
|
||||
* Here is the list of changed functions
|
||||
* - myString.size() becomes gd::utf8::StrLength(myString);
|
||||
* - myString.substr(i, len) becomes gd::utf8::SubStr(myString, i, len)
|
||||
* \note Some parts of GDevelop do not use these functions (like the object editor), it is because objects names can not contain special
|
||||
* characters (so there are like pure ASCII strings).
|
||||
*/
|
||||
|
||||
namespace gd
|
||||
{
|
||||
|
||||
/**
|
||||
\brief UTF8 tools
|
||||
*/
|
||||
namespace utf8
|
||||
{
|
||||
|
||||
/**
|
||||
* \name Conversion from or to current locale
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Convert a locale std::string to an UTF8 encoded string
|
||||
* Convert a std::string encoded in the current locale to an UTF8 encoded string.
|
||||
* \param str a string encoded in the current locale
|
||||
* \return a string encoded in UTF8
|
||||
* \ingroup utf8support
|
||||
*/
|
||||
std::string GD_CORE_API FromLocaleString( const std::string &str );
|
||||
|
||||
/**
|
||||
* \brief Convert an UTF8 encoded std::string to a std::string encoded in the current locale
|
||||
* Convert a std::string encoded in UTF8 to a std::string encoded in the current locale.
|
||||
* \param utf8str a string encoded in UTF8
|
||||
* \return a string encoded in the current locale
|
||||
* \ingroup utf8support
|
||||
*/
|
||||
std::string GD_CORE_API ToLocaleString( const std::string &utf8str );
|
||||
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
|
||||
|
||||
/**
|
||||
* \name Conversion from or to wxString
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Convert a wxString to an UTF8 encoded string
|
||||
* \param str a wxString
|
||||
* \return a string encoded in UTF8
|
||||
* \note Only available when GDevelop is compiled with wxWidgets (not in Runtime Cpp games).
|
||||
* \ingroup utf8support
|
||||
*/
|
||||
std::string GD_CORE_API FromWxString( const wxString &str );
|
||||
|
||||
/**
|
||||
* \brief Convert an UTF8 encoded std::string to a wxString
|
||||
* \param str a string encoded in UTF8
|
||||
* \return a wxString
|
||||
* \note Only available when GDevelop is compiled with wxWidgets (not in Runtime Cpp games).
|
||||
* \ingroup utf8support
|
||||
*/
|
||||
wxString GD_CORE_API ToWxString( const std::string &utf8str );
|
||||
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \name Conversion from or to sf::String
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Convert a sf::String to an UTF8 encoded string
|
||||
* \param str a sf::String
|
||||
* \return a string encoded in UTF8
|
||||
* \ingroup utf8support
|
||||
*/
|
||||
std::string GD_CORE_API FromSfString( const sf::String &str );
|
||||
|
||||
/**
|
||||
* \brief Convert an UTF8 encoded std::string to a sf::String
|
||||
* \param str a string encoded in UTF8
|
||||
* \return a sf::String
|
||||
* \ingroup utf8support
|
||||
*/
|
||||
sf::String GD_CORE_API ToSfString( const std::string &utf8str );
|
||||
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
|
||||
/**
|
||||
* \name Conversion from or to std::wstring
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Convert a std::wstring to an UTF8 encoded string
|
||||
* \param str a std::wstring
|
||||
* \return a string encoded in UTF8
|
||||
* \ingroup utf8support
|
||||
*/
|
||||
std::string GD_CORE_API FromWString( const std::wstring &wstr );
|
||||
|
||||
/**
|
||||
* \brief Convert an UTF8 encoded std::string to a std::wstring
|
||||
* \param str a string encoded in UTF8
|
||||
* \return a std::wstring
|
||||
* \ingroup utf8support
|
||||
*/
|
||||
std::wstring GD_CORE_API ToWString( const std::string &utf8str );
|
||||
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
|
||||
/**
|
||||
* \name Utility functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Remove all invalid characters from an UTF8 string
|
||||
* \param utf8str an UTF8 encoded string that may contain invalid characters
|
||||
* \return the UTF8 encoded string without invalid characters
|
||||
* \ingroup utf8support
|
||||
*/
|
||||
std::string GD_CORE_API ReplaceInvalid( const std::string &utf8str );
|
||||
|
||||
/**
|
||||
* \brief Get the size of an UTF8 encoded string
|
||||
* \param utf8str a UTF8 encoded string
|
||||
* \return the size of the UTF8 encoded string
|
||||
* \ingroup utf8support
|
||||
*/
|
||||
std::size_t GD_CORE_API StrLength( const std::string &utf8str );
|
||||
|
||||
/**
|
||||
* \brief Get a substring from an UTF8 encoded string
|
||||
* \param utf8str a UTF8 encoded string
|
||||
* \param pos position of the first character to be copied as a substring
|
||||
* \param len number of characters to be copied as a substring
|
||||
* \return a substring
|
||||
* \ingroup utf8support
|
||||
*/
|
||||
std::string GD_CORE_API SubStr( const std::string &utf8str, std::size_t pos, std::size_t len );
|
||||
|
||||
/**
|
||||
* \brief Find the first occurence from a string in another one
|
||||
* \param utf8str a UTF8 encoded string
|
||||
* \param search the UTF8 encoded string to look for in utf8str
|
||||
* \param pos the first character to be considered in the search
|
||||
* \return the position of the first match (beginning of the match)
|
||||
* \ingroup utf8support
|
||||
*/
|
||||
std::size_t GD_CORE_API Find( const std::string &utf8str, const std::string &search, std::size_t pos = 0 );
|
||||
|
||||
/**
|
||||
* \brief Find the last occurence from a string in another one
|
||||
* \param utf8str a UTF8 encoded string
|
||||
* \param search the UTF8 encoded string to look for in utf8str
|
||||
* \param pos the last character to be considered as the beginning of the search
|
||||
* \return the position of the last match (beginning of the match)
|
||||
* \ingroup utf8support
|
||||
*/
|
||||
std::size_t GD_CORE_API RFind( const std::string &utf8str, const std::string &search, std::size_t pos = std::string::npos );
|
||||
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
|
||||
/**
|
||||
* \name Locale functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
bool GD_CORE_API IsUTF8Locale();
|
||||
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif //GDCORE_UTF8TOOLS_H
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <vector>
|
||||
#include "catch.hpp"
|
||||
#include "GDCore/String.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include <SFML/System/String.hpp>
|
||||
|
||||
TEST_CASE( "Utf8 String", "[common][utf8]") {
|
||||
|
||||
@@ -15,7 +15,6 @@ This project is released under the MIT License.
|
||||
#include "GDCpp/Object.h"
|
||||
#include "GDCpp/RuntimeScene.h"
|
||||
#include "GDCpp/Variable.h"
|
||||
#include "GDCpp/Utf8Tools.h"
|
||||
|
||||
//Windows build uses native windows-dialogs
|
||||
#if defined(WINDOWS)
|
||||
|
||||
@@ -17,7 +17,6 @@ This project is released under the MIT License.
|
||||
#include "GDCpp/Position.h"
|
||||
#include "GDCpp/Project.h"
|
||||
#include "GDCpp/RuntimeScene.h"
|
||||
#include "GDCpp/Utf8Tools.h"
|
||||
#include "GDCore/Utf8/utf8.h"
|
||||
#include "TextEntryObject.h"
|
||||
#if defined(GD_IDE_ONLY)
|
||||
|
||||
@@ -17,7 +17,6 @@ This project is released under the MIT License.
|
||||
#include "GDCpp/Position.h"
|
||||
#include "GDCpp/Polygon2d.h"
|
||||
#include "GDCpp/CommonTools.h"
|
||||
#include "GDCpp/Utf8Tools.h"
|
||||
#include "GDCpp/Serialization/SerializerElement.h"
|
||||
#include "TextObject.h"
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ This project is released under the MIT License.
|
||||
#include "GDCore/PlatformDefinition/Project.h"
|
||||
#include "GDCore/IDE/Dialogs/MainFrameWrapper.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "TextObject.h"
|
||||
|
||||
//(*IdInit(TextObjectEditor)
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <string>
|
||||
#include "GDCpp/RuntimeScene.h"
|
||||
#include "GDCpp/String.h"
|
||||
#include "GDCpp/Utf8Tools.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
#include "GDCpp/RuntimeContext.h"
|
||||
#include "GDCpp/RuntimeObject.h"
|
||||
#include "GDCpp/CommonTools.h"
|
||||
#include "GDCpp/Utf8Tools.h"
|
||||
#include "GDCpp/String.h"
|
||||
#include "GDCpp/SourceFileCommonTools.h"
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "GDCore/IDE/SkinHelper.h"
|
||||
#include "GDCore/PlatformDefinition/ImageManager.h"
|
||||
#include "GDCore/PlatformDefinition/LayoutEditorPreviewer.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "GDCpp/Project.h"
|
||||
#include "GDCpp/RuntimeScene.h"
|
||||
#include "GDCpp/Project.h"
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include "GDCpp/CommonTools.h"
|
||||
#include "GDCpp/Utf8Tools.h"
|
||||
#include "GDCpp/ExtensionBase.h"
|
||||
#include "GDCpp/Project.h"
|
||||
#include "GDCpp/RuntimeGame.h"
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "GDCpp/Scene.h"
|
||||
#include "GDCpp/CppCodeEvent.h"
|
||||
#include "GDCpp/CommonTools.h"
|
||||
#include "GDCpp/Utf8Tools.h"
|
||||
#include "GDCpp/IDE/CodeCompiler.h"
|
||||
#include "GDCore/IDE/EventsRenderingHelper.h"
|
||||
#include "GDCore/IDE/Dialogs/ChooseObjectDialog.h"
|
||||
|
||||
@@ -496,7 +496,7 @@ void FullProjectCompiler::LaunchProjectCompilation()
|
||||
{
|
||||
wxFileName fileName(file);
|
||||
if ( !wxCopyFile( file, outDir + "/" + fileName.GetFullName(), true ) )
|
||||
diagnosticManager.AddError(_("Unable to copy file") + gd::utf8::FromWxString(file) + _(" from compilation directory to final directory.\n" ));
|
||||
diagnosticManager.AddError(_("Unable to copy file") + gd::String(file) + _(" from compilation directory to final directory.\n" ));
|
||||
|
||||
file = wxFindNextFile();
|
||||
}
|
||||
@@ -614,13 +614,13 @@ void FullProjectCompiler::ClearDirectory(gd::String directory)
|
||||
{
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
if ( !wxDirExists( directory ) && !wxMkdir( directory ) )
|
||||
diagnosticManager.AddError(_( "Unable to create directory:" ) + gd::utf8::FromWxString(directory) + "\n");
|
||||
diagnosticManager.AddError(_( "Unable to create directory:" ) + directory + "\n");
|
||||
|
||||
wxString file = wxFindFirstFile( directory + "/*" );
|
||||
while ( !file.empty() )
|
||||
{
|
||||
if ( !wxRemoveFile( file ) )
|
||||
diagnosticManager.AddError(_("Unable to delete ") + gd::utf8::FromWxString(file) + _("in directory ")+gd::utf8::FromWxString(directory)+"\n" );
|
||||
diagnosticManager.AddError(_("Unable to delete ") + gd::String(file) + _("in directory ")+ directory +"\n" );
|
||||
|
||||
file = wxFindNextFile();
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
/*
|
||||
* GDevelop C++ Platform
|
||||
* Copyright 2015 Victor Levasseur ([email protected]).
|
||||
* This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#if !defined(GD_IDE_ONLY)
|
||||
#include "GDCore/Utf8Tools.cpp"
|
||||
#endif
|
||||
@@ -1,7 +0,0 @@
|
||||
/*
|
||||
* GDevelop C++ Platform
|
||||
* Copyright 2015 Victor Levasseur ([email protected]).
|
||||
* This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/config.h>
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "GDCore/PlatformDefinition/Project.h"
|
||||
#include "GDCore/PlatformDefinition/Object.h"
|
||||
#include "GDCore/PlatformDefinition/Layout.h"
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "GDCore/IDE/SkinHelper.h"
|
||||
#include "GDCore/IDE/wxTools/GUIContentScaleFactor.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "LogFileManager.h"
|
||||
#include "GDCpp/IDE/Dialogs/ProfileDlg.h"
|
||||
#include "SearchEvents.h"
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "GDCore/IDE/ExpressionsCorrectnessTesting.h"
|
||||
#include "GDCore/IDE/Dialogs/ProjectExtensionsDialog.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "GDCore/PlatformDefinition/Layout.h"
|
||||
#include "GDCore/PlatformDefinition/Project.h"
|
||||
#include "GDCore/PlatformDefinition/Object.h"
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "GDCore/IDE/Clipboard.h"
|
||||
#include "GDCore/IDE/wxTools/SafeYield.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8Tools.h"
|
||||
#include "Dialogs/ExternalLayoutEditor.h"
|
||||
#include "Dialogs/ProjectPropertiesPnl.h"
|
||||
#include "gdTreeItemProjectData.h"
|
||||
|
||||
Reference in New Issue
Block a user