]> git.tdb.fi Git - libs/datafile.git/log
libs/datafile.git
15 months agoAdd a prepare() hook to Loader
Mikko Rasa [Tue, 9 Jul 2024 13:29:16 +0000 (16:29 +0300)]
Add a prepare() hook to Loader

Also add an overload of finish() which is called even when an exception
occurs and receives a bool parameter to indicate if loading was
successful.

16 months agoChange most remaining uses of std::list to std::vector
Mikko Rasa [Sun, 19 May 2024 09:52:53 +0000 (12:52 +0300)]
Change most remaining uses of std::list to std::vector

17 months agoMake the conversion operator of Symbol explicit
Mikko Rasa [Sat, 4 May 2024 13:56:14 +0000 (16:56 +0300)]
Make the conversion operator of Symbol explicit

21 months agoFix incorrect type in a range-for loop
Mikko Rasa [Wed, 27 Dec 2023 11:18:22 +0000 (13:18 +0200)]
Fix incorrect type in a range-for loop

21 months agoAdd std:: qualifier to nullptr_t
Mikko Rasa [Wed, 27 Dec 2023 11:17:46 +0000 (13:17 +0200)]
Add std:: qualifier to nullptr_t

21 months agoMake move constructors explicitly declared for MSVC's benefit
Mikko Rasa [Tue, 26 Dec 2023 23:36:29 +0000 (01:36 +0200)]
Make move constructors explicitly declared for MSVC's benefit

When exporting classes it wants to export all the special members, even
if some of them are invalid due to the types of data members.  A user-
declared move constructor disables the implicit copy constructor so
things will work correctly.

22 months agoCopy loader context to auxiliary loaders
Mikko Rasa [Sun, 17 Dec 2023 09:10:59 +0000 (11:10 +0200)]
Copy loader context to auxiliary loaders

22 months agoMake PackSource use vector<unique_ptr<T>> instead of list<T>
Mikko Rasa [Tue, 12 Dec 2023 10:07:18 +0000 (12:07 +0200)]
Make PackSource use vector<unique_ptr<T>> instead of list<T>

Consequently it's no longer copyable.

22 months agoUse the auto type in a few places that were missed previously
Mikko Rasa [Tue, 12 Dec 2023 09:45:25 +0000 (11:45 +0200)]
Use the auto type in a few places that were missed previously

22 months agoIntroduce an improved interface for loading sub-objects
Mikko Rasa [Tue, 12 Dec 2023 09:32:21 +0000 (11:32 +0200)]
Introduce an improved interface for loading sub-objects

Objects can now be created dynamically and stored in a collection.
Hierarchical names are automatically generated for stored objects.

The old load_sub function will be deprecated at some point.

22 months agoSimplify DynamicObjectLoader with an if constexpr
Mikko Rasa [Mon, 11 Dec 2023 08:28:45 +0000 (10:28 +0200)]
Simplify DynamicObjectLoader with an if constexpr

22 months agoUse standard smart pointers for memory management
Mikko Rasa [Sun, 10 Dec 2023 21:10:08 +0000 (23:10 +0200)]
Use standard smart pointers for memory management

Collection and related classes now use std::unique_ptr to make ownership
transfers explicit.

22 months agoConvert typedefs to using declarations
Mikko Rasa [Sun, 10 Dec 2023 16:04:53 +0000 (18:04 +0200)]
Convert typedefs to using declarations

2 years agoDon't delete the temporary file while it's in use
Mikko Rasa [Sat, 16 Sep 2023 09:50:22 +0000 (12:50 +0300)]
Don't delete the temporary file while it's in use

That doesn't work on Windows.

2 years agoUse FS::get_temp_dir to get the temporary directory
Mikko Rasa [Sat, 16 Sep 2023 09:48:09 +0000 (12:48 +0300)]
Use FS::get_temp_dir to get the temporary directory

2 years agoRemove a vestigial file
Mikko Rasa [Fri, 15 Sep 2023 21:03:42 +0000 (00:03 +0300)]
Remove a vestigial file

2 years agoUse default member initializers in datatool
Mikko Rasa [Fri, 15 Sep 2023 21:03:21 +0000 (00:03 +0300)]
Use default member initializers in datatool

This also fixes one uninitialized flag.

2 years agoGet source from the parser if there's no current statement
Mikko Rasa [Wed, 6 Sep 2023 12:35:02 +0000 (15:35 +0300)]
Get source from the parser if there's no current statement

Binary format is loaded directly, without statement structures.

2 years agoRefactor handling of actions in Loader
Mikko Rasa [Wed, 6 Sep 2023 12:05:42 +0000 (15:05 +0300)]
Refactor handling of actions in Loader

