|
1 | 1 | /* |
2 | | - * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/> |
3 | | - * (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com> |
| 2 | + * Copyright (C) 2025 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 3 | + * (C) 2025 Vladimir Sadovnikov <sadko4u@gmail.com> |
4 | 4 | * |
5 | 5 | * This file is part of lsp-runtime-lib |
6 | 6 | * Created on: 30 авг. 2017 г. |
@@ -696,41 +696,78 @@ namespace lsp |
696 | 696 | // LLTL specialization for String class |
697 | 697 | namespace lltl |
698 | 698 | { |
| 699 | + // Non-const specifications |
699 | 700 | template <> |
700 | | - struct hash_spec<LSPString>: public hash_iface |
| 701 | + struct hash_spec<LSPString>: public hash_iface |
| 702 | + { |
| 703 | + static size_t hash_func(const void *ptr, size_t size); |
| 704 | + |
| 705 | + explicit hash_spec() |
701 | 706 | { |
702 | | - static size_t hash_func(const void *ptr, size_t size); |
| 707 | + hash = hash_func; |
| 708 | + } |
| 709 | + }; |
| 710 | + |
| 711 | + template <> |
| 712 | + struct compare_spec<LSPString>: public compare_iface |
| 713 | + { |
| 714 | + static ssize_t cmp_func(const void *a, const void *b, size_t size); |
703 | 715 |
|
704 | | - explicit hash_spec() |
705 | | - { |
706 | | - hash = hash_func; |
707 | | - } |
708 | | - }; |
| 716 | + explicit compare_spec() |
| 717 | + { |
| 718 | + compare = cmp_func; |
| 719 | + } |
| 720 | + }; |
709 | 721 |
|
710 | 722 | template <> |
711 | | - struct compare_spec<LSPString>: public compare_iface |
| 723 | + struct allocator_spec<LSPString>: public allocator_iface |
| 724 | + { |
| 725 | + static void *clone_func(const void *src, size_t size); |
| 726 | + static void free_func(void *ptr); |
| 727 | + |
| 728 | + explicit allocator_spec() |
712 | 729 | { |
713 | | - static ssize_t cmp_func(const void *a, const void *b, size_t size); |
| 730 | + clone = clone_func; |
| 731 | + free = free_func; |
| 732 | + } |
| 733 | + }; |
714 | 734 |
|
715 | | - explicit compare_spec() |
716 | | - { |
717 | | - compare = cmp_func; |
718 | | - } |
719 | | - }; |
| 735 | + // Const specifications |
| 736 | + template <> |
| 737 | + struct hash_spec<const LSPString>: public hash_iface |
| 738 | + { |
| 739 | + static size_t hash_func(const void *ptr, size_t size); |
| 740 | + |
| 741 | + explicit hash_spec() |
| 742 | + { |
| 743 | + hash = hash_func; |
| 744 | + } |
| 745 | + }; |
| 746 | + |
| 747 | + template <> |
| 748 | + struct compare_spec<const LSPString>: public compare_iface |
| 749 | + { |
| 750 | + static ssize_t cmp_func(const void *a, const void *b, size_t size); |
| 751 | + |
| 752 | + explicit compare_spec() |
| 753 | + { |
| 754 | + compare = cmp_func; |
| 755 | + } |
| 756 | + }; |
720 | 757 |
|
721 | 758 | template <> |
722 | | - struct allocator_spec<LSPString>: public allocator_iface |
| 759 | + struct allocator_spec<const LSPString>: public allocator_iface |
| 760 | + { |
| 761 | + static void *clone_func(const void *src, size_t size); |
| 762 | + static void free_func(void *ptr); |
| 763 | + |
| 764 | + explicit allocator_spec() |
723 | 765 | { |
724 | | - static void *clone_func(const void *src, size_t size); |
725 | | - static void free_func(void *ptr); |
726 | | - |
727 | | - explicit allocator_spec() |
728 | | - { |
729 | | - clone = clone_func; |
730 | | - free = free_func; |
731 | | - } |
732 | | - }; |
733 | | - } |
| 766 | + clone = clone_func; |
| 767 | + free = free_func; |
| 768 | + } |
| 769 | + }; |
| 770 | + } /* namespace lltl */ |
734 | 771 |
|
735 | 772 | } /* namespace lsp */ |
736 | 773 |
|
|
0 commit comments