Пример #1
0
void
MessageAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("MessageAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("text")) != 0)
        SetText(node->AsString());
    if((node = searchNode->GetNode("unicode")) != 0)
        SetUnicode(node->AsUnsignedCharVector());
    if((node = searchNode->GetNode("hasUnicode")) != 0)
        SetHasUnicode(node->AsBool());
    if((node = searchNode->GetNode("severity")) != 0)
    {
        // Allow enums to be int or string in the config file
        if(node->GetNodeType() == INT_NODE)
        {
            int ival = node->AsInt();
            if(ival >= 0 && ival < 5)
                SetSeverity(Severity(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            Severity value;
            if(Severity_FromString(node->AsString(), value))
                SetSeverity(value);
        }
    }
}
Пример #2
0
void P4ClientAPI::RunCmd( const char *cmd, ClientUser *ui, int argc, char * const *argv )
{
// #if P4APIVER_ID >= 513026
    // ClientApi::SetProg() was introduced in 2004.2
	client.SetProg( &prog );
// #endif

// #if P4APIVER_ID >= 513282
    // ClientApi::SetVersion() was introduced in 2005.2
	if( version.Length() )
		client.SetVersion( &version );
// #endif

    if( IsTag() )
		client.SetVar( "tag" );

    if( IsStreamsMode() && apiLevel >= 70 )
		client.SetVar( "enableStreams" );

    // If maxresults or maxscanrows is set, enforce them now
    if( maxResults  )	client.SetVar( "maxResults",  maxResults  );
    if( maxScanRows )	client.SetVar( "maxScanRows", maxScanRows );
    if( maxLockTime )	client.SetVar( "maxLockTime", maxLockTime );

//	client.SetBreak( &cb );
	client.SetArgv( argc, argv );
	client.Run( cmd, ui );

	// Have to request server2 protocol *after* a command has been run. I
	// don't know why, but that's the way it is.

    if ( ! IsCmdRun() )
    {
		StrPtr *pv = client.GetProtocol( "server2" );
		if ( pv )
			server2 = pv->Atoi();

		pv = client.GetProtocol( P4Tag::v_nocase );
		if ( pv ) 
			SetCaseFold();
	    
		pv = client.GetProtocol( P4Tag::v_unicode );
		if ( pv && pv->Atoi() )
			SetUnicode();
    }
    SetCmdRun();
}
Пример #3
0
/** 
 * 
 * Extracts details pertaining to a window
 * 
 * @param       WindowObj - Window data
 * @return      void
 * @exception   Nil
 * @see         Nil
 * @since       1.0
 */
void Window::ExtractWindowDetails( const HWND hWnd_i )
{
    // Set window handle
    SetHandle( hWnd_i );

    // Set thread id of window
    SetThreadId( ::GetWindowThreadProcessId( GetHandle(), 0 ));

    // Get class name of window
    TCHAR szBuffer[MAX_PATH] = { 0 };
    ::GetClassName( GetHandle(), szBuffer, MAX_PATH );
    GetClassName() = szBuffer;

    GetClass().cbSize = sizeof( GetClass() );
    GetClassInfoEx( AfxGetInstanceHandle(), szBuffer, &GetClass() );

    // Get window text if any
    InternalGetWindowText( GetHandle(), GetTitle().GetBufferSetLength( MAX_PATH ), MAX_PATH );
    GetTitle().ReleaseBuffer();

    // Get normal style
    SetStyle( GetWindowLong( GetHandle(), GWL_STYLE ));

    // Get extended style
    SetStyleEx( GetWindowLong( GetHandle(), GWL_EXSTYLE ));

    // Get window id
    SetId( GetWindowLong( GetHandle(), GWL_ID ));

    // Get parent window
    SetParentHandle( RCAST( HWND, GetWindowLong( GetHandle(), GWL_HWNDPARENT )));

    // Window state i.e. window is maximized, minimized or restored
    GetStateAsString( GetState() );

    // For style parsing
    RetrieveWndStyles();

    // Window bounds
    CRect crBounds;
    GetWindowRect( GetHandle(), &crBounds );
    if( crBounds.Width() || crBounds.Height() )
    {
        GetBounds().Format( _T( "L:%d T:%d R:%d B:%d" ), crBounds.left, 
                                                         crBounds.top, 
                                                         crBounds.right, 
                                                         crBounds.bottom );
    }// End if

    // Retrieves unicode support status for windows
    SetUnicode( IsWindowUnicode( GetHandle() ));

    // Get window icon
    DWORD dwResult = 0;
    Utils::SndMsgTimeOutHelper( GetHandle(), 
                                WM_GETICON, 
                                ICON_SMALL, 
                                0,
                                dwResult );
    // Get window icon
    SetIcon( RCAST( HICON, dwResult ));

    // Get enabled status of window
    SetEnabled( IsWindowEnabled( GetHandle() ));
}// End ExtractWindowDetails