Qore Magic Module  0.0.2
qoremagic.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  libmagic Qore wrapper
4 
5  Qore Programming Language
6 
7  Copyright 2012 - 2013 Qore Technologies
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23 
24 
25 #ifndef QOREMAGIC_H
26 #define QOREMAGIC_H
27 
28 #include <magic.h>
29 
30 
31 DLLEXPORT extern qore_classid_t CID_MAGIC;
32 DLLLOCAL extern QoreClass* QC_MAGIC;
33 DLLLOCAL QoreClass *initMagicClass(QoreNamespace& ns);
34 
35 
36 class QoreMagic : public AbstractPrivateData {
37  protected:
38  DLLLOCAL virtual ~QoreMagic();
39 
40  public:
41  DLLLOCAL QoreMagic(ExceptionSink *xsink);
42  DLLLOCAL QoreMagic(int flags, ExceptionSink *xsink);
43 
44  DLLLOCAL void setFlags(int flags, ExceptionSink *xsink);
45 
46  DLLLOCAL AbstractQoreNode* file(const QoreStringNode *fileName, ExceptionSink *xsink);
47  DLLLOCAL AbstractQoreNode* file(const QoreStringNode *fileName, int flags, ExceptionSink *xsink);
48  DLLLOCAL AbstractQoreNode* buffer(const AbstractQoreNode *data, ExceptionSink *xsink);
49  DLLLOCAL AbstractQoreNode* buffer(const AbstractQoreNode *data, int flags, ExceptionSink *xsink);
50 
51  private:
52  int m_flags;
53  QoreThreadLock m_lock;
54 };
55 
56 #endif
57