本文整理汇总了C++中Capability类的典型用法代码示例。如果您正苦于以下问题:C++ Capability类的具体用法?C++ Capability怎么用?C++ Capability使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Capability类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getProfiles
void ProfileDB::listCapabilities(string statePattern) {
vector<Profile*> profiles;
set<string> aggregateCapabilities;
getProfiles("*", profiles);
for (size_t i = 0; i < profiles.size(); i++) {
Profile* profile = profiles.at(i);
set<string> capabilities = profile->getCapabilities();
for (set<string>::iterator capabilityIt = capabilities.begin(); capabilityIt
!= capabilities.end(); capabilityIt++) {
Capability capability = profile->getCapability(*capabilityIt);
if (capability.matchCapability(statePattern)) {
aggregateCapabilities.insert(*capabilityIt);
}
}
}
ostringstream output;
XMLWriter writer = XMLWriter(&output);
writer.start();
writer.startTag("db");
writer.setAttr("version", "1.0");
writer.setAttr("id", "main");
for (set<string>::iterator capabilityIt = aggregateCapabilities.begin(); capabilityIt
!= aggregateCapabilities.end(); capabilityIt++) {
writer.startTag(ELEMENT_CAPABILITY);
writer.setAttr(ATTR_NAME, *capabilityIt);
writer.endTag();
}
writer.endTag();
writer.end();
writer.dump();
}
示例2: slotValueChanged
void EditSceneValue::slotValueChanged(int value)
{
if (m_updateValue == false)
{
return;
}
m_updateValue = false;
Capability* c = m_channel->searchCapability(value);
ASSERT(c != NULL);
for (int i = 0; i < m_presetCombo->count(); i++)
{
if (m_presetCombo->text(i) == c->name())
{
m_presetCombo->setCurrentItem(i);
break;
}
}
m_value = value;
m_updateValue = true;
}
示例3: HandleList
void HandleList(std::string& out, LocalUser* user, bool show_all, bool show_values, bool minus_prefix = false) const
{
Ext show_caps = (show_all ? ~0 : capext.get(user));
for (CapMap::const_iterator i = caps.begin(); i != caps.end(); ++i)
{
Capability* cap = i->second;
if (!(show_caps & cap->GetMask()))
continue;
if ((show_all) && (!cap->OnList(user)))
continue;
if (minus_prefix)
out.push_back('-');
out.append(cap->GetName());
if (show_values)
{
const std::string* capvalue = cap->GetValue(user);
if ((capvalue) && (!capvalue->empty()) && (capvalue->find(' ') == std::string::npos))
{
out.push_back('=');
out.append(*capvalue, 0, MAX_VALUE_LENGTH);
}
}
out.push_back(' ');
}
}
示例4: getCapability
void State::enable(const GLenum capability, const int index)
{
Capability* cap = getCapability(capability);
cap->enable(index);
if (m_mode == ImmediateMode)
cap->apply();
}
示例5: assert
unsigned long
Generic_obj_space<SPACE>::v_delete(Page_number virt, Size size,
unsigned long page_attribs = L4_fpage::CRWSD)
{
(void)size;
assert (size.value() == 1);
Entry *c;
if (Optimize_local
&& mem_space() == Mem_space::current_mem_space(current_cpu()))
{
c = cap_virt(virt.value());
if (!c)
return 0;
Capability cap = Mem_layout::read_special_safe((Capability*)c);
if (!cap.valid())
return 0;
}
else
c = get_cap(virt.value());
if (c && c->valid())
{
if (page_attribs & L4_fpage::R)
c->invalidate();
else
c->del_rights(page_attribs & L4_fpage::CWSD);
}
return 0;
}
示例6: getCapability
void State::enable(GLenum capability)
{
Capability* cap = getCapability(capability);
cap->enable();
if (m_mode == ImmediateMode)
cap->apply();
}
示例7: mem_space
bool
Generic_obj_space<SPACE>::v_lookup(Addr const &virt, Phys_addr *phys = 0,
Size *size = 0, unsigned *attribs = 0)
{
if (size) size->set_value(1);
Entry *cap;
if (Optimize_local
&& mem_space() == Mem_space::current_mem_space(current_cpu()))
cap = cap_virt(virt.value());
else
cap = get_cap(virt.value());
if (EXPECT_FALSE(!cap))
{
if (size) size->set_value(Caps_per_page);
return false;
}
if (Optimize_local)
{
Capability c = Mem_layout::read_special_safe((Capability*)cap);
if (phys) *phys = c.obj();
if (c.valid() && attribs) *attribs = c.rights();
return c.valid();
}
else
{
Obj::set_entry(virt, cap);
if (phys) *phys = cap->obj();
if (cap->valid() && attribs) *attribs = cap->rights();
return cap->valid();
}
}
示例8: assert
Obj_space_virt<SPACE>::v_delete(V_pfn virt, Order size,
L4_fpage::Rights page_attribs)
{
(void)size;
assert (size == Order(0));
Entry *c;
if (Optimize_local
&& SPACE::mem_space(this) == Mem_space::current_mem_space(current_cpu()))
{
c = cap_virt(virt);
if (!c)
return L4_fpage::Rights(0);
Capability cap = Mem_layout::read_special_safe((Capability*)c);
if (!cap.valid())
return L4_fpage::Rights(0);
}
else
c = get_cap(virt);
if (c && c->valid())
{
if (page_attribs & L4_fpage::Rights::R())
c->invalidate();
else
c->del_rights(page_attribs & L4_fpage::Rights::CWSD());
}
return L4_fpage::Rights(0);
}
示例9:
~ManagerImpl()
{
for (CapMap::iterator i = caps.begin(); i != caps.end(); ++i)
{
Capability* cap = i->second;
cap->Unregister();
}
}
示例10:
Kobject_iface *
Generic_obj_space<SPACE>::lookup_local(Address virt, unsigned char *rights = 0)
{
virt &= ~(~0UL << Whole_space);
Capability *c = reinterpret_cast<Capability*>(cap_virt(virt));
Capability cap = Mem_layout::read_special_safe(c);
if (rights) *rights = cap.rights();
return cap.obj();
}
示例11: Cap_index
Kobject_iface *
Obj_space_virt<SPACE>::lookup_local(Cap_index virt, L4_fpage::Rights *rights)
{
virt &= Cap_index(~(~0UL << Whole_space));
Capability *c = reinterpret_cast<Capability*>(cap_virt(virt));
Capability cap = Mem_layout::read_special_safe(c);
if (rights) *rights = L4_fpage::Rights(cap.rights());
return cap.obj();
}
示例12: InstallCapability
/**
* Install a capability.
*
* @param capability -- A capability.
*/
void Strine_::InstallCapability(Capability const& capability)
{
Strine strine(shared_from_this());
capability.Install(strine);
this->capabilities.push_back(capability.Identifier());
// Re-install all builtins.
GlobalEnvironment_::InstallBuiltins( this->global_environment
, this->builtins_table);
}
示例13: get_capability
static Capability get_capability (const ::Deployment::Capability &src)
{
DANCE_TRACE ("Capability_Handler::get_capability - reverse");
Capability retval (ACE_TEXT_CHAR_TO_TCHAR (src.name.in ()));
#if 0
for (CORBA::ULong i = 0; i < src.resourceType.length (); ++i)
retval.add_resourceType (src.resourceType[i].in ());
for (CORBA::ULong i = 0; i < src.property.length (); ++i)
retval.add_property (SatisfierProperty_Handler::get_sat_property (
src.property[i]));
#endif
return retval;
}
示例14: parseProfileInfo
static bool parseProfileInfo(ProfileType profileType, Profile* p, const SETTINGS& s, const char* filename,
RuntimeInfo& pi) {
bool hasBbMajor = false, hasBbMinor = false;
pi.isBlackberry = false;
pi.hasLimitedResourceSize = false;
pi.isCldc10 = false;
pi.iconSize = "default";
int iconX = -1;
int iconY = -1;
if (profileType == DEVICE_BASED) {
ifstream file(filename);
setName(file, filename);
if (!file.good())
return false;
while (file.good()) {
string line;
getline(file, line);
if (line.find("#define MA_PROF_BUG_RESOURCE_SIZE_LIMITED") == 0) {
pi.hasLimitedResourceSize = true;
}
hasBbMajor |= parseIntProp(line, "MA_PROF_BLACKBERRY_VERSION",
pi.blackberryVersion);
hasBbMinor |= parseIntProp(line,
"MA_PROF_BLACKBERRY_VERSION_MINOR", pi.blackberryMinor);
if (line.find("#define MA_PROF_SUPPORT_CLDC_10") == 0) {
pi.isCldc10 = true;
}
parseIntProp(line, "MA_PROF_CONST_ICONSIZE_X", iconX);
parseIntProp(line, "MA_PROF_CONST_ICONSIZE_Y", iconY);
}
//pi.isBlackberry = (hasBbMajor && hasBbMinor); //rapc is not available.
} else {
Capability iconSize = p->getCapability("IconSize");
if (iconSize.getValue().length() > 0) {
pi.iconSize = iconSize.getValue().c_str();
}
pi.isBlackberry = p->getFamily() == "BlackBerry";
if (pi.isBlackberry) {
Capability major = p->getCapability("Version/Major");
Capability minor = p->getCapability("Version/Minor");
sscanf(major.getValue().c_str(), "%i", &pi.blackberryVersion);
sscanf(minor.getValue().c_str(), "%i", &pi.blackberryMinor);
}
Capability cldc = p->getCapability("CLDC");
pi.isCldc10 = (cldc.getValue() == "1.0");
}
if (iconX > 0 && iconY > 0) {
char buf[32];
sprintf(buf, "%ix%i", iconX, iconY);
pi.iconSize = buf;
}
return true;
}
示例15: get_cap
inline
Kobject_iface *
Obj_space_phys<SPACE>::lookup_local(Cap_index virt, L4_fpage::Rights *rights)
{
Entry *c = get_cap(virt);
if (EXPECT_FALSE(!c))
return 0;
Capability cap = *c;
if (rights)
*rights = L4_fpage::Rights(cap.rights());
return cap.obj();
}