monotone

monotone Mtn Source Tree

Root/src/asciik.hh

1// Copyright (C) 2007 Lapo Luchini <lapo@lapo.it>
2//
3// This program is made available under the GNU GPL version 2.0 or
4// greater. See the accompanying file COPYING for details.
5//
6// This program is distributed WITHOUT ANY WARRANTY; without even the
7// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8// PURPOSE.
9
10#ifndef __ASCIIK_HH__
11#define __ASCIIK_HH__
12
13#include <set>
14#include "vector.hh"
15#include "vocab.hh"
16
17class asciik
18{
19public:
20 asciik(std::ostream & os, size_t min_width = 0);
21 // Prints an ASCII-k chunk using the given revisions.
22 // Multiple lines are supported in annotation (the graph will stretch
23 // accordingly); empty newlines at the end will be removed.
24 void print(revision_id const & rev,
25 std::set<revision_id> const & parents,
26 std::string const & annotation);
27 //TODO: change set-of-parents to vector-of-successors
28private:
29 void links_cross(std::set<std::pair<size_t, size_t> > const & links,
30 std::set<size_t> & crosses) const;
31 void draw(size_t const curr_items,
32 size_t const next_items,
33 size_t const curr_loc,
34 std::set<std::pair<size_t, size_t> > const & links,
35 std::set<size_t> const & curr_ghosts,
36 std::string const & annotation) const;
37 bool try_draw(std::vector<revision_id> const & next_row,
38 size_t const curr_loc,
39 std::set<revision_id> const & parents,
40 std::string const & annotation) const;
41 // internal state
42 size_t width;
43 std::ostream & output;
44 std::vector<revision_id> curr_row;
45};
46
47#endif
48
49// Local Variables:
50// mode: C++
51// fill-column: 76
52// c-file-style: "gnu"
53// indent-tabs-mode: nil
54// End:
55// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:

Archive Download this file

Branches

Tags

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