xref: /aoo42x/main/autodoc/source/inc/adc_cl.hxx (revision b32aa359)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ADC_ADC_CL_HXX
25 #define ADC_ADC_CL_HXX
26 
27 
28 
29 // USED SERVICES
30 	// BASE CLASSES
31 #include <cosv/comdline.hxx>
32 	// COMPONENTS
33 	// PARAMETERS
34 
35 #include <vector>
36 
37 namespace ary
38 {
39     class Repository;
40 }
41 
42 namespace autodoc
43 {
44 namespace command
45 {
46     class Command;
47     class CreateHtml;
48     class SinceTagTransformationData;
49 }
50 
51 
52 /** Reads and runs an Autodoc command line.
53 */
54 class CommandLine : public csv::CommandLine_Ifc
55 {
56   public:
57     // LIFECYCLE
58 						CommandLine();
59 						~CommandLine();
60     // OPERATIONS
61     int                 Run() const;
62 
63     // INQUIRY
64         // debugging
65     bool                DebugStyle_ShowText() const;
66     bool                DebugStyle_ShowStoredObjects() const;
67     bool                DebugStyle_ShowTokens() const;
68 
69         // @since tags
70     bool                DoesTransform_SinceTag() const;
71 
72 //    /// @see command::SinceTagTransformationData::StripSinceTagValue()
73 //    bool                Strip_SinceTagText(
74 //                            String &            io_sSinceTagValue ) const;
75 
76     /// @see command::SinceTagTransformationData::DisplayOf()
77     const String &      DisplayOf_SinceTagValue(
78                             const String &      i_sVersionNumber ) const;
79 
IgnoreDefines() const80     const ::std::vector<String> & IgnoreDefines() const
81                                                 { return ignoreDefines; }
82 
83         // extern IDL links
ExternRoot() const84     const String &      ExternRoot() const      { return sExternRoot; }
ExternNamespace() const85     const String &      ExternNamespace() const { return sExternNamespace; }
86 
CppUsed() const87     bool                CppUsed() const         { return bCpp; }
IdlUsed() const88     bool                IdlUsed() const         { return bIdl; }
89 
90     // ACCESS
AddIgnoreDefine(const String & define)91     void                AddIgnoreDefine(
92                             const String& define)
93                                                 { ignoreDefines.push_back(define); }
94     static CommandLine &
95                         Get_();
Set_ExternRoot(const String & i_s)96     void                Set_ExternRoot(
97                             const String &      i_s )
98                                                 { sExternRoot = i_s; }
Set_ExternNamespace(const String & i_s)99     void                Set_ExternNamespace(
100                             const String &      i_s )
101                                                 { sExternNamespace = i_s; }
TheRepository() const102     ary::Repository &   TheRepository() const   { csv_assert(pReposy != 0);
103                                                   return *pReposy; }
Set_CppUsed()104     void                Set_CppUsed()           { bCpp = true; }
Set_IdlUsed()105     void                Set_IdlUsed()           { bIdl = true; }
106 
107   private:
108     // Interface cosv::CommandLine_Ifc:
109     virtual void        do_Init(
110                             int                 argc,
111                             char *              argv[] );
112     virtual void        do_PrintUse() const;
113     virtual bool        inq_CheckParameters() const;
114 
115     // Locals
116     typedef StringVector::const_iterator            opt_iter;
117     typedef std::vector< DYN command::Command* >    CommandList;
118 
119     void                load_IncludedCommands(
120                             StringVector &      out,
121                             const char *        i_filePath );
122 
123     void                do_clVerbose(
124                             opt_iter &          it,
125                             opt_iter            itEnd );
126     void                do_clParse(
127                             opt_iter &          it,
128                             opt_iter            itEnd );
129     void                do_clCreateHtml(
130                             opt_iter &          it,
131                             opt_iter            itEnd );
132     void                do_clSinceFile(
133                             opt_iter &          it,
134                             opt_iter            itEnd );
135 
136 //    void                do_clCreateXml(
137 //                            opt_iter &          it,
138 //                            opt_iter            itEnd );
139 //    void                do_clLoad(
140 //                            opt_iter &          it,
141 //                            opt_iter            itEnd );
142 //    void                do_clSave(
143 //                            opt_iter &          it,
144 //                            opt_iter            itEnd );
145 
146     void                sort_Commands();
147 
148 	// DATA
149     uintt               nDebugStyle;
150     Dyn<command::SinceTagTransformationData>
151                         pSinceTransformator;
152 
153     CommandList         aCommands;
154     bool                bInitOk;
155     command::CreateHtml *
156                         pCommand_CreateHtml;
157 
158     ::std::vector<String> ignoreDefines;
159 
160     String              sExternRoot;
161     String              sExternNamespace;
162 
163     mutable Dyn<ary::Repository>
164                         pReposy;
165     bool                bCpp;
166     bool                bIdl;
167 
168     static CommandLine *
169                         pTheInstance_;
170 };
171 
172 
173 
174 // IMPLEMENTATION
175 inline bool
DebugStyle_ShowText() const176 CommandLine::DebugStyle_ShowText() const
177     { return (nDebugStyle & 2) != 0; }
178 inline bool
DebugStyle_ShowStoredObjects() const179 CommandLine::DebugStyle_ShowStoredObjects() const
180     { return (nDebugStyle & 4) != 0; }
181 inline bool
DebugStyle_ShowTokens() const182 CommandLine::DebugStyle_ShowTokens() const
183     { return (nDebugStyle & 1) != 0; }
184 
185 }   // namespace autodoc
186 
187 
188 inline bool
DEBUG_ShowText()189 DEBUG_ShowText()
190     { return autodoc::CommandLine::Get_().DebugStyle_ShowText(); }
191 inline bool
DEBUG_ShowStoring()192 DEBUG_ShowStoring()
193     { return autodoc::CommandLine::Get_().DebugStyle_ShowStoredObjects(); }
194 inline bool
DEBUG_ShowTokens()195 DEBUG_ShowTokens()
196     { return autodoc::CommandLine::Get_().DebugStyle_ShowTokens(); }
197 
198 #endif
199 
200