org.apache.tuscany.sca.cpp.tools.common
Class Utils

java.lang.Object
  extended byorg.apache.tuscany.sca.cpp.tools.common.Utils

public final class Utils
extends java.lang.Object

Static utility methods. Some of these methods are similar to the methods on java.lang.String except they are aware of C/C++ comments and string literals. TODO: Many of these methods would perform better using StringBuffer not String


Field Summary
static java.util.Set cPrimitives
           
static java.util.Set cTypeQualifiers
           
static java.lang.String whitespace
           
 
Method Summary
static void outputDebugString(java.lang.String line)
           
static void rude(java.lang.String reason)
          This method reports an error level problem
static void rude(java.lang.String reason, java.lang.String filename, int lineno, java.lang.String codefragment)
          Failed to parse the source code for some reason.
static boolean safeEquals(java.lang.Object o1, java.lang.Object o2)
          A better method than .equals() because it doesn't NullPointerException when one of the parameters is null.
static void screenMessage(java.lang.String msg)
          This method reports an error level problem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cPrimitives

public static final java.util.Set cPrimitives

cTypeQualifiers

public static final java.util.Set cTypeQualifiers

whitespace

public static final java.lang.String whitespace
See Also:
Constant Field Values
Method Detail

rude

public static void rude(java.lang.String reason,
                        java.lang.String filename,
                        int lineno,
                        java.lang.String codefragment)
                 throws ParsingException
Failed to parse the source code for some reason. This method prints out a suitably rude message, and then what? I haven't quite decided yet. TODO: Do something sensible here like throw an Exception which will give up on this file completely and tidy up the output file. It may be just too dangerous to try to carry on. But we need to fail in such a way that the build system knows that we've failed for this file and can build this file without trace.

Throws:
ParsingException

rude

public static void rude(java.lang.String reason)
                 throws ParsingException
This method reports an error level problem

Parameters:
reason - why we have an error level problem
Throws:
ParsingException

screenMessage

public static void screenMessage(java.lang.String msg)
This method reports an error level problem


safeEquals

public static boolean safeEquals(java.lang.Object o1,
                                 java.lang.Object o2)
A better method than .equals() because it doesn't NullPointerException when one of the parameters is null.


outputDebugString

public static void outputDebugString(java.lang.String line)


Copyright 2005 The Apache Software Foundation and Copyright IBM Corp. 2005 All Rights Reserved