![]() ![]() |
![]() |
File: [Pegasus] / pegasus / src / Pegasus / Common / Attic / IndicationFormatter.h
(download)
Revision: 1.7, Tue May 20 17:36:11 2008 UTC (16 years, 1 month ago) by kumpf Branch: MAIN CVS Tags: TASK_PEP328_SOLARIS_NEVADA_PORT, TASK-PEP328_SOLARIS_NEVADA_PORT_v2-root, TASK-PEP328_SOLARIS_NEVADA_PORT_v2-branch, TASK-PEP328_SOLARIS_NEVADA_PORT-root, TASK-PEP328_SOLARIS_NEVADA_PORT-branch, TASK-PEP328_SOLARIS_IX86_CC_PORT-root, TASK-PEP328_SOLARIS_IX86_CC_PORT-branch-v2, TASK-PEP328_SOLARIS_IX86_CC_PORT-branch, TASK-PEP311_WSMan-root, TASK-PEP311_WSMan-branch, RELEASE_2_8_2-RC1, RELEASE_2_8_2, RELEASE_2_8_1-RC1, RELEASE_2_8_1, RELEASE_2_8_0_BETA, RELEASE_2_8_0-RC2, RELEASE_2_8_0-RC1, RELEASE_2_8_0-FC, RELEASE_2_8_0, RELEASE_2_8-root, RELEASE_2_8-branch, Makefile Changes since 1.6: +33 -99 lines BUG#: 7673 TITLE: Refactor IndicationFormatter DESCRIPTION: Remove the ICU dependency from IndicationFormatter.h. Refector to simplify the implementation and fix minor defects. |
//%2006//////////////////////////////////////////////////////////////////////// // // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; // IBM Corp.; EMC Corporation, The Open Group. // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; // EMC Corporation; VERITAS Software Corporation; The Open Group. // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; // EMC Corporation; Symantec Corporation; The Open Group. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // //============================================================================== // //%///////////////////////////////////////////////////////////////////////////// #ifndef Pegasus_IndicationFormatter_h #define Pegasus_IndicationFormatter_h #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Linkage.h> #include <Pegasus/Common/String.h> #include <Pegasus/Common/Array.h> #include <Pegasus/Common/CIMInstance.h> #include <Pegasus/Common/CIMClass.h> #include <Pegasus/Common/CIMValue.h> #include <Pegasus/Common/CIMPropertyList.h> #include <Pegasus/Common/ContentLanguageList.h> PEGASUS_NAMESPACE_BEGIN /** The IndicationFormatter class formats an indication message. */ class PEGASUS_COMMON_LINKAGE IndicationFormatter { public: /** Based on subscription instance, gets the formatted indication text message from the received indication instance. @param subscription the subscription instance @param indication the received indication instance @param contentLangs the Content-Languages in the subscription instance @return String containing the formatted indication text message */ static String getFormattedIndText( const CIMInstance& subscription, const CIMInstance& indication, const ContentLanguageList& contentLangs); /** Validates the syntax and the provided type for the property TextFormat in the instance. If the value of the property has a syntax error, or the provided type does not match the property type, an exception is thrown. This function is called by the _canCreate function, and is used to validate the syntax and the provided type for the property TextFormat in the Formatted Subscription instance. @param textFormatStr the string to be validated @param indicationClass the indication class @param textFormatParams the value of the TextFormatParameters @throw CIM_ERR_INVALID_PARAMETER if there is a syntax error for the value of property TextFormat or type mismatch */ static void validateTextFormat( const String& textFormatStr, const CIMClass& indicationClass, const Array<String>& textFormatParams); /** Validates the value of the property TextFormatParameters in the subscriptionInstance. If the property name in the TextFormatParameters is not the name contained in the select clause of the associated filter query in the filterInstance, an exception is thrown. @param propertyList the list of properties to be validated @param indicationClass the indication class @param textFormatParams the value of the property TextFormatParameters @throw CIM_ERR_INVALID_PARAMETER if the select clause of the filter query does not contain the provided property name */ static void validateTextFormatParameters( const CIMPropertyList& propertyList, const CIMClass& indicationClass, const Array<String>& textFormatParams); private: /** Gets a specified indication property value from an indication instance. @param propertyName The name of the property for which to get the value. @param arrayIndex The array index of the value to get, if the property has an array value. A value of PEG_NOT_FOUND indicates that all array values are requested. @param indication The indication from which to get the property value. @param contentLangs The language in which to encode the value. @return String containing property value */ static String _getIndPropertyValue( const String& propertyName, Uint32 arrayIndex, const CIMInstance& indication, const ContentLanguageList& contentLangs); /** Retrieves the array values contained by the specified CIMValue. @param value The CIMValue from which to get the array values. @param arrayIndex The array index for which to get the value. A value of PEG_NOT_FOUND indicates that all values are requested. @param contentLangs The language in which to encode the value. @return String containing array values contained by the CIMValue. */ static String _getArrayValues( const CIMValue& value, Uint32 arrayIndex, const ContentLanguageList& contentLangs); /** Parses an index value from a string. The string must represent an unsigned integer. Leading and trailing whitespace is ignored. @param indexStr The string from which to parse the index. @throw CIM_ERR_INVALID_PARAMETER If the string is improperly formatted. */ static Uint32 _parseIndex(const String& indexStr); /** Trims leading and trailing whitespace from a String. @param s The string from which to trim whitespace. */ static void _trim(String& s); /** Validates the provided property type string. If the provided property type does not match the type of the property, or the provided property type is not valid type, or the dynamic content with an array index refers to a non array type, an exception is thrown. This function is called by the _validatePropertySyntaxAndType function, and is used to validate the provided property type. @param indicationClass the indication class @param propertyParam the provided property @param propertyTypeStr the provided property type @param isArray indicates whether refers to an array type @throw CIM_ERR_INVALID_PARAMETER if the provided property type is unexpected */ static void _validatePropertyType( const CIMClass& indicationClass, const String& propertyParam, const String& propertyTypeStr, const Boolean& isArray); /** Constructs a default indication text message from the received indication instance. @param indication the received indication instance @param contentLangs the Content-Languages in the subscription instance @return String containing default indication text message */ static String _formatDefaultIndicationText( const CIMInstance& indication, const ContentLanguageList& contentLangs); /** Constructs a human readable indication text message from the specified indication textFormat, textFormatParams, and received indication instance. @param textFormat the specified indication textFormat @param textFormatParams the indexed array containing the names of properties defined in the select clause of the associated CIM_IndicationFilter Query @param indication the received indication instance @param contentLangs the Content-Languages in the subscription instance @return String containing a human readable indication text message */ static String _formatIndicationText( const String& textFormat, const Array<String>& textFormatParams, const CIMInstance& indication, const ContentLanguageList& contentLangs); }; PEGASUS_NAMESPACE_END #endif /* Pegasus_IndicationFormatter_h */
No CVS admin address has been configured |
Powered by ViewCVS 0.9.2 |