Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef ADC_ADC_CMD_PARSE_HXX
21 : #define ADC_ADC_CMD_PARSE_HXX
22 :
23 :
24 :
25 : // USED SERVICES
26 : // BASE CLASSES
27 : #include "adc_cmd.hxx"
28 : // COMPONENTS
29 : #include <cosv/ploc.hxx>
30 : // PARAMETERS
31 :
32 : namespace autodoc
33 : {
34 : namespace command
35 : {
36 :
37 : /** A command context which holds the currently parsed programing language
38 : and its valid file extensions.
39 : */
40 1 : struct S_LanguageInfo : public Context
41 : {
42 : enum E_ProgrammingLanguage
43 : {
44 : none,
45 : idl
46 : };
47 1 : S_LanguageInfo()
48 : : eLanguage(none),
49 1 : aExtensions() {}
50 : ~S_LanguageInfo();
51 :
52 : void InitExtensions(
53 : opt_iter & it,
54 : opt_iter itEnd );
55 : // DATA
56 : E_ProgrammingLanguage
57 : eLanguage;
58 : StringVector aExtensions; // An empty string is possible and means exactly that: files without extension.
59 :
60 : private:
61 : // Interface Context:
62 : virtual void do_Init(
63 : opt_iter & it,
64 : opt_iter itEnd );
65 : };
66 :
67 :
68 : class S_ProjectData;
69 :
70 :
71 : /** A command that parses source code into the Autodoc Repository.
72 : */
73 : class Parse : public Command
74 : {
75 : public:
76 : typedef std::vector< DYN S_ProjectData * > ProjectList;
77 : typedef ProjectList::const_iterator ProjectIterator;
78 :
79 : Parse();
80 : ~Parse();
81 :
82 : // INQUIRY
83 : const String & ReposyName() const;
84 : const S_LanguageInfo &
85 : GlobalLanguage() const;
86 : ProjectIterator ProjectsBegin() const;
87 : ProjectIterator ProjectsEnd() const;
88 1 : const String & DevelopersManual_RefFilePath() const
89 1 : { return sDevelopersManual_RefFilePath; }
90 :
91 : private:
92 : // Interface Context:
93 : virtual void do_Init(
94 : opt_iter & i_nCurArgsBegin,
95 : opt_iter i_nEndOfAllArgs );
96 : // Interface Command:
97 : virtual bool do_Run() const;
98 : virtual int inq_RunningRank() const;
99 :
100 : // Locals
101 : void do_clName(
102 : opt_iter & it,
103 : opt_iter itEnd );
104 : void do_clDevManual(
105 : opt_iter & it,
106 : opt_iter itEnd );
107 : void do_clProject(
108 : opt_iter & it,
109 : opt_iter itEnd );
110 : void do_clDefaultProject(
111 : opt_iter & it,
112 : opt_iter itEnd );
113 :
114 : // DATA
115 : String sRepositoryName;
116 : S_LanguageInfo aGlobalLanguage;
117 :
118 : ProjectList aProjects;
119 :
120 : String sDevelopersManual_RefFilePath;
121 : };
122 :
123 : inline const String &
124 2 : Parse::ReposyName() const
125 2 : { return sRepositoryName; }
126 : inline const S_LanguageInfo &
127 : Parse::GlobalLanguage() const
128 : { return aGlobalLanguage; }
129 : inline Parse::ProjectIterator
130 1 : Parse::ProjectsBegin() const
131 1 : { return aProjects.begin(); }
132 : inline Parse::ProjectIterator
133 1 : Parse::ProjectsEnd() const
134 1 : { return aProjects.end(); }
135 : //inline const String &
136 : //Parse::DevelopersManual_RefFilePath() const
137 : // { return sDevelopersManual_RefFilePath; }
138 : //inline const String &
139 : //Parse::DevelopersManual_HtmlRoot() const
140 : // { return sDevelopersManual_HtmlRoot; }
141 :
142 :
143 4 : struct S_Sources : public Context
144 : {
145 : StringVector aTrees;
146 : StringVector aDirectories;
147 : StringVector aFiles;
148 :
149 : private:
150 : // Interface Context:
151 : virtual void do_Init(
152 : opt_iter & it,
153 : opt_iter itEnd );
154 : };
155 :
156 : class S_ProjectData : public Context
157 : {
158 : public:
159 : enum E_Default { default_prj };
160 :
161 : S_ProjectData(
162 : const S_LanguageInfo &
163 : i_globalLanguage );
164 : S_ProjectData(
165 : const S_LanguageInfo &
166 : i_globalLanguage,
167 : E_Default unused );
168 : ~S_ProjectData();
169 :
170 1 : bool IsDefault() const { return bIsDefault; }
171 1 : const String & Name() const { return sName; }
172 : const csv::ploc::Path &
173 1 : RootDirectory() const { return aRootDirectory; }
174 : const S_LanguageInfo &
175 2 : Language() const { return aLanguage; }
176 1 : const S_Sources Sources() const { return aFiles; }
177 :
178 : private:
179 : // Interface Context:
180 : virtual void do_Init(
181 : opt_iter & it,
182 : opt_iter itEnd );
183 : // Locals
184 :
185 : // DATA
186 : String sName;
187 : csv::ploc::Path aRootDirectory;
188 : S_LanguageInfo aLanguage;
189 : S_Sources aFiles;
190 : bool bIsDefault;
191 : };
192 :
193 :
194 : } // namespace command
195 : } // namespace autodoc
196 :
197 :
198 : #endif
199 :
200 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|