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


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

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


在下文中一共展示了CIMKeyBinding::setName方法的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

WMIObjectPath::WMIObjectPath(const BSTR bstr)
{
    String str = WMIString(bstr);

    // autofit string
    str.remove(::wcslen((WCHAR *)((USHORT *) str.getChar16Data())));


    // <object_path> ::= \\<host>\<namespace>:<class>.<key>
    // <object_path> ::= \<namespace>:<class>.<key>
    // <object_path> ::= <class>.<key>
    // <object_path> ::= <class>

    Uint32         pos = 0;
    Uint32         len = 0;
    const Char16 * p = str.getChar16Data();

    // get namespace host (optional)
    if((p[pos] == '\\') && (p[pos + 1] == '\\'))
    {
        pos += 2;    // skip "\\\\"

        // WMI Mapper can act as proxy to get date from other windows
        // systems, The "." as system name represents localhost in WMI.
        // However, the parser was not expecting that. So, we ignore the
        // "." in order to ignore the hostname part so that it will be
        // considered a request to the localhost.
        if (p[pos]=='.')
            pos++;

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

        setHost(String(&p[pos - len], len));
    }

    // get namespace path (optional)
    if(p[pos] == '\\')
    {
        pos++;        // skip '\\'

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

        // change slashes
        String temp(String(&p[pos - len], len));

        for(Uint32 i = 0; i < temp.size(); i++)
        {
            if(temp[i] == '\\')
            {
                temp[i] = '/';
            }
        }
        setNameSpace(temp);
    }

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

    // get class name (required)

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

    setClassName(String(&p[pos - len], len));

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

    // get model key (optional)

    // <key> ::= <name> "=" <value> ["," <name> "=" <value>](0..n)
    //
    // <name> ::= alphabetic_character(1..n)
    // <value> ::= <string> | <number> | <boolean>
    // <string> ::= """ alphabetic_character | numeric_character |
    //                      symbol_character (1..n) """
    // <number> ::= numeric_character(1..n)
    // <boolean> ::= "true" | "false"

    while(p[pos] != Char16(0))
    {
        // get keys
        CIMKeyBinding key;

        // seek to '='
        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",
//.........这里部分代码省略.........
开发者ID:brunolauze,项目名称:pegasus,代码行数:101,代码来源:WMIObjectPath.cpp


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