Commit graph

38 commits

Author SHA1 Message Date
Sönke Ludwig 7912905c7f Make GenericPath.Segment(2).opCast const. 2021-02-13 18:09:13 +01:00
Sönke Ludwig 9f73049196 Use path format specific separator for root prefix segment.
Fixes format invariant checks for formats that do not use "/" as a path separator.
2021-01-19 10:34:43 +01:00
Sönke Ludwig 246b5262c6 Avoid among switch-case jump table overhead for just two possible values. 2021-01-19 10:34:43 +01:00
Sönke Ludwig dc0fe5ad73 Apply the same optimization to InetPathFormat.encodeSegment. 2021-01-19 10:30:28 +01:00
Sönke Ludwig 4bb5fc9ce8 Optmize InetPathFormat.validatePath.
Speeds up the check by roughly 4x.
2021-01-19 10:30:28 +01:00
Sönke Ludwig 762ababa4d Add Segment2.extension and .withoutExtension properties.
Also adds GenericPath.fileExtension as a shortcut for `path.head2.extension`.
2021-01-15 18:25:20 +01:00
Sönke Ludwig 14bbc4bdec Add GenericPath.normalized property. 2021-01-15 18:25:19 +01:00
Sönke Ludwig cc66180ad8 Ensure path relativeTo() is nothrow. 2020-04-16 09:52:58 +02:00
Geod24 9615ed1d5a Fix documentation warning on parameter 2019-12-17 17:12:56 +09:00
Sönke Ludwig 07c7bb88a9 Make the range returned by bySegment2 a Voldemort type.
Declaring it as a public symbol just introduces API maintenance burden without a real benefit.
2019-10-22 11:30:54 +02:00
Sönke Ludwig 6985e8dcb4 Add GenericPath.byPrefix.
Allows successively iterating over ancestor paths in O(n) complexity and with no dynamic memory allocations.
2019-10-22 11:30:53 +02:00
Sönke Ludwig 645896bcfd Use bySegment2 instead of bySegment for high-level functionality. 2019-09-19 15:33:00 +02:00
Sönke Ludwig 6ef53121ad Add GenericPath.bySegment2 and .head2 as fully nogc alternatives. 2019-09-19 15:32:59 +02:00
Sönke Ludwig 32858b7aee Rework the path segment encoding/decoding API.
- Deprecates Format.decodeSegment (returning a range of GemericPath.Segment) and added decodeSingleSegment instead, which returns a string instead.
- Adds Format.encodeSegment to encode a single path segment
2019-09-19 15:32:59 +02:00
JinShil eb4344653e Replace hash_t with size_t 2019-08-31 12:29:15 +09:00
Sönke Ludwig f6b97b04c3 Make GenericPath.parentPath pure. 2019-08-21 13:57:54 +02:00
Sönke Ludwig c4af4b2a02 Fix WindowsPath.bySegment of an empty path returning a bogus empty segment. 2018-10-01 21:54:29 +02:00
Sönke Ludwig fae7d3e93d
Revert non-compiling change. 2018-07-09 11:58:25 +02:00
Sönke Ludwig 5f18693c49
Mark the Path(Segment) constructor as nothrow. 2018-07-09 09:19:35 +02:00
Sönke Ludwig 6cf2579206 Fix path construction from segment range with no internal separators. 2017-09-10 00:16:53 +02:00
Sönke Ludwig 5e979364cb
Fix whitespace. 2017-08-10 11:08:26 +02:00
Sönke Ludwig 24f4e5f70f Resurrect GenericPath.startsWith.
Since the semantics are different w.r.t. path separators, the alternative suggested in the deprecation message is not valid. At least until the comparison/toString semantics of PathSegment have a profound definition, it will be kept around to avoid unneeded interruptions when upgrading to 0.8.x.
2017-08-10 10:09:01 +02:00
Sönke Ludwig fcf98c2016 Merge branch 'master' into trailing-whitespace 2017-07-19 00:08:33 +02:00
Sönke Ludwig 429d5dcb77 Fix GenericPath.parentPath. 2017-07-07 22:29:12 +02:00
Sebastian Wilzbach 8f89733a86 Remove all trailing whitespace
sed 's/[ \t]*$//' -i **/*.d
2017-07-03 12:19:27 +02:00
Sönke Ludwig f123e55fa9 Fix assertion condition. 2017-06-22 16:22:11 +02:00
Sönke Ludwig 07e077a009
Redesign the Path type to statically encode the path format.
The previous design, while intended as an improvement over the one-size-fits all Path struct of vibe-d:core, turned out to produce lots of bugs during the transition, because of missing Path.type checks.

The new design uses a cleaner approach, where the static type of a path value encodes the path format. An explicit cast is necessary to convert between different path types. The internet path type also performs proper validation and percent encoding, so that InetPath.toString() always produces a valid URI path.
2017-06-21 14:04:24 +02:00
Sönke Ludwig 0d164708ec Fix Windows->inet/Posix path conversion issue. 2017-06-15 10:04:55 +02:00
Sönke Ludwig 62e3add3ab Fix a number of issues related to mixing different path types. 2017-06-12 17:33:25 +02:00
Sönke Ludwig 77eddebe45 Improve Path compatibility with the original implementation. 2017-03-10 19:53:07 +01:00
Sönke Ludwig 3f83bef219 Fix Path.parentPath and Path.toString for PathType.windows. 2017-02-18 16:00:27 +01:00
Sönke Ludwig e80d7244bc
Add PathEntry.validateFilename. 2017-01-19 00:33:52 +01:00
Sönke Ludwig fb706ea0b6
Properly implement struct Path.
The new implementation is @nogc where possible.
2017-01-17 23:50:33 +01:00
Sönke Ludwig 4b4e1575dc Extend the Path interface somewhat. 2016-11-08 14:48:18 +01:00
Sönke Ludwig d5e19e1db6 Disable failing unit tests until Path is properly implemented. 2016-11-02 21:02:36 +01:00
Sönke Ludwig c7e1468c87 Extend the Path interface (not yet fully implemented). 2016-11-02 21:00:13 +01:00
Sönke Ludwig 12daa5c575 Add Path concatenation operators. 2016-10-25 08:56:05 +02:00
Sönke Ludwig 7e2d1dd038 Initial commit.
The library is able to support simple TCP servers in the current state. The API is still mostly compatible with mainline vibe.d, but the driver systen has been replaced by the eventcore library and sockets/files/timers/... are now structs with automatic reference counting instead of GC collected classes. The stream interfaces have been removed for now.
2016-03-01 20:30:42 +01:00