//++ ------------------------------------------------------------------------------------ // Details: Add to *this Out-of-band record additional information. // Type: Method. // Args: vMIValue - (R) A MI value derived object. // Return: MIstatus::success - Functional succeeded. // MIstatus::failure - Functional failed. // Throws: None. //-- bool CMICmnMIOutOfBandRecord::Add( const CMICmnMIValue & vMIValue ) { m_strAsyncRecord += ","; m_strAsyncRecord += vMIValue.GetString(); return MIstatus::success; }
//++ //------------------------------------------------------------------------------------ // Details: Build the MI value result string. // Type: Method. // Args: vrVariable - (R) MI value's name. // vrValue - (R) The MI value. // Return: None. // Throws: None. //-- void CMICmnMIValueResult::BuildResult(const CMIUtilString &vVariable, const CMICmnMIValue &vValue) { const char *pFormat = m_bUseSpacing ? "%s, %s %s %s" : "%s,%s%s%s"; m_strValue = CMIUtilString::Format( pFormat, m_strValue.c_str(), vVariable.c_str(), ms_constStrEqual.c_str(), vValue.GetString().c_str()); }
//++ ------------------------------------------------------------------------------------ // Details: Add another MI value object to the value list's of list is values. // Only values objects can be added to a list of values otherwise this function // will return MIstatus::failure. // Type: Method. // Args: vValue - (R) The MI value object. // Return: MIstatus::success - Functional succeeded. // MIstatus::failure - Functional failed. // Throws: None. //-- bool CMICmnMIValueList::BuildList( const CMICmnMIValue & vValue ) { // Clear out the default "<Invalid>" text if( m_bJustConstructed ) { m_bJustConstructed = false; m_strValue = vValue.GetString(); return BuildList(); } const MIchar * pFormat = "[%s,%s]"; m_strValue = m_strValue.FindAndReplace( "[", "" ); m_strValue = m_strValue.FindAndReplace( "]", "" ); m_strValue = CMIUtilString::Format( pFormat, m_strValue.c_str(), vValue.GetString().c_str() ); return MIstatus::success; }
//++ ------------------------------------------------------------------------------------ // Details: Add to *this result record additional information. // Type: Method. // Args: vMIValue - (R) A MI value derived object. // Return: MIstatus::success - Functional succeeded. // MIstatus::failure - Functional failed. // Throws: None. //-- bool CMICmnMIResultRecord::Add(const CMICmnMIValue &vMIValue) { m_strResultRecord += ","; m_strResultRecord += vMIValue.GetString(); return MIstatus::success; }
//++ //------------------------------------------------------------------------------------ // Details: Add another MI value object to the value list's of list is values. // Only values objects can be added to a list of values otherwise this // function // will return MIstatus::failure. // Type: Method. // Args: vValue - (R) The MI value object. // Return: None. // Throws: None. //-- void CMICmnMIValueList::BuildList(const CMICmnMIValue &vValue) { // Clear out the default "<Invalid>" text if (m_bJustConstructed) { m_bJustConstructed = false; m_strValue = vValue.GetString(); BuildList(); return; } // Remove already present '[' and ']' from the start and end m_strValue = m_strValue.Trim(); size_t len = m_strValue.size(); if ((len > 1) && (m_strValue[0] == '[') && (m_strValue[len - 1] == ']')) m_strValue = m_strValue.substr(1, len - 2); const char *pFormat = "[%s,%s]"; m_strValue = CMIUtilString::Format(pFormat, m_strValue.c_str(), vValue.GetString().c_str()); }
//++ //------------------------------------------------------------------------------------ // Details: CMICmnMIValueList constructor. // Construct a value only list. // Type: Method. // Args: vValue - (R) MI value object. // Return: None. // Throws: None. //-- CMICmnMIValueList::CMICmnMIValueList(const CMICmnMIValue &vValue) { m_strValue = vValue.GetString(); BuildList(); m_bJustConstructed = false; }
//++ ------------------------------------------------------------------------------------ // Details: Build the MI value result string. // Type: Method. // Args: vrVariable - (R) MI value's name. // vrValue - (R) The MI value. // Return: MIstatus::success - Functional succeeded. // MIstatus::failure - Functional failed. // Throws: None. //-- bool CMICmnMIValueResult::BuildResult(const CMIUtilString &vVariable, const CMICmnMIValue &vValue) { const MIchar *pFormat = m_bUseSpacing ? "%s, %s %s %s" : "%s,%s%s%s"; m_strValue = CMIUtilString::Format(pFormat, m_strValue.c_str(), vVariable.c_str(), ms_constStrEqual.c_str(), vValue.GetString().c_str()); return MIstatus::success; }