java/String: add method ToString()
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 Max Kellermann <max.kellermann@gmail.com>
|
||||
* Copyright 2010-2019 Max Kellermann <max.kellermann@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace Java {
|
||||
@@ -69,6 +71,12 @@ namespace Java {
|
||||
char *buffer, size_t max_size) noexcept {
|
||||
return CopyTo(env, Get(), buffer, max_size);
|
||||
}
|
||||
|
||||
static std::string ToString(JNIEnv *env, jstring s) noexcept;
|
||||
|
||||
std::string ToString() const noexcept {
|
||||
return ToString(GetEnv(), Get());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user