Auxiliary loaders now work with the binary format and the flow control
structures are more clear in general.

2 years agoExport a couple more things in the API
Mikko Rasa [Mon, 4 Sep 2023 21:13:47 +0000 (00:13 +0300)]
Export a couple more things in the API

2 years agoUpdate Variant API usage
Mikko Rasa [Sun, 3 Sep 2023 23:07:26 +0000 (02:07 +0300)]
Update Variant API usage

2 years agoUpdate .gitignore to include build products on Windows
Mikko Rasa [Wed, 4 Jan 2023 11:06:34 +0000 (13:06 +0200)]
Update .gitignore to include build products on Windows

2 years agoUse Msp::getenv
Mikko Rasa [Tue, 3 Jan 2023 16:08:36 +0000 (18:08 +0200)]
Use Msp::getenv

2 years agoMove the definition of Input's operator bool to the header wip
Mikko Rasa [Tue, 3 Jan 2023 11:05:22 +0000 (13:05 +0200)]
Move the definition of Input's operator bool to the header

The class should be considered as internal, but Parser invokes the bool
conversion from its own.  This avoids having to export Input.

2 years agoRemove unnecessary destructor declarations
Mikko Rasa [Tue, 3 Jan 2023 09:07:07 +0000 (11:07 +0200)]
Remove unnecessary destructor declarations

Noexcept is the default since C++11.

2 years agoDecorate things which should be visible to users of the library
Mikko Rasa [Tue, 3 Jan 2023 08:58:57 +0000 (10:58 +0200)]
Decorate things which should be visible to users of the library

2 years agoDisable the templated constructor of Value if the source type is Value
Mikko Rasa [Sun, 18 Dec 2022 10:59:32 +0000 (12:59 +0200)]
Disable the templated constructor of Value if the source type is Value

Microsoft's std::vector uses a T & (without const) for copying, which
resolves to the templated constructor instead of the copy constructor
unless the former is disabled for that signature.

3 years agoUse correct delete operator in RawData
Mikko Rasa [Sun, 2 Jan 2022 10:20:51 +0000 (12:20 +0200)]
Use correct delete operator in RawData

3 years agoUse explicit lengths in builtin data initialization
Mikko Rasa [Sun, 2 Jan 2022 10:14:47 +0000 (12:14 +0200)]
Use explicit lengths in builtin data initialization

This allows adding binary files which may contain embedded nul bytes.

3 years agoCosmetic changes
Mikko Rasa [Tue, 2 Nov 2021 14:44:27 +0000 (16:44 +0200)]
Cosmetic changes

3 years agoUse size_t for memory buffer sizes
Mikko Rasa [Tue, 2 Nov 2021 14:44:13 +0000 (16:44 +0200)]
Use size_t for memory buffer sizes

3 years agoRecognize and handle raw data files in the data tool
Mikko Rasa [Tue, 2 Nov 2021 14:38:24 +0000 (16:38 +0200)]
Recognize and handle raw data files in the data tool

3 years agoShuffle some names around in the data tool
Mikko Rasa [Tue, 2 Nov 2021 13:25:02 +0000 (15:25 +0200)]
Shuffle some names around in the data tool

3 years agoAdd a function to detect raw data signature
Mikko Rasa [Tue, 2 Nov 2021 09:57:28 +0000 (11:57 +0200)]
Add a function to detect raw data signature

3 years agoAdd a class for loading raw bulk data
Mikko Rasa [Mon, 1 Nov 2021 10:54:37 +0000 (12:54 +0200)]
Add a class for loading raw bulk data

3 years agoRemove the obsolete LoadableTypeRegistry class
Mikko Rasa [Mon, 1 Nov 2021 09:09:46 +0000 (11:09 +0200)]
Remove the obsolete LoadableTypeRegistry class

3 years agoUse the override specifier to mark overridden virtual functions
Mikko Rasa [Sun, 31 Oct 2021 22:50:40 +0000 (00:50 +0200)]
Use the override specifier to mark overridden virtual functions

3 years agoUse variadic templates and forwarding references for better flexibility
Mikko Rasa [Sun, 31 Oct 2021 20:16:55 +0000 (22:16 +0200)]
Use variadic templates and forwarding references for better flexibility

3 years agoUse default member initializers for constant initial values
Mikko Rasa [Sun, 31 Oct 2021 19:16:01 +0000 (21:16 +0200)]
Use default member initializers for constant initial values

