libzypp 17.38.6
language.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8----------------------------------------------------------------------/
9*
10* This file contains private API, this might break at any time between releases.
11* You have been warned!
12*
13*/
14#ifndef ZYPP_NG_SAT_NAMESPACES_LANGUAGE_H_INCLUDED
15#define ZYPP_NG_SAT_NAMESPACES_LANGUAGE_H_INCLUDED
16
19#include <zypp/ng/locale.h>
20#include <zypp/ng/idstring.h>
21
22#include <memory>
23
25
31 public:
32
34 bool isSatisfied( detail::IdType value ) const override;
35
39 void initRequestedLocales( const LocaleSet & locales_r );
40
43 { return _requestedLocalesTracker.added(); }
44
47 { return _requestedLocalesTracker.removed(); }
48
51 { return _requestedLocalesTracker.current(); }
52
53 bool isRequestedLocale( const Locale & locale_r ) const
54 { return _requestedLocalesTracker.contains( locale_r ); }
55
57 void setRequestedLocales( const LocaleSet & locales_r );
59 bool addRequestedLocale( const Locale & locale_r );
61 bool eraseRequestedLocale( const Locale & locale_r );
62
64 const LocaleSet & getAvailableLocales() const;
65
66 void onReset( Pool & pool ) override;
67
68 bool isAvailableLocale( const Locale & locale_r ) const
69 {
70 const LocaleSet & avl( getAvailableLocales() );
71 LocaleSet::const_iterator it( avl.find( locale_r ) );
72 return it != avl.end();
73 }
74
76
78 const TrackedLocaleIds & trackedLocaleIds() const;
79
80 private:
81
82 void localeSetDirty( std::initializer_list<std::string_view> reasons ) {
83 _trackedLocaleIdsPtr.reset(); // requested locales changed
84 notifyDirty( PoolInvalidation::Dependency, std::move(reasons) ); // invalidate dependency/namespace related indices
85 }
86
88 mutable std::unique_ptr<TrackedLocaleIds> _trackedLocaleIdsPtr; // mutable because of lazy init
89 mutable std::unique_ptr<LocaleSet> _availableLocalesPtr; // mutable because of lazy init
90
91 };
92
93}
94
95#endif
'Language[_Country]' codes.
Definition Locale.h:51
Abstract base class for logic providing data to a libsolv namespace.
void notifyDirty(PoolInvalidation invalidationLevel, std::initializer_list< std::string_view > reasons)
Notify the attached registry/pool that data has changed.
Orchestrator for a libsolv pool instance.
Definition pool.h:37
void initRequestedLocales(const LocaleSet &locales_r)
Start tracking changes based on this locales_r.
Definition language.cc:28
void setRequestedLocales(const LocaleSet &locales_r)
User change (tracked).
Definition language.cc:37
bool isSatisfied(detail::IdType value) const override
Check if a specific value satisfies this namespace condition.
Definition language.cc:22
const LocaleSet & getRequestedLocales() const
Current set of requested Locales.
Definition language.h:50
std::unique_ptr< LocaleSet > _availableLocalesPtr
Definition language.h:89
base::SetTracker< LocaleSet > _requestedLocalesTracker
Definition language.h:87
void localeSetDirty(std::initializer_list< std::string_view > reasons)
Definition language.h:82
bool addRequestedLocale(const Locale &locale_r)
User change (tracked).
Definition language.cc:46
const LocaleSet & getAddedRequestedLocales() const
Added since last initRequestedLocales.
Definition language.h:42
const LocaleSet & getRemovedRequestedLocales() const
Removed since last initRequestedLocales.
Definition language.h:46
std::unique_ptr< TrackedLocaleIds > _trackedLocaleIdsPtr
Definition language.h:88
const LocaleSet & getAvailableLocales() const
All Locales occurring in any repo.
Definition language.cc:142
bool isAvailableLocale(const Locale &locale_r) const
Definition language.h:68
const TrackedLocaleIds & trackedLocaleIds() const
Expanded _requestedLocalesTracker for solver.
Definition language.cc:68
bool eraseRequestedLocale(const Locale &locale_r)
User change (tracked).
Definition language.cc:57
bool isRequestedLocale(const Locale &locale_r) const
Definition language.h:53
base::SetTracker< IdStringSet > TrackedLocaleIds
Definition language.h:75
std::unordered_set< Locale > LocaleSet
Definition Locale.h:29
zypp::sat::detail::IdType IdType
@ Dependency
Only external requirements/context changed (e.g., Locales).
Track added/removed set items based on an initial set.
Definition SetTracker.h:39