3 Copyright (c) 2012 Jakob Leben & Tim Blechmann
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef SCIDE_CORE_SC_INTROSPECTION_HPP_INCLUDED
22 #define SCIDE_CORE_SC_INTROSPECTION_HPP_INCLUDED
28 #include <QSharedPointer>
35 #include <boost/flyweight.hpp>
38 static inline std::size_t hash_value(QString
const& b
)
45 namespace ScLanguage
{
47 typedef boost::flyweight
<QString
> FlyweightString
;
49 typedef std::map
<QString
, QSharedPointer
<class Class
> > ClassMap
;
50 typedef std::multimap
<QString
, QSharedPointer
<class Method
> > MethodMap
;
51 typedef QVector
<class Argument
> ArgumentVector
;
52 typedef QVector
<class Method
*> MethodVector
;
56 FlyweightString defaultValue
;
73 ArgumentVector arguments
;
86 typedef QMap
< QString
, QList
<Method
*> > ClassMethodMap
; // maps Path to List of Methods
88 bool parse(const QString
& yamlString
);
90 const ClassMap
& classMap() const { return mClassMap
; }
91 const MethodMap
& methodMap() const { return mMethodMap
; }
93 const Class
* findClass( QString
const & className
) const;
94 ClassMethodMap
constructMethodMap( const Class
* klass
) const;
95 ClassMethodMap
constructMethodMap( QString
const & className
) const
97 return constructMethodMap(findClass(className
));
100 QString
const & classLibraryPath() const
102 return mClassLibraryPath
;
105 // remove class library path, userExtensionDir and systemExtensionDir
106 QString
compactLibraryPath(QString
const & path
) const;
109 void inferClassLibraryPath();
115 mClassLibraryPath
.clear();
119 MethodMap mMethodMap
;
120 QString mClassLibraryPath
;
121 QString mUserExtensionDir
;
122 QString mSystemExtensionDir
;
125 } // namespace ScLanguage
129 Q_DECLARE_METATYPE(ScIDE::ScLanguage::Class
*)
130 Q_DECLARE_METATYPE(const ScIDE::ScLanguage::Method
*)
132 #endif // SCIDE_CORE_SC_INTROSPECTION_HPP_INCLUDED