Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showing Tags in the UI #98

Merged
merged 31 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2b269b3
Working on infrastructure to support Finder tags
mikekazakov Jan 14, 2024
8d34afe
Reading from files
mikekazakov Jan 14, 2024
06bc83b
Reading from FinderInfo as well
mikekazakov Jan 14, 2024
84287fd
A bit of loggic in the unit test
mikekazakov Jan 14, 2024
a147085
Trying to fix a failing test
mikekazakov Jan 14, 2024
a1bd297
Grey -> Gray
mikekazakov Jan 14, 2024
9c70dfb
Use flistxattr() first instead of probing via fgetxattr()
mikekazakov Jan 15, 2024
2b098b0
VFS support for FinderTags
mikekazakov Jan 16, 2024
7467a7d
Working on the presentation of the tags
mikekazakov Jan 17, 2024
28e8a6b
Build paths for tags only once, explicit colors
mikekazakov Jan 18, 2024
a270967
Merge remote-tracking branch 'refs/remotes/origin/main'
mikekazakov Jan 20, 2024
dafc04c
Drawing tags in brief and list presentations
mikekazakov Jan 20, 2024
467ff8d
Supporting cases where tags are written only as text labels without s…
mikekazakov Jan 20, 2024
0a7074b
updated the version of the Frozen library
mikekazakov Jan 21, 2024
653a335
Now storing the predefined colors in a frozen map
mikekazakov Jan 21, 2024
a0a8a3d
Working on infrastructure to support Finder tags
mikekazakov Jan 14, 2024
9ca8654
Reading from files
mikekazakov Jan 14, 2024
bd77b0f
Reading from FinderInfo as well
mikekazakov Jan 14, 2024
6cb869b
A bit of loggic in the unit test
mikekazakov Jan 14, 2024
6ac3886
Trying to fix a failing test
mikekazakov Jan 14, 2024
07d7a34
Grey -> Gray
mikekazakov Jan 14, 2024
aa817d4
Use flistxattr() first instead of probing via fgetxattr()
mikekazakov Jan 15, 2024
e2d73b4
VFS support for FinderTags
mikekazakov Jan 16, 2024
d36d346
Working on the presentation of the tags
mikekazakov Jan 17, 2024
a54541c
Build paths for tags only once, explicit colors
mikekazakov Jan 18, 2024
e46140e
Drawing tags in brief and list presentations
mikekazakov Jan 20, 2024
c2317a4
Supporting cases where tags are written only as text labels without s…
mikekazakov Jan 20, 2024
cbc7ce0
updated the version of the Frozen library
mikekazakov Jan 21, 2024
c23f6d7
Now storing the predefined colors in a frozen map
mikekazakov Jan 21, 2024
844730a
Merge remote-tracking branch 'refs/remotes/origin/tags'
mikekazakov Jan 22, 2024
b7c057e
Adjust the presentation to closer match what Finder does
mikekazakov Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rd_Party/frozen/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TMP_DIR=${CUR_DIR}/frozen.tmp
mkdir ${TMP_DIR}
cd ${TMP_DIR}

git clone -b 1.0.1 --single-branch https://github.com/serge-sans-paille/frozen
git clone -b 1.1.1 --single-branch https://github.com/serge-sans-paille/frozen

cd ..

Expand Down
7 changes: 7 additions & 0 deletions 3rd_Party/frozen/include/frozen/bits/basic_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "frozen/bits/exceptions.h"

#include <array>
#include <utility>
#include <iterator>
#include <string>
Expand Down Expand Up @@ -115,6 +116,12 @@ class carray {
{
static_assert(M >= N, "Cannot initialize a carray with an smaller array");
}
template <std::size_t M>
constexpr carray(std::array<T, M> const &init)
: carray(&init[0], std::make_index_sequence<N>())
{
static_assert(M >= N, "Cannot initialize a carray with an smaller array");
}
constexpr carray(std::initializer_list<T> init)
: carray(init.begin(), std::make_index_sequence<N>())
{
Expand Down
8 changes: 8 additions & 0 deletions 3rd_Party/frozen/include/frozen/bits/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,12 @@
#define FROZEN_LETITGO_HAS_CHAR8T
#endif

#if __cpp_deduction_guides >= 201703L
#define FROZEN_LETITGO_HAS_DEDUCTION_GUIDES
#endif

#if __cpp_lib_constexpr_string >= 201907L
#define FROZEN_LETITGO_HAS_CONSTEXPR_STRING
#endif

#endif // FROZEN_LETITGO_DEFINES_H
9 changes: 8 additions & 1 deletion 3rd_Party/frozen/include/frozen/bits/elsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

namespace frozen {

template <class T> struct elsa {
template <class T = void> struct elsa {
static_assert(std::is_integral<T>::value || std::is_enum<T>::value,
"only supports integral types, specialize for other types");

Expand All @@ -44,6 +44,13 @@ template <class T> struct elsa {
}
};

template <> struct elsa<void> {
template<class T>
constexpr std::size_t operator()(T const &value, std::size_t seed) const {
return elsa<T>{}(value, seed);
}
};

template <class T> using anna = elsa<T>;
} // namespace frozen

Expand Down
40 changes: 40 additions & 0 deletions 3rd_Party/frozen/include/frozen/bits/elsa_std.h
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
28 changes: 28 additions & 0 deletions 3rd_Party/frozen/include/frozen/bits/hash_string.h
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
13 changes: 9 additions & 4 deletions 3rd_Party/frozen/include/frozen/bits/pmh.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,18 @@ struct pmh_tables {
carray<std::size_t, M> second_table_;
Hasher hash_;

// Looks up a given key, to find its expected index in carray<Item, N>
// Always returns a valid index, must use KeyEqual test after to confirm.
template <typename KeyType>
constexpr std::size_t lookup(const KeyType & key) const {
auto const d = first_table_[hash_(key, static_cast<size_t>(first_seed_)) % M];
return lookup(key, hash_);
}

// Looks up a given key, to find its expected index in carray<Item, N>
// Always returns a valid index, must use KeyEqual test after to confirm.
template <typename KeyType, typename HasherType>
constexpr std::size_t lookup(const KeyType & key, const HasherType& hasher) const {
auto const d = first_table_[hasher(key, static_cast<size_t>(first_seed_)) % M];
if (!d.is_seed()) { return static_cast<std::size_t>(d.value()); } // this is narrowing uint64 -> size_t but should be fine
else { return second_table_[hash_(key, static_cast<std::size_t>(d.value())) % M]; }
else { return second_table_[hasher(key, static_cast<std::size_t>(d.value())) % M]; }
}
};

Expand Down
2 changes: 1 addition & 1 deletion 3rd_Party/frozen/include/frozen/bits/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define FROZEN_LETITGO_VERSION_H

#define FROZEN_MAJOR_VERSION 1
#define FROZEN_MINOR_VERSION 0
#define FROZEN_MINOR_VERSION 1
#define FROZEN_PATCH_VERSION 1

#endif
Loading
Loading