]> git.tdb.fi Git - libs/core.git/log
libs/core.git
2 months agoMake Time::format_now use the local timezone
Mikko Rasa [Sat, 31 Aug 2024 08:49:42 +0000 (11:49 +0300)]
Make Time::format_now use the local timezone

2 months agoUse unique_ptr to manage owned memory
Mikko Rasa [Tue, 27 Aug 2024 11:51:51 +0000 (14:51 +0300)]
Use unique_ptr to manage owned memory

Required C++ language version is now C++14.

10 months agoRefactor FS::list_files to not use an empty regex
Mikko Rasa [Fri, 29 Dec 2023 22:23:28 +0000 (00:23 +0200)]
Refactor FS::list_files to not use an empty regex

10 months agoOptimize memory accesses in Regex::run
Mikko Rasa [Fri, 29 Dec 2023 20:36:05 +0000 (22:36 +0200)]
Optimize memory accesses in Regex::run

Use a vector instead of a linked list to store execution contexts, and
store matched groups in contiguous memory as well.

11 months agoExport a few low-level symbols which are needed by other libraries
Mikko Rasa [Sat, 23 Dec 2023 14:15:29 +0000 (16:15 +0200)]
Export a few low-level symbols which are needed by other libraries

14 months agoAdd a function to retrieve temporary directory location
Mikko Rasa [Sat, 16 Sep 2023 09:46:08 +0000 (12:46 +0300)]
Add a function to retrieve temporary directory location

MacOS and Android versions are untested.

14 months agoRecognize CRLF as line terminator in getline
Mikko Rasa [Sat, 16 Sep 2023 09:16:39 +0000 (12:16 +0300)]
Recognize CRLF as line terminator in getline

14 months agoDon't try to fetch the value of a nonexistent environment variable
Mikko Rasa [Fri, 15 Sep 2023 21:31:53 +0000 (00:31 +0300)]
Don't try to fetch the value of a nonexistent environment variable

14 months agoRefactor Variant's internals to be compatible with older MSVC versions
Mikko Rasa [Mon, 11 Sep 2023 08:00:25 +0000 (11:00 +0300)]
Refactor Variant's internals to be compatible with older MSVC versions

14 months agoUse a dynamic buffer when retrieving environment variables on Windows
Mikko Rasa [Sun, 10 Sep 2023 21:38:34 +0000 (00:38 +0300)]
Use a dynamic buffer when retrieving environment variables on Windows

14 months agoFix incorrect multiple inclusion guards
Mikko Rasa [Sat, 9 Sep 2023 07:41:03 +0000 (10:41 +0300)]
Fix incorrect multiple inclusion guards

14 months agoUse the length result from getenv_s
Mikko Rasa [Sat, 9 Sep 2023 07:38:43 +0000 (10:38 +0300)]
Use the length result from getenv_s

14 months agoImprovements for empty variants
Mikko Rasa [Sat, 9 Sep 2023 07:37:18 +0000 (10:37 +0300)]
Improvements for empty variants

There's now a function to check if an empty variant holds a value, and
two empty variants will compare as equal.

14 months agoHide the delegating constructor of ZlibCompressed in the .cpp file
Mikko Rasa [Wed, 6 Sep 2023 22:02:15 +0000 (01:02 +0300)]
Hide the delegating constructor of ZlibCompressed in the .cpp file

MSVC has trouble with exporting the vftable if the main constructor is
in a .cpp file but the delegating one is not.

14 months agoExport Handle::Private from the library
Mikko Rasa [Tue, 5 Sep 2023 12:22:03 +0000 (15:22 +0300)]
Export Handle::Private from the library

It's needed by other libraries which implement I/O classes, particularly
mspnet.

14 months agoFix an error in Stat copy constructor
Mikko Rasa [Sun, 3 Sep 2023 23:01:06 +0000 (02:01 +0300)]
Fix an error in Stat copy constructor

14 months agoImplement symlink support on Windows
Mikko Rasa [Sun, 3 Sep 2023 22:44:31 +0000 (01:44 +0300)]
Implement symlink support on Windows

