/* * mooutils-cpp.h * * Copyright (C) 2004-2015 by Yevgen Muntyan * * This file is part of medit. medit is free software; you can * redistribute it and/or modify it under the terms of the * GNU Lesser General Public License as published by the * Free Software Foundation; either version 2.1 of the License, * or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public * License along with medit. If not, see . */ #pragma once template inline T *moo_object_ref(T *obj) { return static_cast(g_object_ref(obj)); } #define MOO_DEFINE_FLAGS(Flags) \ inline Flags operator | (Flags f1, Flags f2) { return static_cast(static_cast(f1) | f2); } \ inline Flags operator & (Flags f1, Flags f2) { return static_cast(static_cast(f1) & f2); } \ inline Flags& operator |= (Flags& f1, Flags f2) { f1 = f1 | f2; return f1; } \ inline Flags& operator &= (Flags& f1, Flags f2) { f1 = f1 & f2; return f1; } \ inline Flags operator ~ (Flags f) { return static_cast(~static_cast(f)); } \