Blender  V2.93
BlenderStyleModule.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
23 #include "../stroke/StyleModule.h"
24 #include "../system/PythonInterpreter.h"
25 
26 #include "BLI_utildefines.h" // BLI_assert()
27 
28 struct Text;
29 
30 namespace Freestyle {
31 
33  public:
34  BufferedStyleModule(const string &buffer, const string &file_name, Interpreter *inter)
35  : StyleModule(file_name, inter)
36  {
37  _buffer = buffer;
38  }
39 
41  {
42  }
43 
44  protected:
45  virtual int interpret()
46  {
47  PythonInterpreter *py_inter = dynamic_cast<PythonInterpreter *>(_inter);
48  BLI_assert(py_inter != 0);
49  return py_inter->interpretString(_buffer, getFileName());
50  }
51 
52  private:
53  string _buffer;
54 
55 #ifdef WITH_CXX_GUARDEDALLOC
56  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BufferedStyleModule")
57 #endif
58 };
59 
61  public:
62  BlenderStyleModule(struct Text *text, const string &name, Interpreter *inter)
63  : StyleModule(name, inter)
64  {
65  _text = text;
66  }
67 
69  {
70  }
71 
72  protected:
73  virtual int interpret()
74  {
75  PythonInterpreter *py_inter = dynamic_cast<PythonInterpreter *>(_inter);
76  BLI_assert(py_inter != 0);
77  return py_inter->interpretText(_text, getFileName());
78  }
79 
80  private:
81  struct Text *_text;
82 
83 #ifdef WITH_CXX_GUARDEDALLOC
84  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BlenderStyleModule")
85 #endif
86 };
87 
88 } /* namespace Freestyle */
#define BLI_assert(a)
Definition: BLI_assert.h:58
BlenderStyleModule(struct Text *text, const string &name, Interpreter *inter)
BufferedStyleModule(const string &buffer, const string &file_name, Interpreter *inter)
int interpretString(const string &str, const string &name)
int interpretText(struct Text *text, const string &name)
const string getFileName() const
Definition: StyleModule.h:103
Interpreter * _inter
Definition: StyleModule.h:176
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
inherits from class Rep
Definition: AppCanvas.cpp:32