]> git.tdb.fi Git - libs/datafile.git/log
libs/datafile.git
3 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

3 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

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

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

3 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

3 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

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

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

3 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

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

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

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

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

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

3 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

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

3 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

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

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

3 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

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

3 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

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

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

3 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

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

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

4 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.

4 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.

4 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

4 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.

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

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

5 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.

5 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

5 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

5 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.

5 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

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

5 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

5 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

5 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.

5 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

5 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.

5 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

5 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.

5 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

6 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

7 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

8 years agoReplace files from earlier packs with those from the newly added one
Mikko Rasa [Sat, 29 Oct 2016 16:45:40 +0000 (19:45 +0300)]
Replace files from earlier packs with those from the newly added one

8 years agoPrioritize matching suffixes when looking for a type
Mikko Rasa [Wed, 26 Oct 2016 21:12:46 +0000 (00:12 +0300)]
Prioritize matching suffixes when looking for a type

8 years agoMerge remote-tracking branch 'origin/master'
Mikko Rasa [Mon, 19 Sep 2016 14:00:06 +0000 (17:00 +0300)]
Merge remote-tracking branch 'origin/master'

8 years agoMove all exception classes to except.h, for real this time
Mikko Rasa [Mon, 19 Sep 2016 13:45:15 +0000 (16:45 +0300)]
Move all exception classes to except.h, for real this time

8 years agoImplement a parser mode for JSON files
Mikko Rasa [Fri, 2 Sep 2016 12:34:48 +0000 (15:34 +0300)]
Implement a parser mode for JSON files

8 years agoMove token-to-argument conversion to Statement
Mikko Rasa [Fri, 2 Sep 2016 12:34:15 +0000 (15:34 +0300)]
Move token-to-argument conversion to Statement

8 years agoSome refactoring of TextParser logic
Mikko Rasa [Fri, 2 Sep 2016 11:44:08 +0000 (14:44 +0300)]
Some refactoring of TextParser logic

8 years agoMove all exception classes to a common header
Mikko Rasa [Fri, 2 Sep 2016 11:41:49 +0000 (14:41 +0300)]
Move all exception classes to a common header

8 years agoDon't use deprecated typedefs
Mikko Rasa [Sun, 31 Jan 2016 15:37:38 +0000 (17:37 +0200)]
Don't use deprecated typedefs

8 years agoStore offsets and sizes in PackSource as 64-bit ints
Mikko Rasa [Mon, 7 Dec 2015 19:01:13 +0000 (21:01 +0200)]
Store offsets and sizes in PackSource as 64-bit ints

9 years agoAdd a getter for fallback in Collection
Mikko Rasa [Tue, 24 Nov 2015 20:19:06 +0000 (22:19 +0200)]
Add a getter for fallback in Collection

9 years agoUse const sources in Collection
Mikko Rasa [Wed, 18 Nov 2015 20:45:18 +0000 (22:45 +0200)]
Use const sources in Collection

The CollectionSource interface is entirely const anyway.

9 years agoChain get_status to fallback collection if one is defined
Mikko Rasa [Sat, 14 Nov 2015 17:05:03 +0000 (19:05 +0200)]
Chain get_status to fallback collection if one is defined

9 years agoRemove the loaded flag from PackSource files
Mikko Rasa [Fri, 13 Nov 2015 08:53:35 +0000 (10:53 +0200)]
Remove the loaded flag from PackSource files

It seems to be a relic from ancient times.  It also causes problems in
certain situations where it's desirable to remove and reload items.

9 years agoAdd an unpack option to the data tool
Mikko Rasa [Mon, 7 Sep 2015 09:26:58 +0000 (12:26 +0300)]
Add an unpack option to the data tool

9 years agoPlug a memory leak
Mikko Rasa [Sat, 7 Mar 2015 02:07:09 +0000 (04:07 +0200)]
Plug a memory leak

9 years agoAccept int-to-float conversion in array signature
Mikko Rasa [Fri, 19 Dec 2014 03:34:44 +0000 (05:34 +0200)]
Accept int-to-float conversion in array signature

