Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: src/common/chromeos/glib/object.h

Issue 603052: Add int32 converstion to G_TYPE_INT (Closed)
Patch Set: Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/common/chromeos/glib/object.h
diff --git a/src/common/chromeos/glib/object.h b/src/common/chromeos/glib/object.h
index 319e131ccd0d915e0489645722acb04feeba94f9..de96cc568b26f90278564e3e13e7c443c4c59d32 100644
--- a/src/common/chromeos/glib/object.h
+++ b/src/common/chromeos/glib/object.h
@@ -115,6 +115,11 @@ inline ::GType type_to_gtypeid< ::int64>() {
return G_TYPE_INT64;
};
+template < >
+inline ::GType type_to_gtypeid< ::int32>() {
+ return G_TYPE_INT;
+};
+
// \brief Value (and Retrieve) support using std::string as well as const char*
// by promoting from const char* to the string. promote_from provides a mapping
// for this promotion (and possibly others in the future).
@@ -158,11 +163,14 @@ template < >
inline ::uint8 RawCast< ::uint8>(const ::GValue& x) {
return static_cast< ::uint8>(::g_value_get_uchar(&x));
}
-
template < >
inline ::int64 RawCast< ::int64>(const ::GValue& x) {
return static_cast< ::int64>(::g_value_get_int64(&x));
}
+template < >
+inline ::int32 RawCast< ::int32>(const ::GValue& x) {
+ return static_cast< ::int32>(::g_value_get_int(&x));
+}
inline void RawSet(GValue* x, const std::string& v) {
::g_value_set_string(x, v.c_str());
@@ -185,6 +193,9 @@ inline void RawSet(GValue* x, ::uint8 v) {
inline void RawSet(GValue* x, ::int64 v) {
::g_value_set_int64(x, v);
}
+inline void RawSet(GValue* x, ::int32 v) {
+ ::g_value_set_int(x, v);
+}
// \brief Value is a data type for managing GValues.
//
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698