⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cimconfigcommand.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 5 页
字号:
            //            //  The cimconfig command has no non-option argument options            //            UnexpectedArgumentException e (options [i].Value ());             throw e;        }         else /* if (options [i].getType () == Optarg::FLAG) */        {            c = options [i].getopt () [0];            switch (c) 	    {                case OPTION_GET:                 {                    if (_operationType != OPERATION_TYPE_UNINITIALIZED)                    {                        //                        // More than one operation option was found                        //                        UnexpectedOptionException e (OPTION_GET);                        throw e;                    }                    if (options.isSet (OPTION_GET) > 1)                    {                        //                        // More than one get option was found                        //                        DuplicateOptionException e (OPTION_GET);                         throw e;                    }                    try                    {                        _propertyName = options [i].Value ();                    }                    catch (const InvalidNameException&)                    {                        throw InvalidOptionArgumentException(                            options[i].Value(), OPTION_GET);                    }                    _operationType = OPERATION_TYPE_GET;                    break;                }                case OPTION_SET:                 {                    if (_operationType != OPERATION_TYPE_UNINITIALIZED)                    {                        //                        // More than one operation option was found                        //                        UnexpectedOptionException e (OPTION_SET);                        throw e;                    }                    if (options.isSet (OPTION_SET) > 1)                    {                        //                        // More than one set option was found                        //                        DuplicateOptionException e (OPTION_SET);                         throw e;                    }                    _operationType = OPERATION_TYPE_SET;                    property = options [i].Value ();                    equalsIndex = property.find ('=');                    if ( equalsIndex == PEG_NOT_FOUND )                    {                        //                        // The property value was not specified                        //                        InvalidOptionArgumentException e (property,                            OPTION_SET);                        throw e;                    }                    try                    {                        _propertyName = CIMName (property.subString                            (0, equalsIndex));                    }                    catch (const InvalidNameException&)                    {                        throw InvalidOptionArgumentException(                            property, OPTION_SET);                    }                    _propertyValue = property.subString( equalsIndex + 1 );                    break;                }                case OPTION_UNSET:                 {                    if (_operationType != OPERATION_TYPE_UNINITIALIZED)                    {                        //                        // More than one operation option was found                        //                        UnexpectedOptionException e (OPTION_UNSET);                        throw e;                    }                    if (options.isSet (OPTION_UNSET) > 1)                    {                        //                        // More than one unset option was found                        //                        DuplicateOptionException e (OPTION_UNSET);                         throw e;                    }                    try                    {                        _propertyName = options [i].Value ();                    }                    catch (const InvalidNameException&)                    {                        throw InvalidOptionArgumentException(                            options[i].Value(), OPTION_UNSET);                    }                    _operationType = OPERATION_TYPE_UNSET;                    break;                }                case OPTION_LIST:                 {                    if (_operationType != OPERATION_TYPE_UNINITIALIZED)                    {                        //                        // More than one operation option was found                        //                        UnexpectedOptionException e (OPTION_LIST);                        throw e;                    }                    if (options.isSet (OPTION_LIST) > 1)                    {                        //                        // More than one list option was found                        //                        DuplicateOptionException e (OPTION_LIST);                         throw e;                    }                    _operationType = OPERATION_TYPE_LIST;                    break;                }                case OPTION_CURRENT_VALUE:                 {                    if (options.isSet (OPTION_CURRENT_VALUE) > 1)                    {                        //                        // More than one current value option was found                        //                        DuplicateOptionException e (OPTION_CURRENT_VALUE);                         throw e;                    }                    _currentValueSet = true;                    break;                }                case OPTION_PLANNED_VALUE:                 {                    if (options.isSet (OPTION_PLANNED_VALUE) > 1)                    {                        //                        // More than one planned value option was found                        //                        DuplicateOptionException e (OPTION_PLANNED_VALUE);                         throw e;                    }                    _plannedValueSet = true;                    break;                }                case OPTION_DEFAULT_VALUE:                 {                    if (options.isSet (OPTION_DEFAULT_VALUE) > 1)                    {                        //                        // More than one default value option was found                        //                        DuplicateOptionException e (OPTION_DEFAULT_VALUE);                         throw e;                    }                    _defaultValueSet = true;                    break;                }                //PEP#167 - 2 new cases added below for HELP and VERSION                case OPTION_HELP:                 {                    if (_operationType != OPERATION_TYPE_UNINITIALIZED)                    {                        //                        // More than one operation option was found                        //                        UnexpectedOptionException e (OPTION_HELP);                        throw e;                    }                    if (options.isSet (OPTION_HELP) > 1)                    {                        //                        // More than one list option was found                        //                        DuplicateOptionException e (OPTION_HELP);                         throw e;                    }                    _operationType = OPERATION_TYPE_HELP;                    break;                }                case OPTION_VERSION:                 {                    if (_operationType != OPERATION_TYPE_UNINITIALIZED)                    {                        //                        // More than one operation option was found                        //                        UnexpectedOptionException e (OPTION_VERSION);                        throw e;                    }                    if (options.isSet (OPTION_VERSION) > 1)                    {                        //                        // More than one list option was found                        //                        DuplicateOptionException e (OPTION_VERSION);                         throw e;                    }                    _operationType = OPERATION_TYPE_VERSION;                    break;                }#ifdef PEGASUS_OS_OS400                 // check for quiet option before processing the rest of the options		case OPTION_QUIET_VALUE:		{			_defaultQuietSet = true;			break;	        }     #endif                default:                    //                    // Should never get here                    //                    break;            }        }    }    if ( _operationType == OPERATION_TYPE_UNINITIALIZED )    {        //        // No operation type was specified; throw exception        // so that usage can be displayed.        //        //l10n change was missing and added while implementing PEP#167 changes        CommandFormatException e (localizeMessage(MSG_PATH,REQUIRED_ARGS_MISSING_KEY, REQUIRED_ARGS_MISSING));        throw e;    }    if ( ( _operationType != OPERATION_TYPE_GET ) && ( _defaultValueSet ) )    {        //        // An invalid option was encountered        //        InvalidOptionException e (OPTION_DEFAULT_VALUE);        throw e;    }    if (_operationType == OPERATION_TYPE_LIST)    {        if ( _currentValueSet && _plannedValueSet )        {            //            // An invalid option was encountered            //            InvalidOptionException e (OPTION_CURRENT_VALUE);            throw e;        }#ifdef PEGASUS_OS_OS400	if( _defaultQuietSet ){	    //            // An invalid option was encountered            //            InvalidOptionException e (OPTION_QUIET_VALUE);            throw e;	}#endif    }    else    {        //        // if no options specified for get, set or unset operations        // then set option as _currentValueSet        //        if ( !_currentValueSet && !_plannedValueSet && !_defaultValueSet )        {            _currentValueSet = true;        }    }}/**     Print message to the given stream*///void CIMConfigCommand::_printErrorMessage(//    CIMStatusCode code, //    const String&,//    ostream& errPrintWriter)//{////}/**    Executes the command and writes the results to the PrintWriters.*/Uint32 CIMConfigCommand::execute (    ostream& outPrintWriter,     ostream& errPrintWriter){    Boolean   connected     = false;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -