core/com.nokia.carbide.cpp.codescanner/src/com/nokia/carbide/cpp/internal/codescanner/config/CSSeverity.java
changeset 0 fb279309251b
equal deleted inserted replaced
-1:000000000000 0:fb279309251b
       
     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 the License "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 
       
    18 package com.nokia.carbide.cpp.internal.codescanner.config;
       
    19 
       
    20 /**
       
    21  * Enumeration for all existing severity types of CodeScanner rules.
       
    22  *
       
    23  */
       
    24 public enum CSSeverity {
       
    25 	severity_high("high"),
       
    26 	severity_medium("medium"),
       
    27 	severity_low("low"),
       
    28 	severity_unknown("unknown");
       
    29 
       
    30 	private String name;
       
    31 	
       
    32 	/**
       
    33 	 * Constructor
       
    34 	 */
       
    35 	CSSeverity(String str) {
       
    36 		name = str;
       
    37 	}
       
    38 	
       
    39 	/**
       
    40 	 * Return the name of a CSSeverity enum constant.
       
    41 	 */
       
    42 	public String toString() {
       
    43 		return name;
       
    44 	}
       
    45 
       
    46 	/**
       
    47 	 * Return the CSSeverity enum constant with the specified name.
       
    48 	 * @param name - name of the constant to return
       
    49 	 * @return the CSSeverity enum constant with the specified name
       
    50 	 */
       
    51 	public static CSSeverity toSeverity(String name) {
       
    52         try {
       
    53             return valueOf(name);
       
    54         } 
       
    55         catch (Exception e) {
       
    56             return severity_unknown;
       
    57         }
       
    58 	}
       
    59 
       
    60 }