Conversation
…ase32Encoder/Base32Decoder
matejk
requested changes
Dec 19, 2025
Contributor
matejk
left a comment
There was a problem hiding this comment.
Some observations are potential bugs (like negative char index), others are mostly improvements.
| BASE32_NO_PADDING = 0x00, | ||
| /// Don't append padding characters ('=') at end. | ||
| /// | ||
| /// NOTE: This is provided for consistency with BAse64EncodingOptions. |
Contributor
There was a problem hiding this comment.
Maybe typo: BAse64.. (should be Base64..)
| void parse(const std::string& ulid); | ||
| /// Parses the ULID from its string representation. | ||
|
|
||
| bool tryParse(const std::string& ulid); |
| /// members and returns true. Otherwise leaves the | ||
| /// object unchanged and returns false. | ||
|
|
||
| std::string toString() const; |
| /// The buffer need not be aligned. | ||
| /// There must have room for at least 16 bytes. | ||
|
|
||
| Poco::UInt64 time() const; |
Contributor
There was a problem hiding this comment.
use [[nodiscard]]? Also applies to other functions.
| ~ULIDGenerator(); | ||
| /// Destroys the ULIDGenerator. | ||
|
|
||
| ULID create(); |
Contributor
There was a problem hiding this comment.
use [[nodiscard]]? Also applies to other functions.
Foundation/src/ULID.cpp
Outdated
| }; | ||
|
|
||
|
|
||
| ULID::ULID() |
| } | ||
|
|
||
|
|
||
| ULID& ULID::operator = (const ULID& ulid) |
Foundation/src/ULID.cpp
Outdated
|
|
||
| const ULID& ULID::null() | ||
| { | ||
| static ULID nil; |
|
|
||
|
|
||
| const unsigned char Base32EncoderBuf::OUT_ENCODING[32] = | ||
| const unsigned char Base32EncoderBuf::DEFAULT_ENCODING[32] = |
Contributor
There was a problem hiding this comment.
Have a private (cpp only) static constexpr std::array for all these arrays?
| } | ||
|
|
||
|
|
||
| const char ULID::ENCODING[32] = |
Contributor
There was a problem hiding this comment.
cpp-only static constexpr std::array?
… alternative decode symbols for Crockford's Base 32 (0/O/o, 1/I/i/L/l), lowercase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for Universally Unique Lexicographically Sortable Identifier (ULID), as specified in https://github.com/ulid/spec.
This is implemented similar to existing UUID support, with a
ULIDclass holding a ULID and supporting conversion to/from string representation, as well as aULIDGeneratorclass for generating ULIDs.In addition, this PR has enhancements for Base32Encoder and Base32Decoder (supporting Crockford Base 32), although these ended up not actually used by the ULID class.