#   Copyright 2008 - 2010 Sun Microsystems, Inc.  All rights reserved.
#
#   The MySQL Connector/C++ is licensed under the terms of the GPL
#   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
#   MySQL Connectors. There are special exceptions to the terms and
#   conditions of the GPL as it is applied to this software, see the
#   FLOSS License Exception
#   <http://www.mysql.com/about/legal/licensing/foss-exception.html>.

# Regexps disabled by default. No need to escape regexp characters (like "(.)")
# in the part, there regexps disabled.
# rules applied in order they are defined
# (however currently regexp rules applied after constant rules)
#
#$regexp = enabled

#we don't need to call new for String. Following 2 doesn't work at the moment
= new String\(\)      =>
= new Properties\(\)  =>
= new HashMap()       =>
(\S+)\.getObject\(    => getObject($1,
BaseTestCase(?!\.h)          => BaseTestFixture
(?<=String)(\s+\w+)\s*=\s*NULL =>$1
(?<!\=|\!)\=\s*NULL              => \/*= NULL*\/
#DriverManager.getConnection\((\w+),\s*\)
catch\s*\(SQLException  => catch (sql::SQLException *
\bSQLException\b        => sql::SQLException
# Not really equal substitution. ...?
\bException\b           => std::exception *
# for string concatanation w/ constant 1st operand.
(?<!\+ )("[^"]+")\s*\+  => String( $1 ) +
(\w+)\.equals\(([^\)]+)\) => $1 == $2

(\w+)\s+instanceof\s+(\w+) => /* TODO: Check this --> */ dynamic_cast<$2>( $1 ) != NULL

#$regexp = disabled
# keywords
package   => namespace
import    => #include
class      => class
extends    => : public
abstract  =>
finally   =>
final     => const
private    => private
public    => public
protected => protected
static    => static

null      => NULL

# don't really need this, but safer to keep it. Or can get hardly catchable bug
this.    => this->

#inclusions
java.sql.Connection       => "cppconn/connection.h"
java.sql.DriverManager    => ACT:COMMENT
java.sql.PreparedStatement=> "cppconn/prepared_statement.h"
java.sql.ResultSet        => "cppconn/resultset.h"
java.sql.SQLException     => "cppconn/exception.h"
java.sql.Statement        => "cppconn/statement.h"
java.sql.DatabaseMetaData => "cppconn/metadata.h"
java.sql.ResultSetMetaData=> "cppconn/resultset_metadata.h"
java.sql.Types            => "cppconn/datatype.h"

junit.framework.TestCase  => "framework/framework.h"
java.io.BufferedOutputStream  => ACT:COMMENT
java.io.File            => ACT:COMMENT
java.io.FileOutputStream=> ACT:COMMENT
java.io.FilenameFilter  => ACT:COMMENT
java.io.IOException     => ACT:COMMENT
java.sql.Blob           => ACT:COMMENT
java.util.ArrayList     => ACT:COMMENT
java.util.Iterator      => ACT:COMMENT
java.util.List          => ACT:COMMENT
java.util.Locale        => ACT:COMMENT
java.util.Properties    => ACT:COMMENT
com.mysql.jdbc.NonRegisteringDriver  => ACT:COMMENT
com.mysql.jdbc.StringUtils    => ACT:COMMENT
java.io.BufferedInputStream   => ACT:COMMENT
java.io.ByteArrayOutputStream => ACT:COMMENT
java.io.FileInputStream       => ACT:COMMENT
java.io.InputStream           => ACT:COMMENT
java.util.StringTokenizer     => ACT:COMMENT

# not sure if this one needed "cppconn/resultset_metadata.h"


# data types
String    => String
boolean    => bool
StringBuffer  => String
void      => void
long      => long
int       => int
String[]  => List

# names
testsuite.BaseTestCase  =>  "../BaseTestFixture.h"
com.mysql.jdbc.compliance.common.BaseTestCase => "../BaseTestFixture.h"
testsuite.      => testsuite::
TestCase        => TestFixture::TestCase
isRunningOnJRockit  => ACT:COMMENT
isRunningOnJdk131   => ACT:COMMENT
conn.            => conn->
stmt.            => stmt->
pstmt.          => pstmt->
driver.          => driver->
rs.              => rs->
dbmd.           => dbmd->
createStatement().  => createStatement()->
# this one is for (connection).close. can be wrong
.close()        => ->close()
main            =>  ACT:DELETE
keySet().       =>
StringBuffer    =>  String
# unsigned is not keyword in java and thus can be used as variables name (and that happens is some test)
unsigned        =>  isUnsigned
.getMessage()   => ->what()
.getString(     => ->getString(
.substring(     => .substr(
.next()         => ->next()
Connection.TRANSACTION_NONE             => TRANSACTION_NONE
Connection.TRANSACTION_READ_COMMITTED   => TRANSACTION_READ_COMMITTED
Connection.TRANSACTION_READ_UNCOMMITTED => TRANSACTION_READ_UNCOMMITTED
Connection.TRANSACTION_REPEATABLE_READ  => TRANSACTION_REPEATABLE_READ
Connection.TRANSACTION_SERIALIZABLE     => TRANSACTION_SERIALIZABLE

DatabaseMetaData.bestRowTemporary       => sql::DatabaseMetaData::bestRowTemporary
DatabaseMetaData.bestRowTransaction     => sql::DatabaseMetaData::bestRowTransaction
DatabaseMetaData.bestRowSession         => sql::DatabaseMetaData::bestRowSession

ResultSet.TYPE_FORWARD_ONLY             => sql::ResultSet::TYPE_FORWARD_ONLY
ResultSet.TYPE_SCROLL_SENSITIVE         => sql::ResultSet::TYPE_SCROLL_SENSITIVE
ResultSet.TYPE_SCROLL_INSENSITIVE       => sql::ResultSet::TYPE_SCROLL_INSENSITIVE
ResultSet.CONCUR_READ_ONLY              => sql::ResultSet::CONCUR_READ_ONLY
ResultSet.CONCUR_UPDATABLE              => sql::ResultSet::CONCUR_UPDATABLE

TRANSACTION_NONE              => sql::TRANSACTION_NONE
TRANSACTION_READ_UNCOMMITTED  => sql::TRANSACTION_READ_UNCOMMITTED
TRANSACTION_READ_COMMITTED    => sql::TRANSACTION_READ_COMMITTED
TRANSACTION_REPEATABLE_READ   => sql::TRANSACTION_REPEATABLE_READ
TRANSACTION_SERIALIZABLE      => sql::TRANSACTION_SERIALIZABLE

Types.NULL            => sql::DataType::SQLNULL
Types.                => sql::DataType::

# methods, functions etc
System.out.println    => MESSAGE
indexOf               => find_first_of
.getMetaData()        => ->getMetaData()
.keySet().iterator()  => .begin()
# Have to think on introducing regexps here... and more sophisticated parsing
.hasNext()            => != /*TODO: */ !!CONTAINER_NAME!!.end()
.toString()           =>
#currently will miss one closing parenthesis
.setProperty          => .insert(Properties::value_type
.createStatement()    => ->createStatement()
.executeQuery()       => ->executeStatement
.clientPrepareStatement(  => ->prepareStatement
.nativeSQL(           => ->nativeSQL(
.isClosed()           => ->isClosed()
.getColumnCount()     => ->getColumnCount()
.getColumnName(       => ->getColumnName(
rsmd.                 => rsmd->
->getCatalogName      => ->getCatalogName
NULLPlusNonNullIsNull => nullPlusNonNullIsNull
NULLsAreSortedAtEnd   => nullsAreSortedAtEnd
NULLsAreSortedAtStart => nullsAreSortedAtStart
NULLsAreSortedHigh    => nullsAreSortedHigh
NULLsAreSortedLow     => nullsAreSortedLow

# tests related
com.mysql.jdbc.compliance.tests  => testsuite::compliance
com.mysql.jdbc.compliance.common=> testsuite::compliance
Connection            => Connection
List                  => List
Iterator              => Iterator
PreparedStatement      => PreparedStatement
ResultSet              => ResultSet
Statement              => Statement
com.mysql.jdbc.CharsetMapping => "resources.h"
Properties            => Properties
Object                => Object
File                  => File
fault(                => FAIL(
com.mysql.jdbc.ResultSetMetaData  => ResultSetMetaData
com.mysql.jdbc.Connection         => Connection
CharsetMapping.STATIC_CHARSET_TO_NUM_BYTES_MAP  => resources::CharsetMapping::Instance().GetMap()
ResultSetMetaData.column  => sql::ResultSetMetaData::column
# assertEquals overloaded in junit
#assertEquals          => ASSERT_EQUALS
super.                => super::
assertTrue            => ASSERT
