File:
[ELWIX - Embedded LightWeight unIX -] /
elwix /
tools /
oldlzma /
SRC /
Common /
CommandLineParser.h
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue May 14 09:04:51 2013 UTC (11 years, 5 months ago) by
misho
Branches:
misho,
elwix1_9_mips,
MAIN
CVS tags:
start,
elwix2_8,
elwix2_7,
elwix2_6,
elwix2_3,
elwix2_2,
HEAD,
ELWIX2_7,
ELWIX2_6,
ELWIX2_5,
ELWIX2_2p0
oldlzma needs for uboot
// Common/CommandLineParser.h
#ifndef __COMMON_COMMANDLINEPARSER_H
#define __COMMON_COMMANDLINEPARSER_H
#include "Common/String.h"
namespace NCommandLineParser {
void SplitCommandLine(const UString &src, UString &dest1, UString &dest2);
void SplitCommandLine(const UString &s, UStringVector &parts);
namespace NSwitchType {
enum EEnum
{
kSimple,
kPostMinus,
kLimitedPostString,
kUnLimitedPostString,
kPostChar
};
}
struct CSwitchForm
{
const wchar_t *IDString;
NSwitchType::EEnum Type;
bool Multi;
int MinLen;
int MaxLen;
const wchar_t *PostCharSet;
};
struct CSwitchResult
{
bool ThereIs;
bool WithMinus;
UStringVector PostStrings;
int PostCharIndex;
CSwitchResult(): ThereIs(false) {};
};
class CParser
{
int _numSwitches;
CSwitchResult *_switches;
bool ParseString(const UString &s, const CSwitchForm *switchForms);
public:
UStringVector NonSwitchStrings;
CParser(int numSwitches);
~CParser();
void ParseStrings(const CSwitchForm *switchForms,
const UStringVector &commandStrings);
const CSwitchResult& operator[](size_t index) const;
};
/////////////////////////////////
// Command parsing procedures
struct CCommandForm
{
wchar_t *IDString;
bool PostStringMode;
};
// Returns: Index of form and postString; -1, if there is no match
int ParseCommand(int numCommandForms, const CCommandForm *commandForms,
const UString &commandString, UString &postString);
struct CCommandSubCharsSet
{
wchar_t *Chars;
bool EmptyAllowed;
};
// Returns: indices of finded chars; -1 if there is no match
bool ParseSubCharsCommand(int numForms, const CCommandSubCharsSet *forms,
const UString &commandString, CIntVector &indices);
}
#endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>