本文整理汇总了C++中OptionParser::DisplayHelp方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionParser::DisplayHelp方法的具体用法?C++ OptionParser::DisplayHelp怎么用?C++ OptionParser::DisplayHelp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionParser
的用法示例。
在下文中一共展示了OptionParser::DisplayHelp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emptyString
void OpenHome::TestFramework::Runner::Main(TInt aArgc, TChar* aArgv[], InitialisationParams* aInitParams)
{
OptionParser parser;
Brn emptyString("");
OptionString config("-c", "--config", emptyString, "[full dir path] to folder containing web UI");
parser.AddOption(&config);
OptionBool loopback("-l", "--loopback", "Use the loopback adapter only");
parser.AddOption(&loopback);
if (!parser.Parse(aArgc, aArgv) || parser.HelpDisplayed()) {
return;
}
if (config.Value().Bytes() == 0) {
parser.DisplayHelp();
return;
}
if (loopback.Value()) {
aInitParams->SetUseLoopbackNetworkAdapter();
}
aInitParams->SetDvNumWebSocketThreads(5);
aInitParams->SetDvWebSocketPort(54320);
aInitParams->SetDvUpnpServerPort(0);
UpnpLibrary::Initialise(aInitParams);
Debug::SetLevel(Debug::kDvWebSocket | Debug::kError | Debug::kDvInvocation | Debug::kDvEvent | Debug::kDvDevice);
UpnpLibrary::StartDv();
Print("TestDvTestBasic - starting ('q' to quit)\n");
DeviceBasic* device = new DeviceBasic(config.Value());
while (getchar() != 'q') {
;
}
delete device;
Print("TestDvTestBasic - exiting\n");
UpnpLibrary::Close();
}
示例2: TestDeviceList
void TestDeviceList(const std::vector<Brn>& aArgs)
{
OptionParser parser;
OptionUint mx("-mx", "--mx", 1, "[1..5] number of second to spread response over");
parser.AddOption(&mx);
OptionBool all("-a", "--all", "Search for all devices and services");
parser.AddOption(&all);
OptionBool root("-r", "--root", "Search for root devices only");
parser.AddOption(&root);
Brn emptyString("");
OptionString uuid("-u", "--uuid", emptyString, "[uuid string] search for a particular device");
parser.AddOption(&uuid);
OptionString urn("-t", "--urn", emptyString, "Search for a device or service of the form [domain:[device|service]:type:ver]");
parser.AddOption(&urn);
OptionBool refresh("-f", "--refresh", "Wait mx secs then refresh list");
parser.AddOption(&refresh);
if (!parser.Parse(aArgs) || parser.HelpDisplayed()) {
return;
}
// Debug::SetLevel(Debug::kDevice);
DeviceListLogger logger;
CpDeviceList* deviceList = NULL;
FunctorCpDevice added = MakeFunctorCpDevice(logger, &DeviceListLogger::Added);
FunctorCpDevice removed = MakeFunctorCpDevice(logger, &DeviceListLogger::Removed);
if (all.Value()) {
deviceList = new CpDeviceListUpnpAll(added, removed);
}
else if (root.Value()) {
Print("Search root...\n");
deviceList = new CpDeviceListUpnpRoot(added, removed);
}
else if (uuid.Value().Bytes() > 0) {
Print("Search uuid...\n");
deviceList = new CpDeviceListUpnpUuid(uuid.Value(), added, removed);
}
else if (urn.Value().Bytes() > 0) {
Print("Search device/service...\n");
Brn domainName;
Brn type;
TUint ver;
if (OpenHome::Net::Ssdp::ParseUrnDevice(urn.Value(), domainName, type, ver)) {
deviceList = new CpDeviceListUpnpDeviceType(domainName, type, ver, added, removed);
}
else if (OpenHome::Net::Ssdp::ParseUrnService(urn.Value(), domainName, type, ver)) {
deviceList = new CpDeviceListUpnpServiceType(domainName, type, ver, added, removed);
}
else {
parser.DisplayHelp();
}
}
else {
parser.DisplayHelp();
}
Blocker* blocker = new Blocker;
if (deviceList != NULL) {
blocker->Wait(Stack::InitParams().MsearchTimeSecs());
}
if (refresh.Value()) {
Print("\nRefreshing...\n\n");
deviceList->Refresh();
blocker->Wait(Stack::InitParams().MsearchTimeSecs());
}
delete blocker;
delete deviceList;
}
示例3: TestSsdpUListen
void TestSsdpUListen(Environment& aEnv, const std::vector<Brn>& aArgs)
{
OptionParser parser;
OptionUint mx("-mx", "--mx", 0, "[1..5] number of second to spread response over");
parser.AddOption(&mx);
OptionUint adapter("-i", "--interface", 0, "index of network adapter to use");
parser.AddOption(&adapter);
OptionBool all("-a", "--all", "Search for all devices and services");
parser.AddOption(&all);
OptionBool root("-r", "--root", "Search for root devices only");
parser.AddOption(&root);
Brn emptyString("");
OptionString uuid("-u", "--uuid", emptyString, "[uuid string] search for a particular device");
parser.AddOption(&uuid);
OptionString urn("-t", "--urn", emptyString, "Search for a device or service of the form [domain:[device|service]:type:ver]");
parser.AddOption(&urn);
if (!parser.Parse(aArgs) || parser.HelpDisplayed()) {
return;
}
//Debug::SetLevel(Debug::kSsdpMulticast);
TBool block = true;
SsdpNotifyLoggerU logger;
SsdpListenerUnicast* uListener = new SsdpListenerUnicast(aEnv, logger, NetworkIf(aEnv, adapter.Value()));
uListener->Start();
if (all.Value()) {
Print("Search all...\n");
uListener->MsearchAll();
}
else if (root.Value()) {
Print("Search root...\n");
uListener->MsearchRoot();
}
else if (uuid.Value().Bytes() > 0) {
Print("Search uuid...\n");
uListener->MsearchUuid(uuid.Value());
}
else if (urn.Value().Bytes() > 0) {
Print("Search device/service...\n");
Brn domainName;
Brn deviceType;
TUint ver;
if (OpenHome::Net::Ssdp::ParseUrnDevice(urn.Value(), domainName, deviceType, ver)) {
uListener->MsearchDeviceType(domainName, deviceType, ver);
}
else if (OpenHome::Net::Ssdp::ParseUrnService(urn.Value(), domainName, deviceType, ver)) {
uListener->MsearchServiceType(domainName, deviceType, ver);
}
else {
parser.DisplayHelp();
block = false;
}
}
else {
parser.DisplayHelp();
block = false;
}
if (block) {
Blocker* blocker = new Blocker(aEnv);
blocker->Wait(aEnv.InitParams()->MsearchTimeSecs());
delete blocker;
}
delete uListener;
}