libs/core.git
4 months agoProduce an octal escape code for \177 master
Mikko Rasa [Sun, 2 Jan 2022 10:13:04 +0000 (12:13 +0200)]
Produce an octal escape code for \177

This character is designated DEL and should be considered non-printable.

6 months agoAdd a flipped operator() to MemberCompare so upper_bound_member can work
Mikko Rasa [Tue, 23 Nov 2021 08:57:06 +0000 (10:57 +0200)]
Add a flipped operator() to MemberCompare so upper_bound_member can work

6 months agoAdd some more hash utility functions
Mikko Rasa [Wed, 17 Nov 2021 12:15:18 +0000 (14:15 +0200)]
Add some more hash utility functions

6 months agoRewrite the hash functions to be more generic
Mikko Rasa [Wed, 17 Nov 2021 12:13:06 +0000 (14:13 +0200)]
Rewrite the hash functions to be more generic

The number of bits is now taken as a template parameter and the hash
size is determined automatically.

6 months agoMark overridden virtual functions as such
Mikko Rasa [Sun, 31 Oct 2021 18:16:57 +0000 (20:16 +0200)]
Mark overridden virtual functions as such

6 months agoRemove the broken IO::Filtered class
Mikko Rasa [Sun, 31 Oct 2021 18:04:27 +0000 (20:04 +0200)]
Remove the broken IO::Filtered class

6 months agoPass security attributes to the correct argument of CreateFile
Mikko Rasa [Sun, 31 Oct 2021 17:46:51 +0000 (19:46 +0200)]
Pass security attributes to the correct argument of CreateFile

6 months agoAdd some missing includes
Mikko Rasa [Sun, 31 Oct 2021 17:14:33 +0000 (19:14 +0200)]
Add some missing includes

6 months agoCheck for self-assignment in non-trivial assignment operators
Mikko Rasa [Sun, 31 Oct 2021 17:11:04 +0000 (19:11 +0200)]
Check for self-assignment in non-trivial assignment operators

6 months agoUse nullptr instead of 0 for pointers
Mikko Rasa [Sun, 31 Oct 2021 17:09:29 +0000 (19:09 +0200)]
Use nullptr instead of 0 for pointers

6 months agoCheck for closed handles when changing Pipe flags
Mikko Rasa [Sun, 31 Oct 2021 13:12:26 +0000 (15:12 +0200)]
Check for closed handles when changing Pipe flags

6 months agoMark boolean conversion operators as explicit
Mikko Rasa [Sun, 31 Oct 2021 13:05:18 +0000 (15:05 +0200)]
Mark boolean conversion operators as explicit

Also turn const void * operators into actual boolean conversions.

6 months agoFix JIS X 0208 encoding
Mikko Rasa [Sun, 31 Oct 2021 12:45:57 +0000 (14:45 +0200)]
Fix JIS X 0208 encoding

This seems to have broken all the way back in f47bc86.

6 months agoUpdate naming of internal variables and functions
Mikko Rasa [Sun, 31 Oct 2021 11:46:57 +0000 (13:46 +0200)]
Update naming of internal variables and functions

In most cases put just an underscore in front (instead of back as it was
previously).  When a member name conflicts with a noun function, use m_
prefix.

6 months agoUse size_t to represent sizes
Mikko Rasa [Sun, 31 Oct 2021 11:29:59 +0000 (13:29 +0200)]
Use size_t to represent sizes

6 months agoUse a const variable instead of #define
Mikko Rasa [Sun, 31 Oct 2021 11:29:36 +0000 (13:29 +0200)]
Use a const variable instead of #define

6 months agoRemove unnecessary private copy constructors
Mikko Rasa [Sun, 31 Oct 2021 11:29:06 +0000 (13:29 +0200)]
Remove unnecessary private copy constructors

These classes already inherit NonCopyable.

6 months agoMark constructors and destructors as default where appropriate
Mikko Rasa [Sun, 31 Oct 2021 11:28:41 +0000 (13:28 +0200)]
Mark constructors and destructors as default where appropriate

6 months agoImprove robustness of resolving user/group names in Stat
Mikko Rasa [Sun, 31 Oct 2021 11:26:57 +0000 (13:26 +0200)]
Improve robustness of resolving user/group names in Stat

6 months agoUse default member initializers and constructor delegation
Mikko Rasa [Sun, 31 Oct 2021 11:08:16 +0000 (13:08 +0200)]
Use default member initializers and constructor delegation

