- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Showing Tags in the UI (#98)
* Working on infrastructure to support Finder tags * Reading from files * Reading from FinderInfo as well * A bit of loggic in the unit test * Trying to fix a failing test * Grey -> Gray * Use flistxattr() first instead of probing via fgetxattr() * VFS support for FinderTags * Working on the presentation of the tags * Build paths for tags only once, explicit colors * Drawing tags in brief and list presentations * Supporting cases where tags are written only as text labels without specifying the color index explicitly * updated the version of the Frozen library * Now storing the predefined colors in a frozen map * Working on infrastructure to support Finder tags * Reading from files * Reading from FinderInfo as well * A bit of loggic in the unit test * Trying to fix a failing test * Grey -> Gray * Use flistxattr() first instead of probing via fgetxattr() * VFS support for FinderTags * Working on the presentation of the tags * Build paths for tags only once, explicit colors * Drawing tags in brief and list presentations * Supporting cases where tags are written only as text labels without specifying the color index explicitly * updated the version of the Frozen library * Now storing the predefined colors in a frozen map * Adjust the presentation to closer match what Finder does
1 parent
083893c
commit a3f4573
Showing
44 changed files
with
1,974 additions
and
419 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef FROZEN_LETITGO_BITS_ELSA_STD_H | ||
#define FROZEN_LETITGO_BITS_ELSA_STD_H | ||
|
||
#include "elsa.h" | ||
#include "hash_string.h" | ||
|
||
#ifdef FROZEN_LETITGO_HAS_STRING_VIEW | ||
#include <string_view> | ||
#endif | ||
#include <string> | ||
|
||
namespace frozen { | ||
|
||
#ifdef FROZEN_LETITGO_HAS_STRING_VIEW | ||
|
||
template <typename CharT> struct elsa<std::basic_string_view<CharT>> | ||
{ | ||
constexpr std::size_t operator()(const std::basic_string_view<CharT>& value) const { | ||
return hash_string(value); | ||
} | ||
constexpr std::size_t operator()(const std::basic_string_view<CharT>& value, std::size_t seed) const { | ||
return hash_string(value, seed); | ||
} | ||
}; | ||
|
||
#endif | ||
|
||
template <typename CharT> struct elsa<std::basic_string<CharT>> | ||
{ | ||
constexpr std::size_t operator()(const std::basic_string<CharT>& value) const { | ||
return hash_string(value); | ||
} | ||
constexpr std::size_t operator()(const std::basic_string<CharT>& value, std::size_t seed) const { | ||
return hash_string(value, seed); | ||
} | ||
}; | ||
|
||
} // namespace frozen | ||
|
||
#endif // FROZEN_LETITGO_BITS_ELSA_STD_H |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef FROZEN_LETITGO_BITS_HASH_STRING_H | ||
#define FROZEN_LETITGO_BITS_HASH_STRING_H | ||
|
||
#include <cstddef> | ||
|
||
namespace frozen { | ||
|
||
template <typename String> | ||
constexpr std::size_t hash_string(const String& value) { | ||
std::size_t d = 5381; | ||
for (const auto& c : value) | ||
d = d * 33 + static_cast<size_t>(c); | ||
return d; | ||
} | ||
|
||
// https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function | ||
// With the lowest bits removed, based on experimental setup. | ||
template <typename String> | ||
constexpr std::size_t hash_string(const String& value, std::size_t seed) { | ||
std::size_t d = (0x811c9dc5 ^ seed) * static_cast<size_t>(0x01000193); | ||
for (const auto& c : value) | ||
d = (d ^ static_cast<size_t>(c)) * static_cast<size_t>(0x01000193); | ||
return d >> 8 ; | ||
} | ||
|
||
} // namespace frozen | ||
|
||
#endif // FROZEN_LETITGO_BITS_HASH_STRING_H |
This file contains 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
This file contains 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
Oops, something went wrong.