mrp-project.h 7.99 KB
Newer Older
Richard Hult's avatar
Richard Hult committed
1 2
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
Richard Hult's avatar
Richard Hult committed
3
 * Copyright (C) 2004 Imendio AB
Richard Hult's avatar
Richard Hult committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 * Copyright (C) 2001-2002 CodeFactory AB
 * Copyright (C) 2001-2002 Richard Hult <richard@imendio.com>
 * Copyright (C) 2001-2002 Mikael Hallendal <micke@imendio.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this library; if not, write to the
Josué Abarca's avatar
Josué Abarca committed
20 21
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
Richard Hult's avatar
Richard Hult committed
22 23 24 25 26 27 28 29 30
 */

#ifndef __MRP_PROJECT_H__
#define __MRP_PROJECT_H__

#include <glib-object.h>
#include <libplanner/mrp-application.h>
#include <libplanner/mrp-error.h>
#include <libplanner/mrp-group.h>
31
#include <libplanner/mrp-object.h>
Richard Hult's avatar
Richard Hult committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56

#define MRP_TYPE_PROJECT         (mrp_project_get_type ())
#define MRP_PROJECT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), MRP_TYPE_PROJECT, MrpProject))
#define MRP_PROJECT_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), MRP_TYPE_PROJECT, MrpProjectClass))
#define MRP_IS_PROJECT(o)	 (G_TYPE_CHECK_INSTANCE_TYPE ((o), MRP_TYPE_PROJECT))
#define MRP_IS_PROJECT_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), MRP_TYPE_PROJECT))
#define MRP_PROJECT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MRP_TYPE_PROJECT, MrpProjectClass))

typedef struct _MrpProject     MrpProject;
typedef struct _MrpProjectPriv MrpProjectPriv;

#include <libplanner/mrp-resource.h>
#include <libplanner/mrp-calendar.h>

typedef gboolean (*MrpTaskTraverseFunc) (MrpTask*, gpointer);

struct _MrpProject {
	MrpObject       parent;
	MrpProjectPriv *priv;
};

typedef struct {
	MrpObjectClass  parent_class;
} MrpProjectClass;

57
GType            mrp_project_get_type                 (void) G_GNUC_CONST;
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
MrpProject      *mrp_project_new                      (MrpApplication       *app);
gboolean         mrp_project_is_empty                 (MrpProject           *project);
gboolean         mrp_project_needs_saving             (MrpProject           *project);
mrptime          mrp_project_get_project_start        (MrpProject           *project);
void             mrp_project_set_project_start        (MrpProject           *project,
						       mrptime               start);
gboolean         mrp_project_load                     (MrpProject           *project,
						       const gchar          *uri,
						       GError              **error);
gboolean         mrp_project_save                     (MrpProject           *project,
						       gboolean              force,
						       GError              **error);
gboolean         mrp_project_save_as                  (MrpProject           *project,
						       const gchar          *uri,
						       gboolean              force,
						       GError              **error);
gboolean         mrp_project_export                   (MrpProject           *project,
						       const gchar          *uri,
						       const gchar          *identifier,
						       gboolean              force,
						       GError              **error);
gboolean         mrp_project_save_to_xml              (MrpProject           *project,
						       gchar               **str,
						       GError              **error);
gboolean         mrp_project_load_from_xml            (MrpProject           *project,
						       const gchar          *str,
						       GError              **error);
void             mrp_project_close                    (MrpProject           *project);
const gchar     *mrp_project_get_uri                  (MrpProject           *project);
87 88
void             mrp_project_set_uri                  (MrpProject           *project,
						       const gchar          *uri);
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
MrpResource *    mrp_project_get_resource_by_name     (MrpProject           *project,
						       const gchar          *name);
GList           *mrp_project_get_resources            (MrpProject           *project);
void             mrp_project_add_resource             (MrpProject           *project,
						       MrpResource          *resource);
void             mrp_project_remove_resource          (MrpProject           *project,
						       MrpResource          *resource);
MrpGroup        *mrp_project_get_group_by_name        (MrpProject           *project,
						       const gchar          *name);
GList           *mrp_project_get_groups               (MrpProject           *project);
void             mrp_project_add_group                (MrpProject           *project,
						       MrpGroup             *group);
void             mrp_project_remove_group             (MrpProject           *project,
						       MrpGroup             *group);
MrpTask         *mrp_project_get_task_by_name         (MrpProject           *project,
						       const gchar          *name);
GList           *mrp_project_get_all_tasks            (MrpProject           *project);
void             mrp_project_insert_task              (MrpProject           *project,
						       MrpTask              *parent,
						       gint                  position,
						       MrpTask              *task);
void             mrp_project_remove_task              (MrpProject           *project,
						       MrpTask              *task);
gboolean         mrp_project_move_task                (MrpProject           *project,
						       MrpTask              *task,
						       MrpTask              *sibling,
						       MrpTask              *parent,
						       gboolean              before,
						       GError              **error);
MrpTask         *mrp_project_get_root_task            (MrpProject           *project);
void             mrp_project_task_traverse            (MrpProject           *project,
						       MrpTask              *root,
						       MrpTaskTraverseFunc   func,
						       gpointer              user_data);
void             mrp_project_reschedule               (MrpProject           *project);
124 125 126 127
gint             mrp_project_calculate_summary_duration (MrpProject           *project,
						       MrpTask              *task,
						       mrptime               start,
						       mrptime               finish);
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
gint             mrp_project_calculate_task_work      (MrpProject           *project,
						       MrpTask              *task,
						       mrptime               start,
						       mrptime               finish);
GList *          mrp_project_get_properties_from_type (MrpProject           *project,
						       GType                 object_type);
void             mrp_project_add_property             (MrpProject           *project,
						       GType                 object_type,
						       MrpProperty          *property,
						       gboolean              user_defined);
void             mrp_project_remove_property          (MrpProject           *project,
						       GType                 object_type,
						       const gchar          *name);
gboolean         mrp_project_has_property             (MrpProject           *project,
						       GType                 owner_type,
						       const gchar          *name);
MrpProperty *    mrp_project_get_property             (MrpProject           *project,
						       const gchar          *name,
						       GType                 object_type);
MrpCalendar *    mrp_project_get_root_calendar        (MrpProject           *project);
MrpCalendar *    mrp_project_get_calendar             (MrpProject           *project);
MrpDay *         mrp_project_get_calendar_day_by_id   (MrpProject           *project,
						       gint                  id);
151 152 153
void             mrp_project_set_block_scheduling     (MrpProject           *project,
						       gboolean              block);
gboolean         mrp_project_get_block_scheduling     (MrpProject           *project);
Richard Hult's avatar
Richard Hult committed
154 155 156


#endif /* __MRP_PROJECT_H__ */