Aegis  4.25.D505
libaegis/patch/context.h
Go to the documentation of this file.
00001 //
00002 //      aegis - project change supervisor
00003 //      Copyright (C) 2001, 2002, 2004-2006, 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 LIBAEGIS_PATCH_CONTEXT_H
00021 #define LIBAEGIS_PATCH_CONTEXT_H
00022 
00023 #include <common/str_list.h>
00024 #include <libaegis/input.h>
00025 
00030 class patch_context_ty
00031 {
00032 public:
00036     ~patch_context_ty();
00037 
00044     patch_context_ty(input &arg);
00045 
00054     string_ty *getline(int n);
00055 
00062     void discard(int n);
00063 
00068     nstring get_file_name() { return in->name(); }
00069 
00070 private:
00075     input in;
00076 
00081     string_list_ty buffer;
00082 
00086     patch_context_ty();
00087 
00091     patch_context_ty(const patch_context_ty&);
00092 
00096     patch_context_ty &operator=(const patch_context_ty&);
00097 };
00098 
00099 inline patch_context_ty *
00100 patch_context_new(input &ip)
00101 {
00102     return new patch_context_ty(ip);
00103 }
00104 
00105 inline void
00106 patch_context_delete(patch_context_ty *pcp)
00107 {
00108     delete pcp;
00109 }
00110 
00111 inline string_ty *
00112 patch_context_getline(patch_context_ty *pcp, int n)
00113 {
00114     return pcp->getline(n);
00115 }
00116 
00117 inline void
00118 patch_context_discard(patch_context_ty *pcp, int n)
00119 {
00120     pcp->discard(n);
00121 }
00122 
00123 #endif // LIBAEGIS_PATCH_CONTEXT_H