8 months agoUse the standard fixed-size integer types directly
Mikko Rasa [Sat, 18 Sep 2021 00:21:18 +0000 (03:21 +0300)]
Use the standard fixed-size integer types directly

8 months agoAdd necessary libraries
Mikko Rasa [Wed, 1 Sep 2021 00:13:32 +0000 (03:13 +0300)]
Add necessary libraries

These are not included by default on MSVC

8 months agoDon't access iterator if it's at end
Mikko Rasa [Wed, 1 Sep 2021 00:13:05 +0000 (03:13 +0300)]
Don't access iterator if it's at end

8 months agoFix incorrect iterator manipulation
Mikko Rasa [Wed, 1 Sep 2021 00:12:09 +0000 (03:12 +0300)]
Fix incorrect iterator manipulation

Now that opts is a vector, erase invalidates iterators.

8 months agoRetrieve process exit codes on Windows
Mikko Rasa [Mon, 30 Aug 2021 00:21:05 +0000 (03:21 +0300)]
Retrieve process exit codes on Windows

8 months agoUpdate example programs
Mikko Rasa [Sun, 29 Aug 2021 23:49:36 +0000 (02:49 +0300)]
Update example programs

8 months agoAdd platform-specific implemenrations of FS::list_filtered
Mikko Rasa [Sun, 29 Aug 2021 23:38:46 +0000 (02:38 +0300)]
Add platform-specific implemenrations of FS::list_filtered

Microsoft's stdlib does not have opendir and friends.

8 months agoAdd wrappers for environment manipulation functions
Mikko Rasa [Sun, 29 Aug 2021 23:15:57 +0000 (02:15 +0300)]
Add wrappers for environment manipulation functions

8 months agoFix signedness errors from MSVC
Mikko Rasa [Sun, 29 Aug 2021 22:50:13 +0000 (01:50 +0300)]
Fix signedness errors from MSVC

8 months agoAdd a shortcut for transforming a container in-place
Mikko Rasa [Sun, 29 Aug 2021 14:16:04 +0000 (17:16 +0300)]
Add a shortcut for transforming a container in-place

8 months agoFormatting fixes
Mikko Rasa [Sun, 29 Aug 2021 14:15:28 +0000 (17:15 +0300)]
Formatting fixes

8 months agoDeprecate various meta-programming constructs in favor of std ones
Mikko Rasa [Sun, 29 Aug 2021 13:46:48 +0000 (16:46 +0300)]
Deprecate various meta-programming constructs in favor of std ones

8 months agoPrefer more cache-efficient containers
Mikko Rasa [Sun, 29 Aug 2021 13:16:44 +0000 (16:16 +0300)]
Prefer more cache-efficient containers

8 months agoUse C++11 features with containers
Mikko Rasa [Sun, 29 Aug 2021 12:15:50 +0000 (15:15 +0300)]
Use C++11 features with containers

8 months agoUse integer types from <cstdint>
Mikko Rasa [Sun, 29 Aug 2021 10:06:40 +0000 (13:06 +0300)]
Use integer types from <cstdint>

8 months agoRequire C++11 for building
Mikko Rasa [Sun, 29 Aug 2021 09:18:17 +0000 (12:18 +0300)]
Require C++11 for building

In practice this has been a requirement for a while due to libsigc++.

8 months agoRemove unnecessary std:: qualifiers
Mikko Rasa [Sun, 29 Aug 2021 08:59:32 +0000 (11:59 +0300)]
Remove unnecessary std:: qualifiers

8 months agoUse size_t for sizes in I/O classes
Mikko Rasa [Sun, 29 Aug 2021 08:54:20 +0000 (11:54 +0300)]
Use size_t for sizes in I/O classes

8 months agoRemove deprecated things
Mikko Rasa [Sun, 29 Aug 2021 08:50:29 +0000 (11:50 +0300)]
Remove deprecated things

8 months agoBump version so I can do breaking changes
Mikko Rasa [Sun, 29 Aug 2021 08:45:43 +0000 (11:45 +0300)]
Bump version so I can do breaking changes

8 months agoFix incorrect MSVC check
Mikko Rasa [Sun, 29 Aug 2021 08:18:20 +0000 (11:18 +0300)]
Fix incorrect MSVC check

9 months agoTreat ERROR_BROKEN_PIPE as end-of-file instead of an error
Mikko Rasa [Sun, 22 Aug 2021 10:19:29 +0000 (13:19 +0300)]
Treat ERROR_BROKEN_PIPE as end-of-file instead of an error

