Aegis  4.25.D505
libaegis/aer/stmt.h
Go to the documentation of this file.
00001 //
00002 //      aegis - project change supervisor
00003 //      Copyright (C) 1994, 1996, 2002-2008 Peter Miller
00004 //
00005 //      This program is free software; you can redistribute it and/or modify
00006 //      it under the terms of the GNU General Public License as published by
00007 //      the Free Software Foundation; either version 3 of the License, or
00008 //      (at your option) any later version.
00009 //
00010 //      This program is distributed in the hope that it will be useful,
00011 //      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //      GNU General Public License for more details.
00014 //
00015 //      You should have received a copy of the GNU General Public License
00016 //      along with this program. If not, see
00017 //      <http://www.gnu.org/licenses/>.
00018 //
00019 
00020 #ifndef AEGIS_AER_STMT_H
00021 #define AEGIS_AER_STMT_H
00022 
00023 #include <common/ac/shared_ptr.h>
00024 #include <common/ac/stddef.h>
00025 
00026 #include <libaegis/aer/value.h>
00027 
00028 enum rpt_stmt_status_ty
00029 {
00030     rpt_stmt_status_normal,
00031     rpt_stmt_status_break,
00032     rpt_stmt_status_continue,
00033     rpt_stmt_status_return,
00034     rpt_stmt_status_error
00035 };
00036 
00037 struct rpt_stmt_result_ty
00038 {
00039     rpt_stmt_status_ty status;
00040     rpt_value::pointer thrown;
00041 };
00042 
00043 
00048 class rpt_stmt
00049 {
00050 public:
00051     typedef aegis_shared_ptr<rpt_stmt> pointer;
00052 
00056     virtual ~rpt_stmt();
00057 
00058 protected:
00062     rpt_stmt();
00063 
00064 public:
00068     virtual void run(rpt_stmt_result_ty *) const = 0;
00069 
00074     void append(const pointer &child);
00075 
00080     void prepend(const pointer &child);
00081 
00086     size_t get_nchildren() const { return nchild; }
00087 
00088 protected:
00098     pointer nth_child(size_t n) const;
00099 
00100 private:
00106     pointer *child;
00107 
00112     size_t nchild;
00113 
00119     size_t nchild_max;
00120 
00124     rpt_stmt(const rpt_stmt &);
00125 
00129     rpt_stmt &operator=(const rpt_stmt &);
00130 };
00131 
00132 #endif // AEGIS_AER_STMT_H