xref: /aoo4110/main/autodoc/source/inc/adc_cl.hxx (revision b1cdbd2c)
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 namespace ary
36 {
37     class Repository;
38 }
39 
40 namespace autodoc
41 {
42 namespace command
43 {
44     class Command;
45     class CreateHtml;
46     class SinceTagTransformationData;
47 }
48 
49 
50 /** Reads and runs an Autodoc command line.
51 */
52 class CommandLine : public csv::CommandLine_Ifc
53 {
54   public:
55     // LIFECYCLE
56 						CommandLine();
57 						~CommandLine();
58     // OPERATIONS
59     int                 Run() const;
60 
61     // INQUIRY
62         // debugging
63     bool                DebugStyle_ShowText() const;
64     bool                DebugStyle_ShowStoredObjects() const;
65     bool                DebugStyle_ShowTokens() const;
66 
67         // @since tags
68     bool                DoesTransform_SinceTag() const;
69 
70 //    /// @see command::SinceTagTransformationData::StripSinceTagValue()
71 //    bool                Strip_SinceTagText(
72 //                            String &            io_sSinceTagValue ) const;
73 
74     /// @see command::SinceTagTransformationData::DisplayOf()
75     const String &      DisplayOf_SinceTagValue(
76                             const String &      i_sVersionNumber ) const;
77 
78         // extern IDL links
ExternRoot() const79     const String &      ExternRoot() const      { return sExternRoot; }
ExternNamespace() const80     const String &      ExternNamespace() const { return sExternNamespace; }
81 
CppUsed() const82     bool                CppUsed() const         { return bCpp; }
IdlUsed() const83     bool                IdlUsed() const         { return bIdl; }
84 
85     // ACCESS
86     static CommandLine &
87                         Get_();
Set_ExternRoot(const String & i_s)88     void                Set_ExternRoot(
89                             const String &      i_s )
90                                                 { sExternRoot = i_s; }
Set_ExternNamespace(const String & i_s)91     void                Set_ExternNamespace(
92                             const String &      i_s )
93                                                 { sExternNamespace = i_s; }
TheRepository() const94     ary::Repository &   TheRepository() const   { csv_assert(pReposy != 0);
95                                                   return *pReposy; }
Set_CppUsed()96     void                Set_CppUsed()           { bCpp = true; }
Set_IdlUsed()97     void                Set_IdlUsed()           { bIdl = true; }
98 
99   private:
100     // Interface cosv::CommandLine_Ifc:
101     virtual void        do_Init(
102                             int                 argc,
103                             char *              argv[] );
104     virtual void        do_PrintUse() const;
105     virtual bool        inq_CheckParameters() const;
106 
107     // Locals
108     typedef StringVector::const_iterator            opt_iter;
109     typedef std::vector< DYN command::Command* >    CommandList;
110 
111     void                load_IncludedCommands(
112                             StringVector &      out,
113                             const char *        i_filePath );
114 
115     void                do_clVerbose(
116                             opt_iter &          it,
117                             opt_iter            itEnd );
118     void                do_clParse(
119                             opt_iter &          it,
120                             opt_iter            itEnd );
121     void                do_clCreateHtml(
122                             opt_iter &          it,
123                             opt_iter            itEnd );
124     void                do_clSinceFile(
125                             opt_iter &          it,
126                             opt_iter            itEnd );
127 
128 //    void                do_clCreateXml(
129 //                            opt_iter &          it,
130 //                            opt_iter            itEnd );
131 //    void                do_clLoad(
132 //                            opt_iter &          it,
133 //                            opt_iter            itEnd );
134 //    void                do_clSave(
135 //                            opt_iter &          it,
136 //                            opt_iter            itEnd );
137 
138     void                sort_Commands();
139 
140 	// DATA
141     uintt               nDebugStyle;
142     Dyn<command::SinceTagTransformationData>
143                         pSinceTransformator;
144 
145     CommandList         aCommands;
146     bool                bInitOk;
147     command::CreateHtml *
148                         pCommand_CreateHtml;
149 
150     String              sExternRoot;
151     String              sExternNamespace;
152 
153     mutable Dyn<ary::Repository>
154                         pReposy;
155     bool                bCpp;
156     bool                bIdl;
157 
158     static CommandLine *
159                         pTheInstance_;
160 };
161 
162 
163 
164 // IMPLEMENTATION
165 inline bool
DebugStyle_ShowText() const166 CommandLine::DebugStyle_ShowText() const
167     { return (nDebugStyle & 2) != 0; }
168 inline bool
DebugStyle_ShowStoredObjects() const169 CommandLine::DebugStyle_ShowStoredObjects() const
170     { return (nDebugStyle & 4) != 0; }
171 inline bool
DebugStyle_ShowTokens() const172 CommandLine::DebugStyle_ShowTokens() const
173     { return (nDebugStyle & 1) != 0; }
174 
175 }   // namespace autodoc
176 
177 
178 inline bool
DEBUG_ShowText()179 DEBUG_ShowText()
180     { return autodoc::CommandLine::Get_().DebugStyle_ShowText(); }
181 inline bool
DEBUG_ShowStoring()182 DEBUG_ShowStoring()
183     { return autodoc::CommandLine::Get_().DebugStyle_ShowStoredObjects(); }
184 inline bool
DEBUG_ShowTokens()185 DEBUG_ShowTokens()
186     { return autodoc::CommandLine::Get_().DebugStyle_ShowTokens(); }
187 
188 #endif
189 
190