3 years agoMark empty constructors and destructors as defaulted
Mikko Rasa [Sun, 31 Oct 2021 19:12:00 +0000 (21:12 +0200)]
Mark empty constructors and destructors as defaulted

3 years agoAdd missing includes
Mikko Rasa [Sun, 31 Oct 2021 18:54:30 +0000 (20:54 +0200)]
Add missing includes

3 years agoUse plain function pointer instead of std::function
Mikko Rasa [Sun, 31 Oct 2021 18:53:33 +0000 (20:53 +0200)]
Use plain function pointer instead of std::function

The lambda ended up having no captures, so this works.

3 years agoExplicitly convert regex match to boolean
Mikko Rasa [Sun, 31 Oct 2021 18:53:07 +0000 (20:53 +0200)]
Explicitly convert regex match to boolean

3 years agoUse nullptr instead of 0 for pointers
Mikko Rasa [Sun, 31 Oct 2021 18:52:56 +0000 (20:52 +0200)]
Use nullptr instead of 0 for pointers

3 years agoMake boolean conversion operators explicit
Mikko Rasa [Sun, 31 Oct 2021 18:39:47 +0000 (20:39 +0200)]
Make boolean conversion operators explicit

4 years agoTweak DynamicObjectLoader to make it extensible
Mikko Rasa [Thu, 7 Oct 2021 12:54:23 +0000 (15:54 +0300)]
Tweak DynamicObjectLoader to make it extensible

Subclasses can now override te type handler and access the object without
clearing it, for example to perform some custom initialization after the
object has been created.

4 years agoRemove unnecessary capture from a lambda
Mikko Rasa [Thu, 7 Oct 2021 12:47:09 +0000 (15:47 +0300)]
Remove unnecessary capture from a lambda

4 years agoAlso call finish on auxiliary loaders
Mikko Rasa [Wed, 6 Oct 2021 21:33:30 +0000 (00:33 +0300)]
Also call finish on auxiliary loaders

4 years agoReturn the object from DynamicObjectLoader::store_object
Mikko Rasa [Wed, 6 Oct 2021 20:27:34 +0000 (23:27 +0300)]
Return the object from DynamicObjectLoader::store_object

This provides an easy way to both store the object and also use it.

4 years agoAvoid inconsistent state in Collection if a notify function throws
Mikko Rasa [Wed, 6 Oct 2021 20:25:19 +0000 (23:25 +0300)]
Avoid inconsistent state in Collection if a notify function throws

4 years agoChange remaining fixed-size integers to standard types
Mikko Rasa [Tue, 5 Oct 2021 22:08:46 +0000 (01:08 +0300)]
Change remaining fixed-size integers to standard types

4 years agoAdd support for storing the loaded object in DynamicObjectLoader
Mikko Rasa [Tue, 5 Oct 2021 22:00:48 +0000 (01:00 +0300)]
Add support for storing the loaded object in DynamicObjectLoader

This allows the object to be stored in the collection using its actual
type rather than the base class.

4 years agoRedesign Collection's creator and notify mechanisms to be more generic
Mikko Rasa [Tue, 5 Oct 2021 21:03:35 +0000 (00:03 +0300)]
Redesign Collection's creator and notify mechanisms to be more generic

They now allow any functors, including lambdas.

4 years agoAdd a class for loading dynamically typed objects
Mikko Rasa [Tue, 5 Oct 2021 10:55:37 +0000 (13:55 +0300)]
Add a class for loading dynamically typed objects

4 years agoFix incorrect order of memcpy args
Mikko Rasa [Tue, 31 Aug 2021 00:27:50 +0000 (03:27 +0300)]
Fix incorrect order of memcpy args

4 years agoRemove unnecessary header
Mikko Rasa [Sun, 29 Aug 2021 22:54:20 +0000 (01:54 +0300)]
Remove unnecessary header

4 years agoForce correct conversion of symbols
Mikko Rasa [Sun, 29 Aug 2021 22:52:34 +0000 (01:52 +0300)]
Force correct conversion of symbols

MSVC attempts to use the conversion operator in Symbol rather than
Value's constructor.

4 years agoUse C++11 features to manipulate containers
Mikko Rasa [Sun, 29 Aug 2021 18:29:32 +0000 (21:29 +0300)]
Use C++11 features to manipulate containers

4 years agoUse metaprogramming constructs from std
Mikko Rasa [Sun, 29 Aug 2021 14:17:23 +0000 (17:17 +0300)]
Use metaprogramming constructs from std

4 years agoPerform bit conversion using standard-sanctioned memcpy method
Mikko Rasa [Sun, 29 Aug 2021 10:33:54 +0000 (13:33 +0300)]
Perform bit conversion using standard-sanctioned memcpy method