10 years agoAdd version of add_pack_io with filter
Mikko Rasa [Mon, 10 Nov 2014 17:47:56 +0000 (19:47 +0200)]
Add version of add_pack_io with filter

10 years agoSupport adding packs from IO::Seekable objects
Mikko Rasa [Sun, 19 Oct 2014 17:33:05 +0000 (20:33 +0300)]
Support adding packs from IO::Seekable objects

This allows using any seekable objects as packs, such as Android assets.

10 years agoProvide help for datatool's command line options
Mikko Rasa [Sun, 19 Oct 2014 13:00:27 +0000 (16:00 +0300)]
Provide help for datatool's command line options

Also use add_argument instead of the deprecated get_args.

10 years agoMore resiliece against certain corner cases when direct loading
Mikko Rasa [Sun, 19 Oct 2014 08:58:00 +0000 (11:58 +0300)]
More resiliece against certain corner cases when direct loading

An empty binary file terminated with __end was causing problems as the
very first peek call would return null, causing Loader to fall back to
indirect loading.  However, the __end was already processed by peek, so
the parse call would fail.

10 years agoMake Loader a virtual base of ObjectLoader to permit diamond inheritance
Mikko Rasa [Wed, 15 Oct 2014 18:22:07 +0000 (21:22 +0300)]
Make Loader a virtual base of ObjectLoader to permit diamond inheritance

Useful when creating loader classes through composition.

10 years agoFix a class/struct inconsistency
Mikko Rasa [Sun, 5 Oct 2014 18:21:51 +0000 (21:21 +0300)]
Fix a class/struct inconsistency

10 years agoRequire sigc++-2.0 since PackSource uses it
Mikko Rasa [Sun, 5 Oct 2014 11:54:14 +0000 (14:54 +0300)]
Require sigc++-2.0 since PackSource uses it

The signal connection may be refactored into libmspcore in the future,
but it's required here for now.

10 years agoAdd a flag to control replacement of DirectorySource entries
Mikko Rasa [Sun, 5 Oct 2014 01:50:48 +0000 (04:50 +0300)]
Add a flag to control replacement of DirectorySource entries

10 years agoUse dynamic_cast to support Collection as virtual base class
Mikko Rasa [Sun, 20 Apr 2014 09:53:33 +0000 (12:53 +0300)]
Use dynamic_cast to support Collection as virtual base class

10 years agoFix logic problems when ignoring a statement in the middle of direct load
Mikko Rasa [Thu, 19 Dec 2013 21:58:53 +0000 (23:58 +0200)]
Fix logic problems when ignoring a statement in the middle of direct load

Each recursive call to parse() was subtracting one from sub_remaining,
causing it to get out of sync with the actual statement hierarchy.

10 years agoDetect eof from the parser, not input file
Mikko Rasa [Tue, 17 Dec 2013 01:01:06 +0000 (03:01 +0200)]
Detect eof from the parser, not input file

Some files have an embedded logical eof, so waiting for the end of the
physical file would (and did) cause an infinite loop.

11 years agoExpose raw open functionality from Collection
Mikko Rasa [Sat, 12 Oct 2013 17:10:45 +0000 (20:10 +0300)]
Expose raw open functionality from Collection

There are several scenarios where streaming or asynchronous loading is
useful.

11 years agoInvoke creators from get_list
Mikko Rasa [Sat, 12 Oct 2013 15:55:33 +0000 (18:55 +0300)]
Invoke creators from get_list

11 years agoAvoid duplicate names if an item is available from multiple sources
Mikko Rasa [Sat, 12 Oct 2013 15:21:30 +0000 (18:21 +0300)]
Avoid duplicate names if an item is available from multiple sources

11 years agoExport file metadata from PackSource
Mikko Rasa [Thu, 5 Sep 2013 14:53:35 +0000 (17:53 +0300)]
Export file metadata from PackSource

