update credits
[LibreOffice.git] / autodoc / source / exes / adc_uni / adc_cmd.hxx
blob1b20627bf6bdb3ca410525904ae9208024efb571
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef ADC_ADC_CMD_HXX
21 #define ADC_ADC_CMD_HXX
25 // USED SERVICES
26 // BASE CLASSES
27 #include <cosv/comdline.hxx>
28 // COMPONENTS
29 // PARAMETERS
32 namespace autodoc
34 namespace command
37 /** Context for a command, which can be read from the command line.
39 class Context
41 public:
42 typedef StringVector::const_iterator opt_iter;
44 virtual ~Context() {}
46 void Init(
47 opt_iter & it,
48 opt_iter itEnd );
49 private:
50 virtual void do_Init(
51 opt_iter & it,
52 opt_iter itEnd ) = 0;
55 // IMPLEMENTATION
56 inline void
57 Context::Init( opt_iter & i_nCurArgsBegin,
58 opt_iter i_nEndOfAllArgs )
60 { do_Init(i_nCurArgsBegin, i_nEndOfAllArgs); }
64 /** Interface for commands, autodoc is able to perform.
66 class Command : public Context
68 public:
69 /** Running ranks of the commands are to be maintained at one location:
70 Here!
72 enum E_Ranks
74 rank_Load = 10,
75 rank_Parse = 20,
76 rank_Save = 30,
77 rank_CreateHtml = 40,
78 rank_CreateXml = 50
82 bool Run() const;
83 int RunningRank() const;
85 private:
86 virtual bool do_Run() const = 0;
87 virtual int inq_RunningRank() const = 0;
90 // IMPLEMENTATION
91 inline bool
92 Command::Run() const
93 { return do_Run(); }
94 inline int
95 Command::RunningRank() const
96 { return inq_RunningRank(); }
101 /** The exception thrown, if the command line is invalid.
103 class X_CommandLine
105 public:
106 X_CommandLine(
107 const char * i_sExplanation )
108 : sExplanation(i_sExplanation) {}
110 void Report(
111 std::ostream & o_rOut )
112 { o_rOut << "Error in command line: "
113 << sExplanation << Endl(); }
114 private:
115 String sExplanation;
121 } // namespace command
122 } // namespace autodoc
123 #endif
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */