File indexing completed on 2024-04-14 04:39:17

0001 # -*- coding: utf-8 -*-
0002 #     Copyright 2009-2010 Simon Edwards <simon@simonzone.com>
0003 #
0004 # This program is free software; you can redistribute it and/or modify
0005 # it under the terms of the GNU General Public License as published by
0006 # the Free Software Foundation; either version 2 of the License, or
0007 # (at your option) any later version.
0008 #
0009 # This program is distributed in the hope that it will be useful,
0010 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0011 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012 # GNU General Public License for more details.
0013 #
0014 # You should have received a copy of the GNU General Public License
0015 # along with this program; if not, write to the
0016 # Free Software Foundation, Inc.,
0017 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0018 
0019 import re
0020 
0021 __QtBareMacros = ["Q_OBJECT", "Q_GADGET", "Q_OBJECT_CHECK", "K_DCOP", "Q_CORE_EXPORT", "Q_INVOKABLE",
0022                     "QT_BEGIN_HEADER","QT_BEGIN_NAMESPACE", "QT_END_HEADER","QT_END_NAMESPACE"]
0023 
0024 def QtBareMacros(extraMacros=[]):
0025     macros = __QtBareMacros[:]
0026     macros.extend(extraMacros)
0027     return macros
0028     
0029 __QtMacros = [
0030         "Q_ENUMS", "Q_PROPERTY", "Q_OVERRIDE", "Q_SETS", "Q_CLASSINFO",\
0031         "Q_DECLARE_OPERATORS_FOR_FLAGS", "Q_PRIVATE_SLOT", "Q_FLAGS", \
0032         "Q_DECLARE_INTERFACE", "Q_DECLARE_METATYPE","KDE_DUMMY_COMPARISON_OPERATOR",\
0033         "Q_GADGET", "K_DECLARE_PRIVATE", "PHONON_ABSTRACTBASE", "PHONON_HEIR",\
0034         "PHONON_OBJECT", "Q_DECLARE_PRIVATE", "QT_BEGIN_HEADER", "QT_END_HEADER",\
0035         "Q_DECLARE_BUILTIN_METATYPE", "Q_OBJECT_CHECK", "Q_DECLARE_PRIVATE_MI",\
0036         "KDEUI_DECLARE_PRIVATE", "KPARTS_DECLARE_PRIVATE", "Q_INTERFACES",\
0037         '__attribute__', 'Q_DISABLE_COPY', 'K_SYCOCATYPE', 'Q_DECLARE_TR_FUNCTIONS',\
0038         'Q_DECLARE_TYPEINFO']
0039 
0040 
0041 def QtMacros(extraMacros=[]):
0042     macros = __QtMacros[:]
0043     macros.extend(extraMacros)
0044     return macros
0045 
0046 __QtPreprocessSubstitutionMacros = [
0047         ('Q_SLOTS','slots'),
0048         ('Q_SIGNALS','signals'),
0049         (re.compile(r'Q_DECLARE_FLAGS\((.*?),(.*?)\)',re.DOTALL),r'typedef QFlags<\2> \1;'),
0050         ("KDE_CONSTRUCTOR_DEPRECATED",""),
0051         ("KDE_DEPRECATED",""),
0052         ("QT_MOC_COMPAT",""),
0053         ("Q_SCRIPTABLE","")
0054         ]
0055 def QtPreprocessSubstitutionMacros(extraMacros=[]):
0056     macros = __QtPreprocessSubstitutionMacros[:]
0057     macros.extend(extraMacros)
0058     return macros
0059 
0060 def copyrightNotice():
0061     return """// Copyright 2011 Simon Edwards <simon@simonzone.com>
0062 
0063 //                 Generated by twine2
0064 
0065 // This program is free software; you can redistribute it and/or modify
0066 // it under the terms of the GNU Library General Public License as
0067 // published by the Free Software Foundation; either version 2, or
0068 // (at your option) any later version.
0069 
0070 // This program is distributed in the hope that it will be useful,
0071 // but WITHOUT ANY WARRANTY; without even the implied warranty of
0072 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0073 // GNU General Public License for more details
0074 
0075 // You should have received a copy of the GNU Library General Public
0076 // License along with this program; if not, write to the
0077 // Free Software Foundation, Inc.,
0078 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0079 """