9 months agoUse a persistent OVERLAPPED structure in EventReader
Mikko Rasa [Sun, 22 Aug 2021 10:17:08 +0000 (13:17 +0300)]
Use a persistent OVERLAPPED structure in EventReader

9 months agoClose duplicated handles after starting a new process
Mikko Rasa [Sun, 22 Aug 2021 09:41:28 +0000 (12:41 +0300)]
Close duplicated handles after starting a new process

9 months agoEnable inheriting handles in CreateProcess
Mikko Rasa [Sun, 22 Aug 2021 09:39:59 +0000 (12:39 +0300)]
Enable inheriting handles in CreateProcess

9 months agoSkip path lookup if PATH is not set
Mikko Rasa [Sun, 22 Aug 2021 09:37:15 +0000 (12:37 +0300)]
Skip path lookup if PATH is not set

9 months agoUse correct directory separator to check for absolute binary path
Mikko Rasa [Sun, 22 Aug 2021 09:33:32 +0000 (12:33 +0300)]
Use correct directory separator to check for absolute binary path

9 months agoCheck for ERROR_PATH_NOT_FOUND in adition to ERROR_FILE_NOT_FOUND
Mikko Rasa [Sun, 22 Aug 2021 09:26:19 +0000 (12:26 +0300)]
Check for ERROR_PATH_NOT_FOUND in adition to ERROR_FILE_NOT_FOUND

9 months agoFix Path::is_absolute for empty paths on Windows
Mikko Rasa [Sun, 22 Aug 2021 09:18:42 +0000 (12:18 +0300)]
Fix Path::is_absolute for empty paths on Windows

13 months agoAdd equality comparison for Variant
Mikko Rasa [Tue, 20 Apr 2021 15:11:45 +0000 (18:11 +0300)]
Add equality comparison for Variant

Besides value comparison, it's also possible to check if two Variant
objects have the same type.

13 months agoAdd TypeRegistry class
Mikko Rasa [Mon, 12 Apr 2021 11:36:12 +0000 (14:36 +0300)]
Add TypeRegistry class

This is basically a generalization of DataFile::LoadableTypeRegistry,
formulated so it isn't associated specifically with Loaders.

13 months agoAdd utility functions to search and sort containers based on a member
Mikko Rasa [Sat, 10 Apr 2021 18:07:14 +0000 (21:07 +0300)]
Add utility functions to search and sort containers based on a member

13 months agoAdd folding functions for hashes
Mikko Rasa [Sat, 3 Apr 2021 15:44:36 +0000 (18:44 +0300)]
Add folding functions for hashes

13 months agoAdd wrappers for lower_bound and upper_bound
Mikko Rasa [Fri, 2 Apr 2021 11:05:04 +0000 (14:05 +0300)]
Add wrappers for lower_bound and upper_bound

14 months agoUse the new utilities to format some strings
Mikko Rasa [Thu, 4 Mar 2021 10:29:09 +0000 (12:29 +0200)]
Use the new utilities to format some strings

14 months agoAdd some utility functions for joining strings
Mikko Rasa [Thu, 4 Mar 2021 10:26:25 +0000 (12:26 +0200)]
Add some utility functions for joining strings

15 months agoNicer formatting of exceptions with multi-line whats
Mikko Rasa [Fri, 19 Feb 2021 23:15:52 +0000 (01:15 +0200)]
Nicer formatting of exceptions with multi-line whats

15 months agoImplement weak pointers
Mikko Rasa [Sat, 6 Feb 2021 11:09:28 +0000 (13:09 +0200)]
Implement weak pointers

15 months agoMove non-oneliner functions out of RefPtr class declaration
Mikko Rasa [Sat, 6 Feb 2021 09:55:56 +0000 (11:55 +0200)]
Move non-oneliner functions out of RefPtr class declaration

15 months agoMove RefPtr refcount into a struct
Mikko Rasa [Sat, 6 Feb 2021 09:51:17 +0000 (11:51 +0200)]
Move RefPtr refcount into a struct

This is necessary to implement weak pointers

2 years agoAdd a refcount function to RefPtr
Mikko Rasa [Mon, 18 May 2020 23:27:15 +0000 (02:27 +0300)]
Add a refcount function to RefPtr

Sometimes it may be useful to check if there are any other users for the
data.

2 years agoCheck that objects still exist when dispatching events to them
Mikko Rasa [Fri, 27 Sep 2019 19:36:09 +0000 (22:36 +0300)]
Check that objects still exist when dispatching events to them

