[gjs: 4/8] jsapi-util: use const operator getters
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 4/8] jsapi-util: use const operator getters
- Date: Wed, 10 Oct 2018 05:44:11 +0000 (UTC)
commit a62e7d67c28575f83dae976f80392893ef1068a0
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue Oct 9 05:53:35 2018 +0200
jsapi-util: use const operator getters
gjs/jsapi-util.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index c48b35df..95aa5a0f 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -43,7 +43,7 @@ class GjsAutoChar : public std::unique_ptr<char, decltype(&g_free)> {
public:
GjsAutoChar(char *str = nullptr) : unique_ptr(str, g_free) {}
- operator const char *() {
+ operator const char *() const {
return get();
}
@@ -61,7 +61,7 @@ class GjsAutoUnref : public std::unique_ptr<T, decltype(&g_object_unref)> {
public:
GjsAutoUnref(T *ptr = nullptr) : GjsAutoUnref::unique_ptr(ptr, g_object_unref) {}
- operator T *() {
+ operator T *() const {
return GjsAutoUnref::unique_ptr::get();
}
};
@@ -71,7 +71,7 @@ class GjsAutoInfo : public std::unique_ptr<T, decltype(&g_base_info_unref)> {
public:
GjsAutoInfo(T *ptr = nullptr) : GjsAutoInfo::unique_ptr(ptr, g_base_info_unref) {}
- operator T *() { return GjsAutoInfo::unique_ptr::get(); }
+ operator T *() const { return GjsAutoInfo::unique_ptr::get(); }
const char *name(void) const { return g_base_info_get_name(this->get()); }
GIInfoType type(void) const { return g_base_info_get_type(this->get()); }
@@ -94,7 +94,7 @@ class GjsAutoParam
GjsAutoParam(GParamSpec* ptr, const TakeOwnership&)
: GjsAutoParam(ptr ? g_param_spec_ref(ptr) : nullptr) {}
- operator GParamSpec*() { return get(); }
+ operator GParamSpec*() const { return get(); }
};
/* For use of GjsAutoParam in GC hash maps */
@@ -113,7 +113,7 @@ class GjsAutoJSChar : public std::unique_ptr<char, GjsJSFreeArgs> {
public:
GjsAutoJSChar(char *str = nullptr) : unique_ptr(str, GjsJSFreeArgs()) { }
- operator const char*() {
+ operator const char*() const {
return get();
}
@@ -121,7 +121,7 @@ public:
reset(str);
}
- char* copy() {
+ char* copy() const {
/* Strings acquired by this should be g_free()'ed */
return g_strdup(get());
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]