Also avoid lossage when statting reparse points of the appexeclink type.

14 months agoMake the ls example print symlink targets
Mikko Rasa [Sun, 3 Sep 2023 22:17:21 +0000 (01:17 +0300)]
Make the ls example print symlink targets

14 months agoAdd a moving overload of insert_unique
Mikko Rasa [Sun, 27 Aug 2023 10:59:18 +0000 (13:59 +0300)]
Add a moving overload of insert_unique

17 months agoAdd move semantics to Variant
Mikko Rasa [Thu, 1 Jun 2023 07:17:56 +0000 (10:17 +0300)]
Add move semantics to Variant

17 months agoAdd a helper function for clearing a Variant
Mikko Rasa [Thu, 1 Jun 2023 06:26:48 +0000 (09:26 +0300)]
Add a helper function for clearing a Variant

22 months agoUpdate .gitignore to include build products on Windows
Mikko Rasa [Wed, 4 Jan 2023 11:04:49 +0000 (13:04 +0200)]
Update .gitignore to include build products on Windows

22 months agoMove accessors of static data members to .cpp files
Mikko Rasa [Tue, 3 Jan 2023 16:07:33 +0000 (18:07 +0200)]
Move accessors of static data members to .cpp files

Importing data items directly is tricky on MSVC, so better to hide them
behind functions.

22 months agoMake Console references static instead of extern
Mikko Rasa [Tue, 3 Jan 2023 15:42:11 +0000 (17:42 +0200)]
Make Console references static instead of extern

This avoids unresolved external errors on MSVC.  It's not ideal because
every translation unit will have its own copy of the references and
initialize them separately, but the overhead for calling the instance
accessor function is not too large.

22 months agoAdd a wrapper header for windows.h
Mikko Rasa [Tue, 3 Jan 2023 14:29:47 +0000 (16:29 +0200)]
Add a wrapper header for windows.h

Since Time::min is now defined in the header, it runs afoul of the min()
macro defined in windows.h unless the latter is disabled.

22 months agoMake time constants constexpr and move them to the header
Mikko Rasa [Tue, 3 Jan 2023 14:03:19 +0000 (16:03 +0200)]
Make time constants constexpr and move them to the header

22 months agoMove Memory constructors to the .cpp file
Mikko Rasa [Tue, 3 Jan 2023 13:29:58 +0000 (15:29 +0200)]
Move Memory constructors to the .cpp file

It's causing an undefined reference to vftable if they're in the header.

22 months agoAdd decorations for things which are considered part of the API
Mikko Rasa [Tue, 3 Jan 2023 00:23:57 +0000 (02:23 +0200)]
Add decorations for things which are considered part of the API

22 months agoFallback to comparing typeid in Variant if funcs are not the same
Mikko Rasa [Mon, 2 Jan 2023 21:38:27 +0000 (23:38 +0200)]
Fallback to comparing typeid in Variant if funcs are not the same

On Windows it looks like instantiations of a function template in
different modules may have different addresses of its static locals.

22 months agoMake lexical conversions from and to long long available everywhere
Mikko Rasa [Sun, 1 Jan 2023 20:20:39 +0000 (22:20 +0200)]
Make lexical conversions from and to long long available everywhere

The type became part of the C++ standard in C++11, so there's no longer
need to guard it with __GNUC__.

22 months agoFix a shadowed variable warning
Mikko Rasa [Wed, 28 Dec 2022 13:00:57 +0000 (15:00 +0200)]
Fix a shadowed variable warning

22 months agoAdd missing override specifiers
Mikko Rasa [Tue, 27 Dec 2022 16:18:08 +0000 (18:18 +0200)]
Add missing override specifiers

22 months agoFix an issue with normalizing paths of the form /foo/..
Mikko Rasa [Tue, 27 Dec 2022 15:32:24 +0000 (17:32 +0200)]
Fix an issue with normalizing paths of the form /foo/..

The separator indicating the root directory was being incorrectly
removed, resulting in a path denoting the current directory.