11 years agoDon't forget to initialize the control statement flag
Mikko Rasa [Mon, 19 Aug 2013 14:00:11 +0000 (17:00 +0300)]
Don't forget to initialize the control statement flag

11 years agoMore efficient way of loading binary files
Mikko Rasa [Mon, 5 Aug 2013 11:56:26 +0000 (14:56 +0300)]
More efficient way of loading binary files

The Variant array for storing arguments in Statement is too slow.  Bypass
it by passing args directly to the action in a sort of ad-hoc struct.

11 years agoMove newline eating out of BinaryParser
Mikko Rasa [Mon, 5 Aug 2013 09:32:43 +0000 (12:32 +0300)]
Move newline eating out of BinaryParser

It's really a feature of the mode change logic, not the binary mode
itself.

11 years agoRestructure control statement processing
Mikko Rasa [Mon, 5 Aug 2013 09:19:31 +0000 (12:19 +0300)]
Restructure control statement processing

Binary format control statements can no longer occur as substatements, but
that was an accidental feature at best.

11 years agoReplace local RAII set utility with one from mspcore
Mikko Rasa [Sat, 3 Aug 2013 12:24:01 +0000 (15:24 +0300)]
Replace local RAII set utility with one from mspcore

11 years agoUse a common StatementKey structure for Loader and BinaryParser/Writer
Mikko Rasa [Sat, 3 Aug 2013 12:14:11 +0000 (15:14 +0300)]
Use a common StatementKey structure for Loader and BinaryParser/Writer

11 years agoConsider full statement signature when dealing with auxiliary loaders
Mikko Rasa [Sun, 16 Jun 2013 08:25:58 +0000 (11:25 +0300)]
Consider full statement signature when dealing with auxiliary loaders

11 years agoAdd a way to combine multiple loaders
Mikko Rasa [Sat, 15 Jun 2013 20:22:23 +0000 (23:22 +0300)]
Add a way to combine multiple loaders

11 years agoAdd a two-argument constructor to DerivedObjectLoader
Mikko Rasa [Sat, 15 Jun 2013 20:10:12 +0000 (23:10 +0300)]
Add a two-argument constructor to DerivedObjectLoader

11 years agoUse correct keyword in forward declaration
Mikko Rasa [Fri, 24 May 2013 14:47:03 +0000 (17:47 +0300)]
Use correct keyword in forward declaration

clang isn't happy if a struct is forward declared as a class, even though
they are semantically equivalent in that context.

11 years agoAdd accessors for data_error members
Mikko Rasa [Fri, 24 May 2013 14:46:20 +0000 (17:46 +0300)]
Add accessors for data_error members

11 years agoAdd ability to put raw files in a pack
Mikko Rasa [Sat, 13 Apr 2013 12:57:11 +0000 (15:57 +0300)]
Add ability to put raw files in a pack

11 years agoMiscellaneous cleanups
Mikko Rasa [Tue, 26 Mar 2013 20:37:37 +0000 (22:37 +0200)]
Miscellaneous cleanups

11 years agoUse the Sfinae helper struct from mspcore
Mikko Rasa [Tue, 26 Mar 2013 20:37:08 +0000 (22:37 +0200)]
Use the Sfinae helper struct from mspcore

11 years agoComment improvements
Mikko Rasa [Tue, 26 Mar 2013 20:36:17 +0000 (22:36 +0200)]
Comment improvements

11 years agoReturn null instead of throwing if a file is not found in sources
Mikko Rasa [Tue, 26 Mar 2013 20:15:19 +0000 (22:15 +0200)]
Return null instead of throwing if a file is not found in sources

The primary use case for open_from_sources is for creator functions to
open raw files.  This change makes it easier to gracefully skip a non-
existent file and carry on with other ways of loading the item.

11 years agoAdd a virtual destructor to CollectionSource
Mikko Rasa [Wed, 16 Jan 2013 14:05:38 +0000 (16:05 +0200)]
Add a virtual destructor to CollectionSource