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