00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef PROJECT_H
00022 #define PROJECT_H
00023
00024 #include <common/ac/time.h>
00025
00026 #include <libaegis/pattr.h>
00027 #include <libaegis/pstate.h>
00028 #include <libaegis/view_path.h>
00029 #include <libaegis/change.h>
00030
00031 class string_list_ty;
00032 class sub_context_ty;
00033 class fstate_src_ty;
00034 class itab_ty;
00035
00048 class project_ty
00049 {
00050 public:
00061 ~project_ty();
00062
00069 project_ty(string_ty *name);
00070
00071
00072
00073
00074
00075
00093 nstring attribute_get(const nstring &name);
00094
00113 bool attribute_get_boolean(const nstring &name);
00114
00122 string_ty *baseline_path_get(bool resolve = false);
00123
00131 project_ty *bind_branch(change::pointer bp);
00132
00141 void bind_existing();
00142
00150 bool bind_existing_errok();
00151
00159 void bind_keep(const nstring &path);
00160
00166 void bind_new();
00167
00176 change::pointer change_get();
00177
00187 change::pointer change_get_raw() { return pcp; }
00188
00198 string_ty *change_path_get(long change_number);
00199
00200 void
00201 change_reset()
00202 {
00203 change::pointer tmp = pcp;
00204 pcp = 0;
00205 change_free(tmp);
00206 }
00207
00215 string_ty *changes_path_get();
00216
00217 public:
00222 void convert_to_new_format();
00223
00224 public:
00234 void copy_the_owner(project_ty *pp);
00235
00249 void copyright_years_slurp(int *a, int amax, int *alen_p);
00250
00264 fstate_src_ty *file_find_by_uuid(string_ty *uuid, view_path_ty vp);
00265
00282 fstate_src_ty *file_find_fuzzy(string_ty *filename,
00283 view_path_ty as_view_path);
00284
00285 private:
00296 struct string_list_ty *file_list_get(view_path_ty as_view_path);
00297
00298 public:
00303 void file_list_invalidate();
00304
00313 fstate_src_ty *file_new(string_ty *file_name);
00314
00325 fstate_src_ty *file_new(fstate_src_ty *meta);
00326
00338 fstate_src_ty *file_nth(size_t n, view_path_ty as_view_path);
00339
00349 project_ty *find_branch(const char *number);
00350
00351 private:
00356 void get_the_owner();
00357
00358 public:
00363 user_ty::pointer get_user() const;
00364
00369 int gid_get();
00370
00384 time_t change_completion_timestamp(long change_number);
00385
00395 string_ty *history_path_get();
00396
00412 string_ty *home_path_get();
00413
00427 void home_path_set(string_ty *dir);
00428 void home_path_set(const nstring &dir);
00429
00440 string_ty *info_path_get();
00441
00450 bool is_a_trunk() const { return (parent == 0); }
00451
00460 void list_inner(string_list_ty &result);
00461
00467 void lock_prepare_everything();
00468
00469 private:
00478 void lock_sync();
00479
00480 public:
00488 string_ty *name_get() const;
00489
00497 long parent_branch_number_get() const { return parent_bn; }
00498
00506 project_ty *parent_get() { return (parent ? parent : this); }
00507
00517 pstate_ty *pstate_get();
00518
00524 void pstate_lock_prepare();
00525
00536 string_ty *pstate_path_get();
00537
00542 void pstate_write();
00543
00548 project_ty *trunk_get();
00549
00554 int uid_get();
00555
00560 int umask_get();
00561
00562 public:
00563 long reference_count;
00564
00565 private:
00570 string_ty *name;
00571
00582 string_ty *home_path;
00583
00591 string_ty *baseline_path_unresolved;
00592
00600 string_ty *baseline_path;
00601
00608 itab_ty *change2time_stp;
00609
00616 string_ty *history_path;
00617
00624 string_ty *info_path;
00625
00632 string_ty *pstate_path;
00633
00640 string_ty *changes_path;
00641
00648 pstate_ty *pstate_data;
00649
00654 bool is_a_new_file;
00655
00663 long lock_magic;
00664
00674 change::pointer pcp;
00675
00680 int uid;
00681
00686 int gid;
00687
00693 project_ty *parent;
00694
00700 long parent_bn;
00701
00708 struct string_list_ty *file_list[view_path_MAX];
00709
00719 struct symtab_ty *file_by_uuid[view_path_MAX];
00720
00721
00722
00723
00724
00725
00726
00727
00728 private:
00733 user_ty::pointer up;
00734
00741 bool off_limits;
00742
00750 project_ty();
00751
00758 project_ty(const project_ty &);
00759
00766 project_ty &operator=(const project_ty &);
00767 };
00768
00769 project_ty *project_alloc(string_ty *name);
00770
00771 inline DEPRECATED void
00772 project_bind_existing(project_ty *pp)
00773 {
00774 pp->bind_existing();
00775 }
00776
00777 inline DEPRECATED bool
00778 project_bind_existing_errok(project_ty *pp)
00779 {
00780 return pp->bind_existing_errok();
00781 }
00782
00783 inline DEPRECATED project_ty *
00784 project_bind_branch(project_ty *ppp, change::pointer bp)
00785 {
00786 return ppp->bind_branch(bp);
00787 }
00788
00789 inline DEPRECATED void
00790 project_bind_new(project_ty *pp)
00791 {
00792 pp->bind_new();
00793 }
00794
00795 void project_list_get(struct string_list_ty *);
00796
00797 inline DEPRECATED void
00798 project_list_inner(struct string_list_ty *result, project_ty *pp)
00799 {
00800 pp->list_inner(*result);
00801 }
00802
00803 inline DEPRECATED project_ty *
00804 project_find_branch(project_ty *pp, const char *number)
00805 {
00806 return pp->find_branch(number);
00807 }
00808
00809 void project_free(project_ty *);
00810
00811 inline string_ty *
00812 project_name_get(project_ty *pp)
00813 {
00814 return pp->name_get();
00815 }
00816
00817 project_ty *project_copy(project_ty *);
00818
00819 inline DEPRECATED change::pointer
00820 project_change_get(project_ty *pp)
00821 {
00822 return pp->change_get();
00823 }
00824
00825 inline DEPRECATED string_ty *
00826 project_home_path_get(project_ty *pp)
00827 {
00828 return pp->home_path_get();
00829 }
00830
00831 string_ty *project_Home_path_get(project_ty *);
00832 string_ty *project_top_path_get(project_ty *, int);
00833
00845 nstring project_rss_path_get(project_ty *pp, bool resolve = false);
00846
00847 inline DEPRECATED void
00848 project_home_path_set(project_ty *pp, string_ty *dir)
00849 {
00850 pp->home_path_set(dir);
00851 }
00852
00853 inline DEPRECATED string_ty *
00854 project_baseline_path_get(project_ty *pp, bool resolve = false)
00855 {
00856 return pp->baseline_path_get(resolve);
00857 }
00858
00859 inline DEPRECATED string_ty *
00860 project_history_path_get(project_ty *pp)
00861 {
00862 return pp->history_path_get();
00863 }
00864
00873 string_ty *project_history_filename_get(project_ty *, struct fstate_src_ty *);
00874
00875 inline DEPRECATED string_ty *
00876 project_info_path_get(project_ty *pp)
00877 {
00878 return pp->info_path_get();
00879 }
00880
00881 inline DEPRECATED string_ty *
00882 project_changes_path_get(project_ty *pp)
00883 {
00884 return pp->changes_path_get();
00885 }
00886
00887 DEPRECATED
00888 string_ty *project_change_path_get(project_ty *, long);
00889
00890 inline DEPRECATED string_ty *
00891 project_pstate_path_get(project_ty *pp)
00892 {
00893 return pp->pstate_path_get();
00894 }
00895
00896 inline DEPRECATED pstate_ty *
00897 project_pstate_get(project_ty *pp)
00898 {
00899 return pp->pstate_get();
00900 }
00901
00902 inline DEPRECATED void
00903 project_pstate_write(project_ty *pp)
00904 {
00905 pp->pstate_write();
00906 }
00907
00908 void project_pstate_write_top(project_ty *);
00909
00910 inline DEPRECATED void
00911 project_pstate_lock_prepare(project_ty *pp)
00912 {
00913 pp->pstate_lock_prepare();
00914 }
00915
00916 void project_pstate_lock_prepare_top(project_ty *);
00917 void project_baseline_read_lock_prepare(project_ty *);
00918 void project_baseline_write_lock_prepare(project_ty *);
00919 void project_history_lock_prepare(project_ty *);
00920 void project_error(project_ty *, struct sub_context_ty *, const char *);
00921 void project_fatal(project_ty *, struct sub_context_ty *, const char *)
00922 NORETURN;
00923 void project_verbose(project_ty *, struct sub_context_ty *, const char *);
00924 void project_change_append(project_ty *, long, int);
00925 void project_change_delete(project_ty *, long);
00926 int project_change_number_in_use(project_ty *, long);
00927 string_ty *project_version_short_get(project_ty *);
00928 string_ty *project_version_get(project_ty *);
00929
00930 inline DEPRECATED int
00931 project_uid_get(project_ty *pp)
00932 {
00933 return pp->uid_get();
00934 }
00935
00936 inline DEPRECATED int
00937 project_gid_get(project_ty *pp)
00938 {
00939 return pp->gid_get();
00940 }
00941
00942 user_ty::pointer project_user(project_ty *);
00943 void project_become(project_ty *);
00944 void project_become_undo(project_ty *pp);
00945 long project_next_test_number_get(project_ty *);
00946 int project_is_readable(project_ty *);
00947 long project_minimum_change_number_get(project_ty *);
00948 void project_minimum_change_number_set(project_ty *, long);
00949 bool project_reuse_change_numbers_get(project_ty *);
00950 void project_reuse_change_numbers_set(project_ty *, bool);
00951 long project_minimum_branch_number_get(project_ty *);
00952 void project_minimum_branch_number_set(project_ty *, long);
00953 bool project_skip_unlucky_get(project_ty *);
00954 void project_skip_unlucky_set(project_ty *, bool);
00955 bool project_compress_database_get(project_ty *);
00956 void project_compress_database_set(project_ty *, bool);
00957 int project_develop_end_action_get(project_ty *);
00958 void project_develop_end_action_set(project_ty *, int);
00959 bool project_protect_development_directory_get(project_ty *);
00960 void project_protect_development_directory_set(project_ty *, bool);
00961
00962 int break_up_version_string(const char *, long *, int, int *, int);
00963 void extract_version_from_project_name(string_ty **, long *, int, int *);
00964 int project_name_ok(string_ty *);
00965
00966 pconf_ty *project_pconf_get(project_ty *);
00967
00989 project_ty *project_new_branch(project_ty *pp, user_ty::pointer up,
00990 long change_number, string_ty *topdir = 0, string_ty *reason = 0);
00991
00992 inline DEPRECATED void
00993 project_file_list_invalidate(project_ty *pp)
00994 {
00995 pp->file_list_invalidate();
00996 }
00997
00998 string_ty *project_brief_description_get(project_ty *);
00999
01012 change::pointer project_uuid_find(project_ty *pp, string_ty *uuid);
01013
01014
01019 class project
01020 {
01021 public:
01026 ~project();
01027
01031 project(const project &arg);
01032
01036 project &operator=(const project &arg);
01037
01044 project(string_ty *name);
01045
01052 project(const nstring &name);
01053
01058 project_ty *operator->() const { return ref; }
01059
01060 private:
01066 project_ty *ref;
01067
01072 project();
01073 };
01074
01075 #endif // PROJECT_H