本文整理汇总了C++中Capability::addCapability方法的典型用法代码示例。如果您正苦于以下问题:C++ Capability::addCapability方法的具体用法?C++ Capability::addCapability怎么用?C++ Capability::addCapability使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Capability
的用法示例。
在下文中一共展示了Capability::addCapability方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
// construction
// we can build a document piece by piece...
InfoResBase objAPA;
objAPA.addString("Name", "Schlafly American Pale Ale");
objAPA.addString("Name", "Schlafly American Pale Ale");
objAPA.addString("Origin", "St. Louis, MO, USA");
objAPA.addNumber("ABV", 3.8);
objAPA.addBoolean("BottleConditioned", true);
InfoResBase objBPB;
objBPB.addString("Name", "John Smith's Extra Smooth");
objBPB.addString("Origin", "Tadcaster, Yorkshire, UK");
objBPB.addNumber("ABV", 3.8);
objBPB.addBoolean("BottleConditioned", false);
InfoResArray arrayBeer;
arrayBeer.insert(objAPA);
arrayBeer.insert(objBPB);
InfoResBase objDocument;
objDocument.addArray("Delicious Beers", arrayBeer);
objDocument.addObject("aaa", objAPA);
std::cout << objDocument.toJson() << std::endl;
std::cout << "----------- Address Group -----------" << std::endl;
// address group
EndpointAddrGroup group;
std::vector<const char*> ipv4;
ipv4.push_back("192.0.2.0/24");
ipv4.push_back("198.51.100.0/25");
std::vector<const char*> ipv6;
ipv6.push_back("2001:db8:0:1::/64");
ipv6.push_back("2001:db8:0:2::/64");
group.setIPv4(ipv4);
group.setIPv6(ipv6);
std::cout << group.toJson() << std::endl;
std::cout << "----------- Resource Directory -----------" << std::endl;
std::vector<ResourceEntry> res(5);
res[0].addUri("http://alto.example.com/networkmap");
std::vector<const char*> mtypes;
mtypes.push_back("application/alto-networkmap+json");
res[0].addMediaTypes(mtypes);
std::vector<const char*> accepts;
res[1].addUri("http://alto.example.com/costmap/num/routingcost");
mtypes.clear();
mtypes.push_back("application/alto-costmap+json");
res[1].addMediaTypes(mtypes);
accepts.clear();
res[2].addUri("http://alto.example.com/costmap/num/hopcount");
mtypes.clear();
mtypes.push_back("application/alto-costmap+json");
res[2].addMediaTypes(mtypes);
accepts.clear();
res[3].addUri("http://custom.alto.example.com/maps");
mtypes.clear();
mtypes.push_back("application/alto-networkmapfilter+json");
mtypes.push_back("application/alto-costmapfilter+json");
res[3].addMediaTypes(mtypes);
accepts.clear();
accepts.push_back("application/alto-networkmapfilter+json");
accepts.push_back("application/alto-costmapfilter+json");
res[3].addAccepts(accepts);
res[4].addUri("http://alto.example.com/endpointprop/lookup");
mtypes.clear();
mtypes.push_back("application/alto-endpointprop+json");
res[4].addMediaTypes(mtypes);
accepts.clear();
accepts.push_back("application/alto-endpointpropparams+json");
res[4].addAccepts(accepts);
Capability cap;
std::vector<const char*> vec;
vec.push_back("numerical");
cap.addCapability("cost-modes", vec);
vec.clear();
vec.push_back("routingcost");
cap.addCapability("cost-types", vec);
res[1].addCapability(cap);
vec.clear();
cap.clear();
vec.push_back("numerical");
cap.addCapability("cost-modes", vec);
vec.clear();
vec.push_back("hopcount");
cap.addCapability("cost-types", vec);
res[2].addCapability(cap);
vec.clear();
//.........这里部分代码省略.........