1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/RepoStatus.h
12 #ifndef ZYPP2_REPOSTATUS_H
13 #define ZYPP2_REPOSTATUS_H
16 #include "zypp/base/PtrTypes.h"
17 #include "zypp/CheckSum.h"
18 #include "zypp/Date.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////
26 // CLASS NAME : RepoStatus
29 * \short Local facts about a repository
30 * This class represents the status of a
31 * repository on the system.
33 * Anything that is not provided on the metadata
34 * files, like the timestamp of the downloaded
35 * metadata, and its checksum.
39 friend std::ostream & operator<<( std::ostream & str, const RepoStatus & obj );
44 * reads the status from a file which contains the
45 * checksum and timestamp in each line.
47 * \throws Exception If the file is not valid or accessible
49 static RepoStatus fromCookieFile( const Pathname &path );
52 * Checksum of the repository.
53 * Usually the checksum of the index, but any
54 * checksum that changes when the repository changes
55 * in any way is sufficient.
57 std::string checksum() const;
60 * timestamp of the repository. If the repository
61 * changes, it has to be updated as well with the
64 Date timestamp() const;
67 * \short Is the status empty?
69 * An empty status means that the status
75 * set the repository checksum \see checksum
78 RepoStatus & setChecksum( const std::string &checksum );
81 * set the repository timestamp \see timestamp
84 RepoStatus & setTimestamp( const Date ×tamp );
94 * \short Status from a single file
95 * As most repository state is represented
96 * by the status of the index file, you can
97 * construct the status from a file.
99 * \note construct from a non existing
100 * file will result in an empty status
102 RepoStatus( const Pathname &file );
110 /** Pointer to implementation */
111 RWCOW_pointer<Impl> _pimpl;
113 ///////////////////////////////////////////////////////////////////
115 /** \relates RepoStatus Stream output */
116 std::ostream & operator<<( std::ostream & str, const RepoStatus & obj );
119 * combines 2 repostatus with a checksum based on both
120 * checksums and the newest timestamp
122 RepoStatus operator&&( const RepoStatus &lhs, const RepoStatus &rhs );
124 /////////////////////////////////////////////////////////////////
126 ///////////////////////////////////////////////////////////////////
127 #endif // ZYPP2_REPOSTATUS_H