xref: /aoo42x/main/autodoc/source/inc/adc_cl.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef ADC_ADC_CL_HXX
29*cdf0e10cSrcweir #define ADC_ADC_CL_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir // USED SERVICES
34*cdf0e10cSrcweir 	// BASE CLASSES
35*cdf0e10cSrcweir #include <cosv/comdline.hxx>
36*cdf0e10cSrcweir 	// COMPONENTS
37*cdf0e10cSrcweir 	// PARAMETERS
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir namespace ary
40*cdf0e10cSrcweir {
41*cdf0e10cSrcweir     class Repository;
42*cdf0e10cSrcweir }
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir namespace autodoc
45*cdf0e10cSrcweir {
46*cdf0e10cSrcweir namespace command
47*cdf0e10cSrcweir {
48*cdf0e10cSrcweir     class Command;
49*cdf0e10cSrcweir     class CreateHtml;
50*cdf0e10cSrcweir     class SinceTagTransformationData;
51*cdf0e10cSrcweir }
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir /** Reads and runs an Autodoc command line.
55*cdf0e10cSrcweir */
56*cdf0e10cSrcweir class CommandLine : public csv::CommandLine_Ifc
57*cdf0e10cSrcweir {
58*cdf0e10cSrcweir   public:
59*cdf0e10cSrcweir     // LIFECYCLE
60*cdf0e10cSrcweir 						CommandLine();
61*cdf0e10cSrcweir 						~CommandLine();
62*cdf0e10cSrcweir     // OPERATIONS
63*cdf0e10cSrcweir     int                 Run() const;
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir     // INQUIRY
66*cdf0e10cSrcweir         // debugging
67*cdf0e10cSrcweir     bool                DebugStyle_ShowText() const;
68*cdf0e10cSrcweir     bool                DebugStyle_ShowStoredObjects() const;
69*cdf0e10cSrcweir     bool                DebugStyle_ShowTokens() const;
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir         // @since tags
72*cdf0e10cSrcweir     bool                DoesTransform_SinceTag() const;
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir //    /// @see command::SinceTagTransformationData::StripSinceTagValue()
75*cdf0e10cSrcweir //    bool                Strip_SinceTagText(
76*cdf0e10cSrcweir //                            String &            io_sSinceTagValue ) const;
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir     /// @see command::SinceTagTransformationData::DisplayOf()
79*cdf0e10cSrcweir     const String &      DisplayOf_SinceTagValue(
80*cdf0e10cSrcweir                             const String &      i_sVersionNumber ) const;
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir         // extern IDL links
83*cdf0e10cSrcweir     const String &      ExternRoot() const      { return sExternRoot; }
84*cdf0e10cSrcweir     const String &      ExternNamespace() const { return sExternNamespace; }
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir     bool                CppUsed() const         { return bCpp; }
87*cdf0e10cSrcweir     bool                IdlUsed() const         { return bIdl; }
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir     // ACCESS
90*cdf0e10cSrcweir     static CommandLine &
91*cdf0e10cSrcweir                         Get_();
92*cdf0e10cSrcweir     void                Set_ExternRoot(
93*cdf0e10cSrcweir                             const String &      i_s )
94*cdf0e10cSrcweir                                                 { sExternRoot = i_s; }
95*cdf0e10cSrcweir     void                Set_ExternNamespace(
96*cdf0e10cSrcweir                             const String &      i_s )
97*cdf0e10cSrcweir                                                 { sExternNamespace = i_s; }
98*cdf0e10cSrcweir     ary::Repository &   TheRepository() const   { csv_assert(pReposy != 0);
99*cdf0e10cSrcweir                                                   return *pReposy; }
100*cdf0e10cSrcweir     void                Set_CppUsed()           { bCpp = true; }
101*cdf0e10cSrcweir     void                Set_IdlUsed()           { bIdl = true; }
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir   private:
104*cdf0e10cSrcweir     // Interface cosv::CommandLine_Ifc:
105*cdf0e10cSrcweir     virtual void        do_Init(
106*cdf0e10cSrcweir                             int                 argc,
107*cdf0e10cSrcweir                             char *              argv[] );
108*cdf0e10cSrcweir     virtual void        do_PrintUse() const;
109*cdf0e10cSrcweir     virtual bool        inq_CheckParameters() const;
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir     // Locals
112*cdf0e10cSrcweir     typedef StringVector::const_iterator            opt_iter;
113*cdf0e10cSrcweir     typedef std::vector< DYN command::Command* >    CommandList;
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir     void                load_IncludedCommands(
116*cdf0e10cSrcweir                             StringVector &      out,
117*cdf0e10cSrcweir                             const char *        i_filePath );
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir     void                do_clVerbose(
120*cdf0e10cSrcweir                             opt_iter &          it,
121*cdf0e10cSrcweir                             opt_iter            itEnd );
122*cdf0e10cSrcweir     void                do_clParse(
123*cdf0e10cSrcweir                             opt_iter &          it,
124*cdf0e10cSrcweir                             opt_iter            itEnd );
125*cdf0e10cSrcweir     void                do_clCreateHtml(
126*cdf0e10cSrcweir                             opt_iter &          it,
127*cdf0e10cSrcweir                             opt_iter            itEnd );
128*cdf0e10cSrcweir     void                do_clSinceFile(
129*cdf0e10cSrcweir                             opt_iter &          it,
130*cdf0e10cSrcweir                             opt_iter            itEnd );
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir //    void                do_clCreateXml(
133*cdf0e10cSrcweir //                            opt_iter &          it,
134*cdf0e10cSrcweir //                            opt_iter            itEnd );
135*cdf0e10cSrcweir //    void                do_clLoad(
136*cdf0e10cSrcweir //                            opt_iter &          it,
137*cdf0e10cSrcweir //                            opt_iter            itEnd );
138*cdf0e10cSrcweir //    void                do_clSave(
139*cdf0e10cSrcweir //                            opt_iter &          it,
140*cdf0e10cSrcweir //                            opt_iter            itEnd );
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir     void                sort_Commands();
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir 	// DATA
145*cdf0e10cSrcweir     uintt               nDebugStyle;
146*cdf0e10cSrcweir     Dyn<command::SinceTagTransformationData>
147*cdf0e10cSrcweir                         pSinceTransformator;
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir     CommandList         aCommands;
150*cdf0e10cSrcweir     bool                bInitOk;
151*cdf0e10cSrcweir     command::CreateHtml *
152*cdf0e10cSrcweir                         pCommand_CreateHtml;
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir     String              sExternRoot;
155*cdf0e10cSrcweir     String              sExternNamespace;
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir     mutable Dyn<ary::Repository>
158*cdf0e10cSrcweir                         pReposy;
159*cdf0e10cSrcweir     bool                bCpp;
160*cdf0e10cSrcweir     bool                bIdl;
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir     static CommandLine *
163*cdf0e10cSrcweir                         pTheInstance_;
164*cdf0e10cSrcweir };
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir // IMPLEMENTATION
169*cdf0e10cSrcweir inline bool
170*cdf0e10cSrcweir CommandLine::DebugStyle_ShowText() const
171*cdf0e10cSrcweir     { return (nDebugStyle & 2) != 0; }
172*cdf0e10cSrcweir inline bool
173*cdf0e10cSrcweir CommandLine::DebugStyle_ShowStoredObjects() const
174*cdf0e10cSrcweir     { return (nDebugStyle & 4) != 0; }
175*cdf0e10cSrcweir inline bool
176*cdf0e10cSrcweir CommandLine::DebugStyle_ShowTokens() const
177*cdf0e10cSrcweir     { return (nDebugStyle & 1) != 0; }
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir }   // namespace autodoc
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir inline bool
183*cdf0e10cSrcweir DEBUG_ShowText()
184*cdf0e10cSrcweir     { return autodoc::CommandLine::Get_().DebugStyle_ShowText(); }
185*cdf0e10cSrcweir inline bool
186*cdf0e10cSrcweir DEBUG_ShowStoring()
187*cdf0e10cSrcweir     { return autodoc::CommandLine::Get_().DebugStyle_ShowStoredObjects(); }
188*cdf0e10cSrcweir inline bool
189*cdf0e10cSrcweir DEBUG_ShowTokens()
190*cdf0e10cSrcweir     { return autodoc::CommandLine::Get_().DebugStyle_ShowTokens(); }
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir #endif
193*cdf0e10cSrcweir 
194