23 months agoRename Variant's check_type function to has_type
Mikko Rasa [Fri, 23 Dec 2022 12:27:44 +0000 (14:27 +0200)]
Rename Variant's check_type function to has_type

23 months agoRewrite the Variant class
Mikko Rasa [Fri, 23 Dec 2022 12:27:01 +0000 (14:27 +0200)]
Rewrite the Variant class

It now uses type erasure and small object optimization

23 months agoPartially revert "Use braced initializer lists ..."
Mikko Rasa [Tue, 20 Dec 2022 23:31:12 +0000 (01:31 +0200)]
Partially revert "Use braced initializer lists ..."

Turns out you can't omit initializers with some members, and
MemberCompare has the predicate as a member.

23 months agoDelete private data of Process on destruction
Mikko Rasa [Tue, 20 Dec 2022 11:19:53 +0000 (13:19 +0200)]
Delete private data of Process on destruction

23 months agoAdd an algorithm to check for existence of a value in a container
Mikko Rasa [Mon, 19 Dec 2022 10:06:20 +0000 (12:06 +0200)]
Add an algorithm to check for existence of a value in a container

23 months agoUse braced initializer lists in place of constructors when possible
Mikko Rasa [Mon, 19 Dec 2022 10:04:20 +0000 (12:04 +0200)]
Use braced initializer lists in place of constructors when possible

23 months agoAdd a few missing default initializers
Mikko Rasa [Mon, 19 Dec 2022 10:02:34 +0000 (12:02 +0200)]
Add a few missing default initializers

23 months agoAdd dllimport to the declaration of getenv_s on Windows
Mikko Rasa [Sun, 11 Dec 2022 09:22:17 +0000 (11:22 +0200)]
Add dllimport to the declaration of getenv_s on Windows

23 months agoAdd missing includes for Windows platform
Mikko Rasa [Sun, 11 Dec 2022 09:19:31 +0000 (11:19 +0200)]
Add missing includes for Windows platform

23 months agoAdjust exception messages
Mikko Rasa [Tue, 6 Dec 2022 23:03:22 +0000 (01:03 +0200)]
Adjust exception messages

23 months agoAdd new exception classes for some common errors
Mikko Rasa [Tue, 6 Dec 2022 23:02:22 +0000 (01:02 +0200)]
Add new exception classes for some common errors

23 months agoModernize noexcept specifiers
Mikko Rasa [Tue, 6 Dec 2022 22:57:52 +0000 (00:57 +0200)]
Modernize noexcept specifiers

23 months agoUse size_t in EventReader
Mikko Rasa [Sun, 27 Nov 2022 13:27:46 +0000 (15:27 +0200)]
Use size_t in EventReader

23 months agoChange Thread::main_wrapper's return value back to 0
Mikko Rasa [Sun, 27 Nov 2022 13:25:38 +0000 (15:25 +0200)]
Change Thread::main_wrapper's return value back to 0

It's a DWORD on Windows, not a pointer.

2 years agoUse std::less as predicate in algorithms
Mikko Rasa [Wed, 26 Oct 2022 08:52:12 +0000 (11:52 +0300)]
Use std::less as predicate in algorithms

It guarantees a consistent ordering of pointers, unlike the < operator.

2 years agoAdd utilities to interface with an attached debugger
Mikko Rasa [Wed, 16 Mar 2022 10:10:40 +0000 (12:10 +0200)]
Add utilities to interface with an attached debugger

2 years agoProduce an octal escape code for \177
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.

3 years 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

3 years 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

3 years 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.

3 years 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

3 years 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

3 years 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

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

3 years 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

3 years 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

3 years 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

3 years 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.

3 years 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.

3 years 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.

3 years 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

3 years 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

3 years 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.

3 years 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

3 years 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

3 years 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

3 years 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

3 years 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

3 years 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

3 years 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.

3 years 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

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

3 years 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.

3 years 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

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

3 years 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

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

3 years 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

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

3 years 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

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

3 years 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++.

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

3 years 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

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

3 years 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

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

3 years 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

3 years 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

3 years 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

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

3 years 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

3 years 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

3 years 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

3 years 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

3 years 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.

3 years 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.