axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Milinda Lakmal Pathirage (JIRA)" <j...@apache.org>
Subject [jira] Created: (AXIS2-1778) org.apache.axis2.wsdl.util.CUtils for C realted keyword checking
Date Tue, 28 Nov 2006 04:25:20 GMT
org.apache.axis2.wsdl.util.CUtils for C realted keyword checking
----------------------------------------------------------------

                 Key: AXIS2-1778
                 URL: http://issues.apache.org/jira/browse/AXIS2-1778
             Project: Apache Axis 2.0 (Axis2)
          Issue Type: New Feature
          Components: codegen
    Affects Versions: nightly
            Reporter: Milinda Lakmal Pathirage


This class is introduced to add methods to check C language specific key words.

package org.apache.axis2.wsdl.util;

import java.util.Arrays;
import java.util.Locale;
import java.text.Collator;

public class CUtils {

    static final String keywords[] =
            {
                    "auto", "double", "int", "struct",
                    "break", "else", "long", "switch",
                    "case", "enum", "register", "typedef",
                    "char", "extern", "return", "union",
                    "const", "float", "short", "unsigned",
                    "continue", "for", "signed", "void",
                    "default", "goto", "sizeof", "volatile",
                    "do", "if", "static", "while"
            };

    /**
     * Collator for comparing the strings
     */
    static final Collator englishCollator = Collator.getInstance(Locale.ENGLISH);

    /**
     * Use this character as suffix
     */
    static final char keywordPrefix = '_';


    /**
     * Checks if the input string is a valid C keyword.
     *
     * @return Returns boolean.
     */
    public static boolean isCKeyword(String keyword) {
        return (Arrays.binarySearch(keywords, keyword, englishCollator) >= 0);
    }

    /**
     * Turns a C keyword string into a non-C keyword string.  (Right now
     * this simply means appending an underscore.)
     */
    public static String makeNonCKeyword(String keyword) {
        return keywordPrefix + keyword;
    }


}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message