OpenShot Audio Library | OpenShotAudio 0.3.2
Loading...
Searching...
No Matches
juce_ConsoleApplication.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2017 - ROLI Ltd.
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
39{
42
44 ArgumentList (int argc, char* argv[]);
45
48
49 ArgumentList (const ArgumentList&) = default;
50 ArgumentList& operator= (const ArgumentList&) = default;
51
52 //==============================================================================
58 struct Argument
59 {
62
66 File resolveAsFile() const;
67
75
83
85 bool isLongOption() const;
86
88 bool isShortOption() const;
89
91 bool isLongOption (const String& optionRoot) const;
92
97
99 bool isShortOption (char shortOptionCharacter) const;
100
102 bool isOption() const;
103
108
113 };
114
115 //==============================================================================
117 int size() const;
118
120 Argument operator[] (int index) const;
121
124
129 bool containsOption (StringRef option) const;
130
137
141 int indexOfOption (StringRef option) const;
142
145
156
163
168
174
179
186
191
198
201
204};
205
206
207//==============================================================================
237{
238 //==============================================================================
269
270 //==============================================================================
272 void addCommand (Command);
273
278
281
287
291 void printCommandList (const ArgumentList&) const;
292
296 void printCommandDetails (const ArgumentList&, const Command&) const;
297
298 //==============================================================================
305 static void fail (String errorMessage, int returnCode = 1);
306
311 static int invokeCatchingFailures (std::function<int()>&& functionToCall);
312
313 //==============================================================================
328 bool optionMustBeFirstArg = false) const;
329
333 int findAndRunCommand (int argc, char* argv[]) const;
334
342 const Command* findCommand (const ArgumentList&, bool optionMustBeFirstArg) const;
343
345 const std::vector<Command>& getCommands() const;
346
347private:
348 //==============================================================================
349 std::vector<Command> commands;
350 int commandIfNoOthersRecognised = -1;
351};
352
353} // namespace juce
bool operator!=(StringRef stringToCompare) const
bool operator==(StringRef stringToCompare) const
File getExistingFileForOptionAndRemove(StringRef option)
String removeValueForOption(StringRef option)
File getExistingFileForOption(StringRef option) const
bool removeOptionIfFound(StringRef option)
File getExistingFolderForOption(StringRef option) const
int indexOfOption(StringRef option) const
File getFileForOption(StringRef option) const
void failIfOptionIsMissing(StringRef option) const
bool containsOption(StringRef option) const
void checkMinNumArguments(int expectedMinNumberOfArgs) const
String getValueForOption(StringRef option) const
Argument operator[](int index) const
File getFileForOptionAndRemove(StringRef option)
File getExistingFolderForOptionAndRemove(StringRef option)
void printCommandDetails(const ArgumentList &, const Command &) const
int findAndRunCommand(const ArgumentList &, bool optionMustBeFirstArg=false) const
void printCommandList(const ArgumentList &) const
const Command * findCommand(const ArgumentList &, bool optionMustBeFirstArg) const
std::function< void(const ArgumentList &)> command
static int invokeCatchingFailures(std::function< int()> &&functionToCall)
void addHelpCommand(String helpArgument, String helpMessage, bool makeDefaultCommand)
void addVersionCommand(String versionArgument, String versionText)
static void fail(String errorMessage, int returnCode=1)
const std::vector< Command > & getCommands() const