1*1c78a5d6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1c78a5d6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1c78a5d6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1c78a5d6SAndrew Rist  * distributed with this work for additional information
6*1c78a5d6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1c78a5d6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1c78a5d6SAndrew Rist  * "License"); you may not use this file except in compliance
9*1c78a5d6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1c78a5d6SAndrew Rist  *
11*1c78a5d6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1c78a5d6SAndrew Rist  *
13*1c78a5d6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1c78a5d6SAndrew Rist  * software distributed under the License is distributed on an
15*1c78a5d6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1c78a5d6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1c78a5d6SAndrew Rist  * specific language governing permissions and limitations
18*1c78a5d6SAndrew Rist  * under the License.
19*1c78a5d6SAndrew Rist  *
20*1c78a5d6SAndrew Rist  *************************************************************/
21*1c78a5d6SAndrew Rist 
22*1c78a5d6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef ADC_ADC_CMD_PARSE_HXX
25cdf0e10cSrcweir #define ADC_ADC_CMD_PARSE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir 
29cdf0e10cSrcweir // USED SERVICES
30cdf0e10cSrcweir 	// BASE CLASSES
31cdf0e10cSrcweir #include "adc_cmd.hxx"
32cdf0e10cSrcweir 	// COMPONENTS
33cdf0e10cSrcweir #include <cosv/ploc.hxx>
34cdf0e10cSrcweir 	// PARAMETERS
35cdf0e10cSrcweir 
36cdf0e10cSrcweir namespace autodoc
37cdf0e10cSrcweir {
38cdf0e10cSrcweir namespace command
39cdf0e10cSrcweir {
40cdf0e10cSrcweir 
41cdf0e10cSrcweir /** A command context which holds the currently parsed programing language
42cdf0e10cSrcweir     and its valid file extensions.
43cdf0e10cSrcweir */
44cdf0e10cSrcweir struct S_LanguageInfo : public Context
45cdf0e10cSrcweir {
46cdf0e10cSrcweir     enum E_ProgrammingLanguage
47cdf0e10cSrcweir     {
48cdf0e10cSrcweir         none,
49cdf0e10cSrcweir         cpp,
50cdf0e10cSrcweir         idl,
51cdf0e10cSrcweir         java
52cdf0e10cSrcweir     };
S_LanguageInfoautodoc::command::S_LanguageInfo53cdf0e10cSrcweir                         S_LanguageInfo()
54cdf0e10cSrcweir                             :   eLanguage(none),
55cdf0e10cSrcweir                                 aExtensions() {}
56cdf0e10cSrcweir                         ~S_LanguageInfo();
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     void                InitExtensions(
59cdf0e10cSrcweir                             opt_iter &          it,
60cdf0e10cSrcweir                             opt_iter            itEnd );
61cdf0e10cSrcweir     // DATA
62cdf0e10cSrcweir     E_ProgrammingLanguage
63cdf0e10cSrcweir                         eLanguage;
64cdf0e10cSrcweir     StringVector        aExtensions;        // An empty string is possible and means exactly that: files without extension.
65cdf0e10cSrcweir 
66cdf0e10cSrcweir   private:
67cdf0e10cSrcweir     // Interface Context:
68cdf0e10cSrcweir     virtual void        do_Init(
69cdf0e10cSrcweir                             opt_iter &          it,
70cdf0e10cSrcweir                             opt_iter            itEnd );
71cdf0e10cSrcweir };
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 
74cdf0e10cSrcweir class S_ProjectData;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 
77cdf0e10cSrcweir /** A command that parses source code into the Autodoc Repository.
78cdf0e10cSrcweir */
79cdf0e10cSrcweir class Parse : public Command
80cdf0e10cSrcweir {
81cdf0e10cSrcweir   public:
82cdf0e10cSrcweir     typedef std::vector< DYN S_ProjectData * >  ProjectList;
83cdf0e10cSrcweir     typedef ProjectList::const_iterator         ProjectIterator;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir                         Parse();
86cdf0e10cSrcweir                         ~Parse();
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     // INQUIRY
89cdf0e10cSrcweir     const String &      ReposyName() const;
90cdf0e10cSrcweir     const S_LanguageInfo &
91cdf0e10cSrcweir                         GlobalLanguage() const;
92cdf0e10cSrcweir     ProjectIterator     ProjectsBegin() const;
93cdf0e10cSrcweir     ProjectIterator     ProjectsEnd() const;
DevelopersManual_RefFilePath() const94cdf0e10cSrcweir     const String &      DevelopersManual_RefFilePath() const
95cdf0e10cSrcweir                                                 { return sDevelopersManual_RefFilePath; }
96cdf0e10cSrcweir 
97cdf0e10cSrcweir   private:
98cdf0e10cSrcweir     // Interface Context:
99cdf0e10cSrcweir     virtual void        do_Init(
100cdf0e10cSrcweir                             opt_iter &          i_nCurArgsBegin,
101cdf0e10cSrcweir                             opt_iter            i_nEndOfAllArgs );
102cdf0e10cSrcweir     // Interface Command:
103cdf0e10cSrcweir     virtual bool        do_Run() const;
104cdf0e10cSrcweir     virtual int         inq_RunningRank() const;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     // Locals
107cdf0e10cSrcweir     void                do_clName(
108cdf0e10cSrcweir                             opt_iter &          it,
109cdf0e10cSrcweir                             opt_iter            itEnd );
110cdf0e10cSrcweir     void                do_clDevManual(
111cdf0e10cSrcweir                             opt_iter &          it,
112cdf0e10cSrcweir                             opt_iter            itEnd );
113cdf0e10cSrcweir     void                do_clProject(
114cdf0e10cSrcweir                             opt_iter &          it,
115cdf0e10cSrcweir                             opt_iter            itEnd );
116cdf0e10cSrcweir     void                do_clDefaultProject(
117cdf0e10cSrcweir                             opt_iter &          it,
118cdf0e10cSrcweir                             opt_iter            itEnd );
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     // DATA
121cdf0e10cSrcweir     String              sRepositoryName;
122cdf0e10cSrcweir     S_LanguageInfo      aGlobalLanguage;
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     ProjectList         aProjects;
125cdf0e10cSrcweir 
126cdf0e10cSrcweir     String              sDevelopersManual_RefFilePath;
127cdf0e10cSrcweir };
128cdf0e10cSrcweir 
129cdf0e10cSrcweir inline const String &
ReposyName() const130cdf0e10cSrcweir Parse::ReposyName() const
131cdf0e10cSrcweir     { return sRepositoryName; }
132cdf0e10cSrcweir inline const S_LanguageInfo &
GlobalLanguage() const133cdf0e10cSrcweir Parse::GlobalLanguage() const
134cdf0e10cSrcweir     { return aGlobalLanguage; }
135cdf0e10cSrcweir inline Parse::ProjectIterator
ProjectsBegin() const136cdf0e10cSrcweir Parse::ProjectsBegin() const
137cdf0e10cSrcweir     { return aProjects.begin(); }
138cdf0e10cSrcweir inline Parse::ProjectIterator
ProjectsEnd() const139cdf0e10cSrcweir Parse::ProjectsEnd() const
140cdf0e10cSrcweir     { return aProjects.end(); }
141cdf0e10cSrcweir //inline const String &
142cdf0e10cSrcweir //Parse::DevelopersManual_RefFilePath() const
143cdf0e10cSrcweir //    { return sDevelopersManual_RefFilePath; }
144cdf0e10cSrcweir //inline const String &
145cdf0e10cSrcweir //Parse::DevelopersManual_HtmlRoot() const
146cdf0e10cSrcweir //    { return sDevelopersManual_HtmlRoot; }
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 
149cdf0e10cSrcweir struct S_Sources : public Context
150cdf0e10cSrcweir {
151cdf0e10cSrcweir     StringVector        aTrees;
152cdf0e10cSrcweir     StringVector        aDirectories;
153cdf0e10cSrcweir     StringVector        aFiles;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir   private:
156cdf0e10cSrcweir     // Interface Context:
157cdf0e10cSrcweir     virtual void        do_Init(
158cdf0e10cSrcweir                             opt_iter &          it,
159cdf0e10cSrcweir                             opt_iter            itEnd );
160cdf0e10cSrcweir };
161cdf0e10cSrcweir 
162cdf0e10cSrcweir class S_ProjectData : public Context
163cdf0e10cSrcweir {
164cdf0e10cSrcweir   public:
165cdf0e10cSrcweir     enum E_Default { default_prj };
166cdf0e10cSrcweir 
167cdf0e10cSrcweir                         S_ProjectData(
168cdf0e10cSrcweir                             const S_LanguageInfo &
169cdf0e10cSrcweir                                                 i_globalLanguage );
170cdf0e10cSrcweir                         S_ProjectData(
171cdf0e10cSrcweir                             const S_LanguageInfo &
172cdf0e10cSrcweir                                                 i_globalLanguage,
173cdf0e10cSrcweir                             E_Default           unused );
174cdf0e10cSrcweir                         ~S_ProjectData();
175cdf0e10cSrcweir 
IsDefault() const176cdf0e10cSrcweir     bool                IsDefault() const       { return bIsDefault; }
Name() const177cdf0e10cSrcweir     const String &      Name() const            { return sName; }
178cdf0e10cSrcweir     const csv::ploc::Path &
RootDirectory() const179cdf0e10cSrcweir                         RootDirectory() const   { return aRootDirectory; }
180cdf0e10cSrcweir     const S_LanguageInfo &
Language() const181cdf0e10cSrcweir                         Language() const        { return aLanguage; }
Sources() const182cdf0e10cSrcweir     const S_Sources     Sources() const         { return aFiles; }
183cdf0e10cSrcweir 
184cdf0e10cSrcweir   private:
185cdf0e10cSrcweir     // Interface Context:
186cdf0e10cSrcweir     virtual void        do_Init(
187cdf0e10cSrcweir                             opt_iter &          it,
188cdf0e10cSrcweir                             opt_iter            itEnd );
189cdf0e10cSrcweir     // Locals
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     // DATA
192cdf0e10cSrcweir     String              sName;
193cdf0e10cSrcweir     csv::ploc::Path     aRootDirectory;
194cdf0e10cSrcweir     S_LanguageInfo      aLanguage;
195cdf0e10cSrcweir     S_Sources           aFiles;
196cdf0e10cSrcweir     bool                bIsDefault;
197cdf0e10cSrcweir };
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 
200cdf0e10cSrcweir }   // namespace command
201cdf0e10cSrcweir }   // namespace autodoc
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 
204cdf0e10cSrcweir #endif
205