Initial subversion import.

The following lines are to recognize contributions made before the switch
to Subversion.

Patch by: bruce, jgw, scottb, mmendez, ecc, hcc, knorton, haeberling, samgross, mat.gessel


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/jni/mac/JStringWrap.h b/jni/mac/JStringWrap.h
new file mode 100644
index 0000000..2bb5c35
--- /dev/null
+++ b/jni/mac/JStringWrap.h
@@ -0,0 +1,23 @@
+// Copyright 2005 Google Inc.
+// All Rights Reserved.
+
+#ifndef JSTRINGWRAP_H
+#define JSTRINGWRAP_H
+
+#include <jni.h>
+
+struct JStringWrap
+{
+    JStringWrap(JNIEnv* env, jstring str): env(env), s(str), p(0), jp(0) { }
+    ~JStringWrap() { if (p) env->ReleaseStringUTFChars(s, p); if (jp) env->ReleaseStringChars(s, jp); }
+    const char* str() { if (!p) p = env->GetStringUTFChars(s, 0); return p; }
+    const jchar* jstr() { if (!jp) jp = env->GetStringChars(s, 0); return jp; }
+	jsize length() { return env->GetStringLength(s); }
+private:
+    JNIEnv* env;
+    jstring s;
+    const char* p;
+    const jchar* jp;
+};
+
+#endif