The compiler should be able to optimize it away.

4 years agoUse <cstdint> in BinFloat
Mikko Rasa [Sun, 29 Aug 2021 10:32:08 +0000 (13:32 +0300)]
Use <cstdint> in BinFloat

4 years agoRequire C++11 for building
Mikko Rasa [Sun, 29 Aug 2021 10:29:29 +0000 (13:29 +0300)]
Require C++11 for building

4 years agoBump version for upcoming changes
Mikko Rasa [Sun, 29 Aug 2021 10:11:45 +0000 (13:11 +0300)]
Bump version for upcoming changes

4 years agoAdd a mechanism for collections to be notified when an item is added
Mikko Rasa [Sun, 25 Apr 2021 11:07:56 +0000 (14:07 +0300)]
Add a mechanism for collections to be notified when an item is added

4 years agoRemove some long-deprecated things
Mikko Rasa [Fri, 23 Apr 2021 11:41:07 +0000 (14:41 +0300)]
Remove some long-deprecated things

4 years agoReserve enough storage for the output in base64_decode
Mikko Rasa [Sun, 18 Apr 2021 12:05:19 +0000 (15:05 +0300)]
Reserve enough storage for the output in base64_decode

4 years agoAdd support for base64-encoded strings in text format
Mikko Rasa [Mon, 12 Apr 2021 21:53:03 +0000 (00:53 +0300)]
Add support for base64-encoded strings in text format

They're much more efficient both space and decoding wise than using C
escapes to encode binary data.

4 years agoDeprecate LoadableTypeRegistry
Mikko Rasa [Mon, 12 Apr 2021 11:53:59 +0000 (14:53 +0300)]
Deprecate LoadableTypeRegistry

The general-purpose TypeRegistry in mspcore solves the same problems
better.

4 years agoReport locations of errors through multiple levels of referenced files
Mikko Rasa [Fri, 19 Feb 2021 23:10:34 +0000 (01:10 +0200)]
Report locations of errors through multiple levels of referenced files

4 years agoMinor style/typo fixes
Mikko Rasa [Sun, 17 Jan 2021 10:51:10 +0000 (12:51 +0200)]
Minor style/typo fixes

4 years agoMake Loader::ActionMap delete the actions
Mikko Rasa [Sun, 17 Jan 2021 10:50:10 +0000 (12:50 +0200)]
Make Loader::ActionMap delete the actions

This ensures actions in shared action maps are deleted as well

4 years agoTurn Statement into a struct
Mikko Rasa [Sun, 17 Jan 2021 10:45:49 +0000 (12:45 +0200)]
Turn Statement into a struct

4 years agoImplement proper copy semantics
Mikko Rasa [Sun, 17 Jan 2021 10:41:50 +0000 (12:41 +0200)]
Implement proper copy semantics

All classes are now either safe to copy or are marked noncopyable.

4 years agoMake the File reference in PackSource::Object const
Mikko Rasa [Sun, 17 Jan 2021 10:42:22 +0000 (12:42 +0200)]
Make the File reference in PackSource::Object const

4 years agoFix an incorrect condition for throwing an exception
Mikko Rasa [Wed, 30 Dec 2020 16:41:38 +0000 (18:41 +0200)]
Fix an incorrect condition for throwing an exception

Null actions are allowed, so only throw if there was no match.

4 years agoAdd find functions to Collection
Mikko Rasa [Wed, 30 Dec 2020 16:40:48 +0000 (18:40 +0200)]
Add find functions to Collection

5 years agoSupport custom action maps in loader classes
Mikko Rasa [Sun, 19 Apr 2020 14:30:36 +0000 (17:30 +0300)]
Support custom action maps in loader classes

This makes it possible to implement a persistent action map which is
only initialized once the first time a particular class is used.

5 years agoSupport loader functions with bound first argument
Mikko Rasa [Sun, 19 Apr 2020 14:24:55 +0000 (17:24 +0300)]
Support loader functions with bound first argument

This allows more flexibility in defining dynamic keywords.  Only
available with C++11.

5 years agoSupport N-ary loader functions if compiling in C++11 mode
Mikko Rasa [Sun, 19 Apr 2020 14:23:50 +0000 (17:23 +0300)]
Support N-ary loader functions if compiling in C++11 mode

5 years agoAllow non-loadable types in collections
Mikko Rasa [Sun, 19 Apr 2020 14:09:07 +0000 (17:09 +0300)]
Allow non-loadable types in collections

Custom collection classes may wish to provide objects of such types
through creator functions.

