Commit Graph
55 Commits
Author SHA1 Message Date
Eugene Sandulenko 63f39ca792 COMMON: Rename base-str.* to str-base.* for consistency and file grouping 2023-01-05 14:21:23 +01:00
Cameron Cawley 29024cded7 COMMON: Fix handling negative numbers in Common::U32String::format 2022-11-20 14:23:30 +01:00
Le Philousophe 032904f626 COMMON: Use forward to avoid extraneous copies
This is more a test than really useful as printf doesn't take objects
with move semantics
2022-10-30 18:37:16 +01:00
elasota cdedda7fa8 COMMON: Add move semantic assign and construct to strings 2022-09-28 17:09:34 +02:00
elasota 55d31b0260 COMMON: Pass U32String format params by reference and fix warnings about passing a non-trivial class to va_start. 2022-09-24 10:16:24 +02:00
Le Philousophe 092cb26b50 Revert "COMMON: Avoid passing U32String full object as parameter"
This reverts commit 64675dbba6.
It fails on MSVC with error:
C2338    static_assert failed: 'va_start argument must not have reference type and must not be parenthesized'
2022-09-18 22:46:54 +02:00
Le Philousophe 64675dbba6 COMMON: Avoid passing U32String full object as parameter
Use a const reference instead
2022-09-18 16:15:56 +02:00
elasota 2cad62a6ec COMMON: Add string encoding API with more detailed error behavior. 2022-07-02 12:53:50 +02:00
athrxx b5079ca5c7 COMMON: add Korean Johab string encoding 2022-06-13 19:38:47 +02:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Eugene Sandulenko c544e5119b COMMON: Remove USE_CXX11 checks, it is now always present 2021-10-31 11:52:29 +02:00
djsrv b2988ce682 COMMON: Add constructor to make U32String from a character 2021-07-15 16:31:47 -04:00
djsrv e6a5380989 COMMON: Add U32String version of toPrintable
This only escapes ASCII control characters, not characters wih
codepoints > 127.
2021-07-12 15:41:21 -04:00
Orgad Shaneh a05e54f00c JANITORIAL: Remove trailing whitespaces 2021-05-04 11:46:30 +03:00
Orgad Shaneh b49e6eb96f JANITORIAL: Fix some excess tabs 2021-04-15 23:18:08 +03:00
Eugene Sandulenko 5e7fe2dc57 JANITORIAL: Replace spaces in indentation with tabs 2021-04-15 21:20:36 +02:00
Bartosz Gentkowski fe9c51892c DOXYGEN: doxygen review on remaining common headers
- textconsole.h
- timer.h
- translation.h
- ustr.h
- util.h
2020-11-22 16:57:25 +00:00
Vladimir Serbinenko 68a9136e4d COMMON: Rewrite Encoder and drop dependency on iconv (#2586)
Different platforms have different levels of support of encodings and
often have slight variations. We already have tables for most encoding
with only CJK missing. Full transcoding inclusion allows us to get reliable
encoding results independently of platform. The biggest con is the need for
external tables encoding.dat.

It removes a duplicate table for korean in graphics/korfont.cpp
2020-11-15 16:20:35 +01:00
Thierry Crozat efa9a0f250 COMMON: Add conversion operator from UnicodeBiDiText to U32String
This replaces the U32String constructor that takes a UnicodeBiDiText
and serves the same purpose, but avoids making a copy.
2020-11-07 18:10:44 +00:00
Thierry Crozat e5bfe63087 COMMON: Merge the String and U32String destructors
The call to decRefCount has been moved to the destructor
of the base class BaseString.

Note that BaseString only exists for the purpose of being able
to reuse code for our String and U32String implementations. As
such it is not meant to be used polymorphically and its
destructor does not need to be virtual (with the overhead that
this generates). And to ensure that it is not used in a
polymorphic way, the destructor is declared protected.
2020-11-05 23:52:19 +00:00
Thierry Crozat f18ee89b27 JANITORIAL: Fix indentation issues 2020-11-05 23:52:19 +00:00
Vladimir Serbinenko 3fc822e55c COMMON: introduce substr for U32String (#2585)
It's safer than direct array manipulation. Replace current uses
of subsetting with substr.
2020-11-01 22:53:03 +01:00
Thierry Crozat 0b93a68a0d COMMON: Attempt to fix compilation for some compilers 2020-10-31 16:56:50 +00:00
Vladimir Serbinenko 29cfa7bb0f COMMON: Merge code for str.cpp and ustr.cpp
Most of the code in str.cpp and ustr.cpp is actually the same. Do some
template magic to merge them.
2020-10-31 14:05:30 +01:00
Bartosz Gentkowski ec24687ce4 DOXYGEN: Add doxygen groups to header files in the common folder
Adding @defgroup and @ingroup doxygen tags into all headers
in the common folder that contain doxygen blocks.

This improves the structure, readability, and findability
of information in the resulting output.

This commit targets purely structure and does not deal with
the content of the currently existing doxygen documentation.
2020-10-04 18:25:50 +02:00
Thierry Crozat 54f825359f COMMON: Allow using U32String::format with a C string format string 2020-09-08 21:22:04 +01:00
Thierry Crozat 9ab48df4b6 COMMON: Fix comparaison operators for U32String
They were supposed to compare two U32String, but due to a copy/paste
error they were comparing a U32String with a String. It compiled
because there is a String constructor that takes a U32String (and
converts it to UTF-8), but it was probably not quite working as
expected for non-ASCII characters.
2020-09-02 21:01:15 +01:00
Thierry Crozat 9fcc83c09d COMMON: Add comparison operators to U32String
Those operators just compare the numerical value of each character
one by one. This is not idea, but this is better than nothing.
2020-09-02 12:08:49 +02:00
aryanrawlani28 ca54adca47 COMMON: U32: Fix different types of string pointers for u32
- Previous changes broke compilation for AmigaOS.
2020-08-30 18:56:12 +01:00
aryanrawlani28 140eddf90a GUI: U32: Allow vformat to take in a pointer to a translated string
- Fix signed/unsigned comparision in U32String::contains(U32String)
2020-08-30 14:43:41 +02:00
aryanrawlani28 2ca907b4a2 GUI: U32: Use game-list filters with u32
- Add a contains utility function to ustr
- setFilter uses U32String and U32Tokenizers
- Make consequent changes in launcher to allow sending u32strings
2020-08-30 14:43:41 +02:00
aryanrawlani28 12e4f871a3 GUI: U32: Improve u32 in all engine subsystems
- Common: add wordWrap function to ustr.cpp
- Bladerunner: Explicitly state we have a U32String in subs (same as Subtitles::loadOuttakeSubsText)
- Don't use translations for engine specific "put strings", because they might not support.
- SCI: Use const references for showScummVMDialog
- SCUMM:
-- Don't use translation in md5 warning. left comments with the translated version.
-- Remove some redundant headers in help.cpp
-- Don't use translation in handleSaveload when printing to console
-- Also, display success transaction correctly via u32::format
- TESTBED: Use fake constructor when setting label of button
- SKY: Correctly use translation when using SaveStateDescription
- ULTIMA: Don't use translations when display_string
- ENGINES:
-- GenerateUnknownGameReport correctly, with proper translations.
-- There was an error, where a function had been declared twice, in a header file. Correct this.
2020-08-30 14:43:41 +02:00
aryanrawlani28 a9a816e7fe GUI: U32: Improve U32String::format
- Keep adding chars and strings to output instead of deleting and inserting at specific pos
- Use const_iterators for input
2020-08-30 14:43:41 +02:00
aryanrawlani28 c142360bf4 GUI: U32: Add minimal implementation for itoa (base 10) 2020-08-30 14:43:41 +02:00
aryanrawlani28 da380a9002 GUI: U32: Fix issues with ustr formatting
- Fix one off error with 'pos'
- Fix last line not being inserted in osdMessage when display
2020-08-30 14:43:41 +02:00
aryanrawlani28 1ca1712b4d GUI: U32: Fix problems with u32strings formatting
- Improve U32's format helper
- Add insertString helper to u32
2020-08-30 14:43:41 +02:00
aryanrawlani28 f800ca4ada GUI: U32: Convert majority of code to use U32
This commit also includes some additional major changes.

- Return U32String from TransMan getTranslation()
- Change tooltips to be U32Strings
- Remove temporary code of convertToU32String
- U32 Support various dialogs (Browser, FileBrowser, Messages, Chooser, etc)
- U32 for music plugins
- U32 for OSD messages
- Add some helper functions to ustr.cpp
- Change default tooltips from nullptr & 0 -> ""
- Some runtime exceptions may occur when changing languages due to incorrect String::Format
2020-08-30 14:43:41 +02:00
aryanrawlani28 4ea2b46ce8 GUI: U32: Add asuint64 helper to ustr 2020-08-30 14:43:41 +02:00
BLooperZ ec83715b43 COMMON: add UnicodeBiDiText wrapper 2020-05-12 14:36:09 +02:00
Eugene Sandulenko a5f2284421 COMMON: Added U32String::insertChar() 2020-05-01 01:30:20 +02:00
Paul Gilbert b2fd3ccacc ULTIMA8: Implement the toUnicode method 2020-02-19 19:51:08 -08:00
Le Philousophe b1d20e4b56 COMMON: Add find() method for character to U32String
This is like strchr but for uint32 based strings
2020-02-15 22:07:22 +01:00
Eugene Sandulenko 50822e708b COMMON: Moved string encoding to separate file 2019-10-19 17:38:26 +02:00
Eugene Sandulenko 9ff8e69aa9 COMMON: Added new + operator to U32String 2019-10-18 17:20:27 +02:00
Eugene Sandulenko dbf56a3b29 COMMON: Add methods to U32String to match String 2019-10-04 15:54:48 +02:00
lolbot-iichan 567a6b20e6 COMMON: Add conversion table for CP1254 2019-07-21 08:51:11 +03:00
lolbot-iichan 747ace78fc COMMON & WINTERMUTE: Use non-1252 for 125X games (PR 1698)
* WINTERMUTE: Add detection for "The Driller Incident"

"The Driller Incident" is a small freeware game for Wintermute,
avaliable in English and Russian: http://questzone.ru/enzi/files/1645

* WINTERMUTE: Add detection table for "One Helluva Day" demo

"One Helluva Day" is a point-and-click adventure demo in English / Czech
/ Russian.
Free download:
https://store.steampowered.com/app/603680/One_helluva_day/

* WINTERMUTE: Support CHARSET property for TT fonts

"// we don't need this anymore" was a mistake =)

Surely, most Wintermute games are either designed for 1252 language
(DE_DEU, EN_ANY, ES_ESP, FR_FRA, IT_ITA, PT_BRA), or don't use TrueType
fonts (5ma, deadcity, grotter1, grotter2, thekite, tib), or use
CHARSET=1 with UTF strings (dirtysplit, reversion1, reversion2, twc),
which meen this conversion is not needed for those games.

However, there are some games that explicitly states CHARSET=10 (driller
(RU_RUS), oknytt (RU_RUS), onehelluvaday (UNK_LANG when playing as
Russian)) and there are some games with CHARSET=1 with non-1252 in mind
(bookofgron (RU_RUS excepts 1251), carolreed4 (RU_RUS excepts 1251),
kulivocko (CZ_CZE excepts 1250)).

This fixes text in some games: bookofgron, carolreed4, driller, kulivocko,
oknytt, onehelluvaday.

* WINTERMUTE: Break savegame compatibility

sizeof(BaseFontTT) was changed, so let's break savegame compatibility

* COMMON: Add conversion tables for win1253 and win1257

* COMMON: Add string conversion from U32String back to Common::String

convertUtf32ToUtf8 code is based on Wintermute::ConvertUTF32toUTF8
convertFromU32String use convertUtf32ToUtf8 for UTF8 or lookup through
conversion table for single-byte encodings

* WINTERMUTE: Use Common::convert functions for non-UTF charsets

* WINTERMUTE: Fix whitespaces at detection tables

* WINTERMUTE: Add TODO comments
2019-06-30 16:45:46 +03:00
Paul Gilbert 7643382ff4 COMMON: Suport String in U32String assignment & equality operators 2019-01-01 00:40:17 -08:00
Andrei Prykhodko 47130eceb3 COMMON: changed code page constant name from ascii to utf8 2018-08-05 22:50:42 +03:00
Andrei Prykhodko 9948b2452f COMMON: named CodePage enum 2018-08-05 21:53:31 +03:00