2 years agoAdditional adjustments for Poller
Mikko Rasa [Fri, 27 Sep 2019 19:35:14 +0000 (22:35 +0300)]
Additional adjustments for Poller

2 years agoUse vectors for storage in Poller
Mikko Rasa [Fri, 27 Sep 2019 19:34:05 +0000 (22:34 +0300)]
Use vectors for storage in Poller

2 years agoRefactor signal connection handling in EventDispatcher
Mikko Rasa [Fri, 27 Sep 2019 19:24:07 +0000 (22:24 +0300)]
Refactor signal connection handling in EventDispatcher

Connect the signals to functions on the Slot object to make them easier
to disconnect.

2 years agoAdd RemoveConstReference metaprogamming struct
Mikko Rasa [Fri, 27 Sep 2019 00:05:07 +0000 (03:05 +0300)]
Add RemoveConstReference metaprogamming struct

It combines RemoveConst and RemoveReference but is much shorter

2 years agoAdd FileMonitor stubs for Windows
Mikko Rasa [Wed, 25 Sep 2019 20:42:08 +0000 (23:42 +0300)]
Add FileMonitor stubs for Windows

2 years agoAdd a class for monitoring changes in files
Mikko Rasa [Sat, 21 Sep 2019 15:25:59 +0000 (18:25 +0300)]
Add a class for monitoring changes in files

2 years agoAdd a facility to automatically create backtraces for exceptions
Mikko Rasa [Tue, 17 Sep 2019 14:22:55 +0000 (17:22 +0300)]
Add a facility to automatically create backtraces for exceptions

Obtaining a backtrace in the catch block won't show where the exception
happened.  Hooking into the exception handler internals is necessary.
Because this is somewhat disruptive to the language runtime, it is an
optional feature and disabled by default.

2 years agoInvent a value for argv[0] if not present
Mikko Rasa [Sun, 9 Jun 2019 11:35:27 +0000 (14:35 +0300)]
Invent a value for argv[0] if not present

Gdbserver seems to pass an empty argv[0], at least on Windows.  That
causes problems with the various get_*_dir functions.

2 years agoFix formatted output operator detection in lexicalcast.h
Mikko Rasa [Mon, 3 Jun 2019 11:50:39 +0000 (14:50 +0300)]
Fix formatted output operator detection in lexicalcast.h

Since it was using a default-constructed value as part of the test
expression, it would fail to detect the operator for classes that are
not default-constructable.

2 years agoFormatting fixes
Mikko Rasa [Mon, 3 Jun 2019 11:36:37 +0000 (14:36 +0300)]
Formatting fixes

2 years agoFix references to deprecated functions
Mikko Rasa [Mon, 3 Jun 2019 11:31:17 +0000 (14:31 +0300)]
Fix references to deprecated functions

2 years agoAnnotate deprecated functions as such
Mikko Rasa [Mon, 3 Jun 2019 11:31:03 +0000 (14:31 +0300)]
Annotate deprecated functions as such

2 years agoAllow std::vector to be used for GetOpt value lists
Mikko Rasa [Mon, 3 Jun 2019 10:24:11 +0000 (13:24 +0300)]
Allow std::vector to be used for GetOpt value lists

3 years agoAdd a version of get_item that dynamic_casts the result
Mikko Rasa [Fri, 24 May 2019 16:58:39 +0000 (19:58 +0300)]
Add a version of get_item that dynamic_casts the result

3 years agoSimplify the SFINAE construct a bit
Mikko Rasa [Fri, 24 May 2019 16:57:22 +0000 (19:57 +0300)]
Simplify the SFINAE construct a bit

More of the common stuff is now stored in the helper struct.

3 years agoAdd a main() function for Windows
Mikko Rasa [Wed, 26 Dec 2018 22:38:04 +0000 (00:38 +0200)]
Add a main() function for Windows

Console applications (at least those compiled with MinGW) use it as the
entry point.  MinGW has a support library to use WinMain as entry point,
but that requires a hack in builder that causes trouble with applications
that have a main() of their own.

3 years agoActually pass sec_attr to CreateFile
Mikko Rasa [Fri, 6 Jul 2018 17:59:32 +0000 (20:59 +0300)]
Actually pass sec_attr to CreateFile

4 years agoMake sure all classes have sensible copy semantics
Mikko Rasa [Wed, 25 Apr 2018 10:16:55 +0000 (13:16 +0300)]
Make sure all classes have sensible copy semantics