5 years agoUpdate a SFINAE construct
Mikko Rasa [Sun, 19 Apr 2020 13:24:11 +0000 (16:24 +0300)]
Update a SFINAE construct

5 years agoPrefer vector over list
Mikko Rasa [Sun, 19 Apr 2020 13:22:51 +0000 (16:22 +0300)]
Prefer vector over list

6 years agoThrow an exception if trying to load a nonexistent file
Mikko Rasa [Wed, 21 Aug 2019 22:06:52 +0000 (01:06 +0300)]
Throw an exception if trying to load a nonexistent file

Collection::open_raw returns a null pointer in this case so it must be
checked.

6 years agoAdd support for generating .cpp files for BuiltinSource
Mikko Rasa [Wed, 12 Jun 2019 16:43:28 +0000 (19:43 +0300)]
Add support for generating .cpp files for BuiltinSource

6 years agoUse IO::BufferedFile in the packer component of datatool
Mikko Rasa [Wed, 12 Jun 2019 16:42:25 +0000 (19:42 +0300)]
Use IO::BufferedFile in the packer component of datatool

6 years agoAdd a utility for registering types for loading
Mikko Rasa [Wed, 12 Jun 2019 10:13:22 +0000 (13:13 +0300)]
Add a utility for registering types for loading

Somewhat ironically Collection can't use this because it has much more
complex requirements.

6 years agoAllow modifying existing types in a collection
Mikko Rasa [Fri, 7 Jun 2019 17:27:17 +0000 (20:27 +0300)]
Allow modifying existing types in a collection

6 years agoAnnotate deprecated identifiers as such
Mikko Rasa [Mon, 3 Jun 2019 11:54:16 +0000 (14:54 +0300)]
Annotate deprecated identifiers as such

6 years agoUse a larger buffer size when transferring pack contents
Mikko Rasa [Mon, 3 Jun 2019 08:22:05 +0000 (11:22 +0300)]
Use a larger buffer size when transferring pack contents

6 years agoRespect the TMPDIR environment variable when creating data packs
Mikko Rasa [Mon, 3 Jun 2019 08:20:23 +0000 (11:20 +0300)]
Respect the TMPDIR environment variable when creating data packs

6 years agoPrefer exact type match when looking for Loader actions
Mikko Rasa [Mon, 3 Jun 2019 08:16:18 +0000 (11:16 +0300)]
Prefer exact type match when looking for Loader actions

Previosuly the first matching action in alphabetical signature order was
taken, which causes a float overload to be chosen for an int value even
if an int overload was also available.

6 years agoAdd a test case for Loader overload resolution
Mikko Rasa [Mon, 3 Jun 2019 08:15:11 +0000 (11:15 +0300)]
Add a test case for Loader overload resolution

6 years agoUpdate Collection terminology
Mikko Rasa [Mon, 3 Jun 2019 08:12:40 +0000 (11:12 +0300)]
Update Collection terminology

Mostly in test cases but there was one lingering reference to "future"
objects in the actual header as well.

6 years agoFix test cases so they compile again
Mikko Rasa [Mon, 3 Jun 2019 07:29:35 +0000 (10:29 +0300)]
Fix test cases so they compile again

6 years agoAdd more flexible versions of the load function
Mikko Rasa [Fri, 24 May 2019 17:25:39 +0000 (20:25 +0300)]
Add more flexible versions of the load function

Firstly there's a variadic version of the basic load function.  Secondly
and perhaps more importantly there are versions which can load an object
from a file stored in a collection.  All of these are only implemented
for C++11 for now, since supporting the old version seems increasingly
irrelevant.

6 years agoMove NeedsCollection into its own header and adjust for new Sfinae struct
Mikko Rasa [Fri, 24 May 2019 17:04:36 +0000 (20:04 +0300)]
Move NeedsCollection into its own header and adjust for new Sfinae struct

7 years agoUse automatic base detection when parsing integers
Mikko Rasa [Wed, 21 Feb 2018 17:30:40 +0000 (19:30 +0200)]
Use automatic base detection when parsing integers

8 years agoAdd a missing include
Mikko Rasa [Fri, 6 Jan 2017 02:54:59 +0000 (04:54 +0200)]
Add a missing include

8 years agoAdd a source class for builtin data
Mikko Rasa [Tue, 15 Nov 2016 15:57:21 +0000 (17:57 +0200)]
Add a source class for builtin data

8 years agoProvide access to the keyword of the current statement
Mikko Rasa [Sat, 5 Nov 2016 07:47:56 +0000 (09:47 +0200)]
Provide access to the keyword of the current statement