Bump for 3.6-28
[LibreOffice.git] / autodoc / source / exes / adc_uni / adc_cmd.hxx
blob47e5ab7edfe04d4d6e791a33bbb9625d24a4d469
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef ADC_ADC_CMD_HXX
30 #define ADC_ADC_CMD_HXX
34 // USED SERVICES
35 // BASE CLASSES
36 #include <cosv/comdline.hxx>
37 // COMPONENTS
38 // PARAMETERS
41 namespace autodoc
43 namespace command
46 /** Context for a command, which can be read from the command line.
48 class Context
50 public:
51 typedef StringVector::const_iterator opt_iter;
53 virtual ~Context() {}
55 void Init(
56 opt_iter & it,
57 opt_iter itEnd );
58 private:
59 virtual void do_Init(
60 opt_iter & it,
61 opt_iter itEnd ) = 0;
64 // IMPLEMENTATION
65 inline void
66 Context::Init( opt_iter & i_nCurArgsBegin,
67 opt_iter i_nEndOfAllArgs )
69 { do_Init(i_nCurArgsBegin, i_nEndOfAllArgs); }
73 /** Interface for commands, autodoc is able to perform.
75 class Command : public Context
77 public:
78 /** Running ranks of the commands are to be maintained at one location:
79 Here!
81 enum E_Ranks
83 rank_Load = 10,
84 rank_Parse = 20,
85 rank_Save = 30,
86 rank_CreateHtml = 40,
87 rank_CreateXml = 50
91 bool Run() const;
92 int RunningRank() const;
94 private:
95 virtual bool do_Run() const = 0;
96 virtual int inq_RunningRank() const = 0;
99 // IMPLEMENTATION
100 inline bool
101 Command::Run() const
102 { return do_Run(); }
103 inline int
104 Command::RunningRank() const
105 { return inq_RunningRank(); }
110 /** The exception thrown, if the command line is invalid.
112 class X_CommandLine
114 public:
115 X_CommandLine(
116 const char * i_sExplanation )
117 : sExplanation(i_sExplanation) {}
119 void Report(
120 std::ostream & o_rOut )
121 { o_rOut << "Error in command line: "
122 << sExplanation << Endl(); }
123 private:
124 String sExplanation;
130 } // namespace command
131 } // namespace autodoc
132 #endif
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */