当前位置: 首页>>代码示例>>C++>>正文


C++ CIMKeyBinding::setValue方法代码示例

本文整理汇总了C++中CIMKeyBinding::setValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CIMKeyBinding::setValue方法的具体用法?C++ CIMKeyBinding::setValue怎么用?C++ CIMKeyBinding::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CIMKeyBinding的用法示例。


在下文中一共展示了CIMKeyBinding::setValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getPropertiesFromCIMServer

void getPropertiesFromCIMServer(
    CIMClient& client,
    const CIMName& propName,
    Array <String>& propValues)
{
    CIMProperty prop;

    Array<CIMKeyBinding> kbArray;
    CIMKeyBinding        kb;
    String               _hostName;

    kb.setName(PROPERTY_NAME);
    kb.setValue(propName.getString());
    kb.setType(CIMKeyBinding::STRING);

    _hostName.assign(System::getHostName());

    kbArray.append(kb);

    CIMObjectPath reference(_hostName, PEGASUS_NAMESPACENAME_CONFIG,
                            PEGASUS_CLASSNAME_CONFIGSETTING, kbArray);

    CIMInstance cimInstance = client.getInstance(PEGASUS_NAMESPACENAME_CONFIG,
                                                 reference);

    Uint32 pos = cimInstance.findProperty(PROPERTY_NAME);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

    pos = cimInstance.findProperty(DEFAULT_VALUE);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

    pos = cimInstance.findProperty(CURRENT_VALUE);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

    pos = cimInstance.findProperty(PLANNED_VALUE);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

    pos = cimInstance.findProperty(DYNAMIC_PROPERTY);
    prop = (CIMProperty)cimInstance.getProperty(pos);
    propValues.append(prop.getValue().toString());

}
开发者ID:rdobson,项目名称:openpegasus,代码行数:46,代码来源:TestAggregationOutputClient.cpp

示例2: temp


//.........这里部分代码省略.........
        for(len = 0; (p[pos] != Char16(0)) && (p[pos] != '='); len++, pos++);

        key.setName(String(&p[pos - len], len));

        p[pos] == '=' ? pos++ : 0;     // skip '='

        // A string value may be enclosed in single quotes or double quotes
        if ((p[pos] == '\"') || (p[pos] == '\''))
        {
            char openingQuote = p[pos];

            // parse string value

            // check for embedded quotes. for example,
            // class1.property1A="class2.property2A="2A",
            // property2B="2B"",property2A="foo"
            // or class1.property1A=",",property2A="."

            bool quote = false;

            // seek to closing quote or eos

            for(len = 0;
                (p[pos] != Char16(0)) && !((p[pos] == ',') && (!quote));
                len++, pos++)
            {
                quote = (p[pos] == openingQuote) ? !quote : quote;

                // By Jair - check if it is not an 'internal' quote.
                // If it is, must be discarded in this case.
                if (!quote && len) quote = (p[pos - 1] == '\\');
            }

            // strip outer quotes
            String temp(&p[pos - len], len);
            if((temp.size() != 0) && (temp[0] == openingQuote) &&
                (temp[temp.size() - 1] == openingQuote))
            {
                temp.remove(temp.size() - 1, 1);
                temp.remove(0, 1);
            }

            // remove escape sequences (the parent class will
            //put them back later).
            for(Uint32 i = 0; i < temp.size(); i++)
            {
                if((temp[i] == '\\') &&
                   ((temp[i + 1] == '\\') ||
                    (temp[i + 1] == '"')  ||
                    (temp[i + 1] == '\n') ||
                    (temp[i + 1] == '\r') ||
                    (temp[i + 1] == '\t')))
                {
                    temp.remove(i, 1);
                }
            }

            key.setValue(temp);
            key.setType(CIMKeyBinding::STRING);
        }
        else if((p[pos] == 't') || (p[pos] == 'T') ||
            (p[pos] == 'f') || (p[pos] == 'F'))
        {
            // parse boolean value

            // seek to ',' or eos
            for(len = 0; (p[pos] != Char16(0)) && (p[pos] != ',');
                len++, pos++);

            key.setValue(String(&p[pos - len], len));

            key.setType(CIMKeyBinding::BOOLEAN);
        }
        else if(std::isdigit<wchar_t>(p[pos], std::locale()))
        {
            // parse numeric value

            // seek to ',' or eos
            for(len = 0; (p[pos] != Char16(0)) && (p[pos] != ',');
                len++, pos++);

            key.setValue(String(&p[pos - len], len));

            key.setType(CIMKeyBinding::NUMERIC);
        }
        else
        {
            throw(std::invalid_argument("unrecognized key type"));
        }

        // update key list
        Array<CIMKeyBinding> keySet = getKeyBindings();

        keySet.append(key);

        setKeyBindings(keySet);

        p[pos] == ',' ? pos++ : 0;     // skip ','
    }
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:101,代码来源:WMIObjectPath.cpp


注:本文中的CIMKeyBinding::setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。