monotone

monotone Mtn Source Tree

Root/app_state.hh

1#ifndef __APP_STATE_HH__
2#define __APP_STATE_HH__
3
4// copyright (C) 2002, 2003 graydon hoare <graydon@pobox.com>
5// all rights reserved.
6// licensed to the public under the terms of the GNU GPL (>= 2)
7// see the file COPYING for details
8
9class app_state;
10class lua_hooks;
11
12#include <vector>
13
14#include "database.hh"
15#include "lua.hh"
16#include "work.hh"
17#include "vocab.hh"
18
19// this class is supposed to hold all (or.. well, most) of the state of the
20// application, barring some unfortunate static objects like the debugging /
21// logging system and the command objects, for the time being. the vague intent
22// being to make life easier for anyone who wants to embed this program as a
23// library someday
24
25class app_state
26{
27public:
28 rsa_keypair_id signing_key;
29 utf8 branch_name;
30 database db;
31 lua_hooks lua;
32 bool stdhooks;
33 bool rcfiles;
34 options_map options;
35 utf8 message;
36 utf8 search_root;
37 std::vector<utf8> revision_selectors;
38 std::vector<utf8> extra_rcfiles;
39 path_set restrictions;
40 file_path relative_directory;
41 bool found_working_copy;
42 long depth;
43
44 void allow_working_copy();
45 void require_working_copy();
46 void create_working_copy(std::string const & dir);
47
48 file_path prefix(utf8 const & path);
49 void set_restriction(path_set const & valid_paths, std::vector<utf8> const & paths);
50 bool restriction_includes(file_path const & path);
51
52 void set_branch(utf8 const & name);
53 void set_database(utf8 const & filename);
54 void set_signing_key(utf8 const & key);
55 void set_root(utf8 const & root);
56 void set_message(utf8 const & message);
57 void set_depth(long depth);
58 void add_revision(utf8 const & selector);
59
60 void set_stdhooks(bool b);
61 void set_rcfiles(bool b);
62 void add_rcfile(utf8 const & filename);
63
64 explicit app_state();
65 ~app_state();
66
67private:
68 void load_rcfiles();
69 void read_options();
70 void write_options();
71};
72
73#endif // __APP_STATE_HH__

Archive Download this file

Branches

Tags

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