They must either support copying or be derived from NonCopyable.

4 years agoAdd a NonCopyable utility base class
Mikko Rasa [Wed, 25 Apr 2018 10:15:43 +0000 (13:15 +0300)]
Add a NonCopyable utility base class

4 years agoUse nicer formatting for string keys in key_error
Mikko Rasa [Wed, 25 Apr 2018 10:06:00 +0000 (13:06 +0300)]
Use nicer formatting for string keys in key_error

4 years agoAdd whole-container versions of sort and stable_sort
Mikko Rasa [Sun, 25 Mar 2018 11:28:10 +0000 (14:28 +0300)]
Add whole-container versions of sort and stable_sort

4 years agoMark the functions in algorithm.h as inline
Mikko Rasa [Sun, 25 Mar 2018 11:20:30 +0000 (14:20 +0300)]
Mark the functions in algorithm.h as inline

4 years agoAdd a method to set autobase in Fmt
Mikko Rasa [Wed, 21 Feb 2018 17:29:43 +0000 (19:29 +0200)]
Add a method to set autobase in Fmt

4 years agoAdd stub implementations of the pure virtual functions to Asset
Mikko Rasa [Mon, 4 Dec 2017 14:28:15 +0000 (16:28 +0200)]
Add stub implementations of the pure virtual functions to Asset

4 years agoRemove test case for invalid Path iterator
Mikko Rasa [Sat, 2 Dec 2017 20:23:13 +0000 (22:23 +0200)]
Remove test case for invalid Path iterator

Path::Iterator now caches the current component and no longer throws when
dereferencing end().

4 years agoFix incorrect function name in an exception
Mikko Rasa [Sat, 2 Dec 2017 15:05:54 +0000 (17:05 +0200)]
Fix incorrect function name in an exception

4 years agoFix basename and dirname on an empty Path
Mikko Rasa [Sat, 2 Dec 2017 15:04:00 +0000 (17:04 +0200)]
Fix basename and dirname on an empty Path

4 years agoImplement controls for file descriptor inheritance
Mikko Rasa [Sat, 2 Dec 2017 15:03:10 +0000 (17:03 +0200)]
Implement controls for file descriptor inheritance

4 years agoFix mismatched fcntls in sys_set_blocking on unix
Mikko Rasa [Sat, 2 Dec 2017 14:44:48 +0000 (16:44 +0200)]
Fix mismatched fcntls in sys_set_blocking on unix

4 years agoMake certain functions pure virtual so I won't forget to implement them
Mikko Rasa [Sat, 2 Dec 2017 14:41:22 +0000 (16:41 +0200)]
Make certain functions pure virtual so I won't forget to implement them

4 years agoAdd missing get_handle function to Serial
Mikko Rasa [Sat, 2 Dec 2017 14:33:44 +0000 (16:33 +0200)]
Add missing get_handle function to Serial

4 years agoAdd a missing mode flag adjustment to Console::set_block
Mikko Rasa [Sat, 2 Dec 2017 14:32:33 +0000 (16:32 +0200)]
Add a missing mode flag adjustment to Console::set_block

4 years agoAdd a helper function for adjusting mode flags
Mikko Rasa [Sat, 2 Dec 2017 14:32:13 +0000 (16:32 +0200)]
Add a helper function for adjusting mode flags

5 years agoGuard against badly behaving get functions in getline
Mikko Rasa [Sun, 8 Jan 2017 11:59:57 +0000 (13:59 +0200)]
Guard against badly behaving get functions in getline

5 years agoReturn -1 from Slice::get at eof
Mikko Rasa [Sun, 8 Jan 2017 11:59:41 +0000 (13:59 +0200)]
Return -1 from Slice::get at eof

5 years agoPthread_setname_np is a GNU extension
Mikko Rasa [Fri, 6 Jan 2017 02:54:14 +0000 (04:54 +0200)]
Pthread_setname_np is a GNU extension

5 years agoAdd implementations of find and find_if that take a container
Mikko Rasa [Sat, 5 Nov 2016 11:28:12 +0000 (13:28 +0200)]
Add implementations of find and find_if that take a container

Rather than an iterator pair.  Searching through an entire container is
a very common use case.

5 years agoAdd integration between EventDispatcher and Timer
Mikko Rasa [Sun, 30 Oct 2016 15:15:40 +0000 (17:15 +0200)]
Add integration between EventDispatcher and Timer