1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ZConfig.h
12 #ifndef ZYPP_ZCONFIG_H
13 #define ZYPP_ZCONFIG_H
17 #include "zypp/base/Deprecated.h"
19 #include "zypp/base/NonCopyable.h"
20 #include "zypp/base/PtrTypes.h"
22 #include "zypp/Arch.h"
23 #include "zypp/Locale.h"
24 #include "zypp/Pathname.h"
26 ///////////////////////////////////////////////////////////////////
28 { /////////////////////////////////////////////////////////////////
30 ///////////////////////////////////////////////////////////////////
32 // CLASS NAME : ZConfig
34 /** Interim helper class to collect global options and settings.
35 * Use it to avoid hardcoded values and calls to getZYpp() just
36 * to retrieve some value like architecture, languages or tmppath.
38 * It reads /etc/zypp/zypp.conf, the filename can be overridden by
39 * setting the ZYPP_CONF environment variable to a different file.
43 class ZConfig : private base::NonCopyable
47 static ZConfig & instance();
51 /** The autodetected system architecture. */
52 static Arch defaultSystemArchitecture();
54 /** The system architecture zypp uses. */
55 Arch systemArchitecture() const;
57 /** Override the zypp system architecture.
58 * This is useful for test scenarious. <b>But be warned</b>, zypp does
59 * not expect the system architecture to change at runtime. So
60 * set it at the verry beginning before you acess any other
63 void setSystemArchitecture( const Arch & arch_r );
65 /** Reset the zypp system architecture to the default. */
66 void resetSystemArchitecture()
67 { setSystemArchitecture( defaultSystemArchitecture() ); }
69 /** use setSystemArchitecture */
70 ZYPP_DEPRECATED void overrideSystemArchitecture( const Arch & arch_r )
71 { setSystemArchitecture( arch_r ); }
74 /** The autodetected prefered locale for translated texts.
76 static Locale defaultTextLocale();
78 /** The locale for translated texts zypp uses.
80 Locale textLocale() const;
82 /** Set the prefered locale for translated texts. */
83 void setTextLocale( const Locale & locale_r );
85 /** Reset the locale for translated texts to the default. */
86 void resetTextLocale()
87 { setTextLocale( defaultTextLocale() ); }
91 * Path where the repo metadata is downloaded and kept.
93 Pathname repoMetadataPath() const;
96 * Path where the repo packages are downloaded and kept.
98 Pathname repoPackagesPath() const;
101 * Path where the processed cache is kept
102 * (this is where zypp.db is located.
104 Pathname repoCachePath() const;
107 * Path where the known repositories
108 * .repo files are kept
110 Pathname knownReposPath() const;
113 * Separator string for storing/reading sets of strings to/from
116 const std::string & cacheDBSplitJoinSeparator() const;
119 * Whether repository urls should be probed.
123 bool repo_add_probe() const;
126 * Amount of time in minutes that must pass before another refresh.
128 unsigned repo_refresh_delay() const;
130 /** Whether to consider using a patchrpm when downloading a package.
131 * Config option <tt>download.use_patchrpm (true)</tt>
133 bool download_use_patchrpm() const;
135 /** Whether to consider using a deltarpm when downloading a package.
136 * Config option <tt>download.use_deltarpm (true)</tt>
138 bool download_use_deltarpm() const;
141 * Directory for equivalent vendor definitions
143 Pathname vendorPath() const;
152 /** Pointer to implementation */
153 RW_pointer<Impl, rw_pointer::Scoped<Impl> > _pimpl;
155 ///////////////////////////////////////////////////////////////////
157 /////////////////////////////////////////////////////////////////
159 ///////////////////////////////////////////////////////////////////
160 #endif // ZYPP_ZCONFIG_H