Update ooo320-m1
[ooovba.git] / autodoc / source / parser / inc / semantic / sub_peu.hxx
blobcbf516940e3be97b38aab22b77ebf82ba2ddf8dd
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sub_peu.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef ADC_CPP_SUB_PEU_HXX
32 #define ADC_CPP_SUB_PEU_HXX
36 // USED SERVICES
37 // BASE CLASSES
38 #include <semantic/parseenv.hxx>
39 #include <tokens/tokproct.hxx>
40 // COMPONENTS
41 // PARAMETERS
42 #include <semantic/sub_pe.hxx>
46 template <class PE, class SUB>
47 class SubPeUse : public SubPeUseIfc,
48 private TokenProcessing_Types
50 public:
51 typedef void (PE::*F_INIT)();
52 typedef void (PE::*F_RETURN)();
54 SubPeUse(
55 SubPe<PE,SUB> & i_rSubPeCreator,
56 F_INIT i_fInit,
57 F_RETURN i_fReturn );
58 ~SubPeUse();
60 void Push(
61 E_TokenDone i_eDone );
62 virtual void InitParse() const;
63 virtual void GetResults() const;
65 PE & Parent() const;
66 SUB & Child() const;
68 private:
69 // DATA
70 SubPe<PE,SUB> & rSubPeCreator;
71 F_INIT fInit;
72 F_RETURN fReturn;
76 // IMPLEMENTATION
79 template <class PE, class SUB>
80 SubPeUse<PE,SUB>::SubPeUse( SubPe<PE,SUB> & i_rSubPeCreator,
81 F_INIT i_fInit,
82 F_RETURN i_fReturn )
83 : rSubPeCreator(i_rSubPeCreator),
84 fInit(i_fInit),
85 fReturn(i_fReturn)
89 template <class PE, class SUB>
90 SubPeUse<PE,SUB>::~SubPeUse()
94 template <class PE, class SUB>
95 void
96 SubPeUse<PE,SUB>::Push( E_TokenDone i_eDone )
98 Parent().SetTokenResult( i_eDone, push, &rSubPeCreator.Get() );
99 Parent().SetCurSPU(this);
102 template <class PE, class SUB>
103 void
104 SubPeUse<PE,SUB>::InitParse() const
106 if (fInit != 0)
107 (Parent().*fInit)();
110 template <class PE, class SUB>
111 void
112 SubPeUse<PE,SUB>::GetResults() const
114 if (fReturn != 0)
115 (Parent().*fReturn)();
118 template <class PE, class SUB>
119 inline PE &
120 SubPeUse<PE,SUB>::Parent() const
122 return rSubPeCreator.Parent();
125 template <class PE, class SUB>
126 inline SUB &
127 SubPeUse<PE,SUB>::Child() const
129 return rSubPeCreator.Child();
133 #endif