monotone

monotone Mtn Source Tree

Root/inodeprint.hh

1#ifndef __INODEPRINT_HH__
2#define __INODEPRINT_HH__
3
4// Copyright (C) 2005 Nathaniel Smith <njs@pobox.com>
5//
6// This program is made available under the GNU GPL version 2.0 or
7// greater. See the accompanying file COPYING for details.
8//
9// This program is distributed WITHOUT ANY WARRANTY; without even the
10// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11// PURPOSE.
12
13#include "vocab.hh"
14#include "quick_alloc.hh"
15#include "paths.hh"
16#include "platform.hh"
17
18typedef std::pair<file_path const, hexenc<inodeprint> > inodeprint_entry;
19
20typedef std::map<file_path, hexenc<inodeprint>,
21 std::less<file_path>,
22 QA(inodeprint_entry) > inodeprint_map;
23
24std::ostream & operator<<(std::ostream & out, inodeprint_entry const & e);
25
26class app_state;
27
28void read_inodeprint_map(data const & dat,
29 inodeprint_map & ipm);
30
31void write_inodeprint_map(inodeprint_map const & ipm,
32 data & dat);
33
34bool inodeprint_file(file_path const & file, hexenc<inodeprint> & ip);
35
36inline bool
37inodeprint_unchanged(inodeprint_map const & ipm, file_path const & path)
38{
39 inodeprint_map::const_iterator old_ip = ipm.find(path);
40 if (old_ip != ipm.end())
41 {
42 hexenc<inodeprint> ip;
43 if (inodeprint_file(path, ip) && ip == old_ip->second)
44 return true; // unchanged
45 else
46 return false; // changed or unavailable
47 }
48 else
49 return false; // unavailable
50}
51
52
53// Local Variables:
54// mode: C++
55// fill-column: 76
56// c-file-style: "gnu"
57// indent-tabs-mode: nil
58// End:
59// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
60
61#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status