crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianDebugLib/ValidationRules/DbgValidationManager.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 using System;
       
    18 using System.Collections.Generic;
       
    19 using System.Text;
       
    20 using System.Text.RegularExpressions;
       
    21 using SymbianUtils.PluginManager;
       
    22 using SymbianDebugLib.Engine;
       
    23 
       
    24 namespace SymbianDebugLib.ValidationRules
       
    25 {
       
    26     public class DbgValidationManager
       
    27     {
       
    28         #region Constructors
       
    29         internal DbgValidationManager( DbgEngine aEngine )
       
    30         {
       
    31             iEngine = aEngine;
       
    32             iRules.Load( new object[] { this } );
       
    33         }
       
    34         #endregion
       
    35 
       
    36         #region API
       
    37         public bool IsValid( DbgValidationRule.TOperation aOperation, out string aErrorDescription )
       
    38         {
       
    39             StringBuilder error = new StringBuilder();
       
    40             //
       
    41             bool ret = true;
       
    42             //
       
    43             foreach ( DbgValidationRule rule in iRules )
       
    44             {
       
    45                 string errorText = string.Empty;
       
    46                 //
       
    47                 bool valid = rule.IsValid( aOperation, ref errorText );
       
    48                 if ( !valid )
       
    49                 {
       
    50                     ret &= valid;
       
    51                     error.AppendLine( errorText );
       
    52                 }
       
    53             }
       
    54             //
       
    55             aErrorDescription = error.ToString();
       
    56             return ret;
       
    57         }
       
    58         #endregion
       
    59 
       
    60         #region Properties
       
    61         public DbgEngine Engine
       
    62         {
       
    63             get { return iEngine; }
       
    64         }
       
    65         #endregion
       
    66 
       
    67         #region Internal methods
       
    68         #endregion
       
    69 
       
    70         #region Data members
       
    71         private readonly DbgEngine iEngine;
       
    72         private PluginManager<DbgValidationRule> iRules = new PluginManager<DbgValidationRule>();
       
    73         #endregion
       
    74     }
       
    75 }