23 #ifdef MTEMPLATE_EXPORTS
24 #define MTEMPLATE_API __declspec(dllexport)
26 #define MTEMPLATE_API __declspec(dllimport)
30 #ifndef MTEMPLATE_EXPORTS
43 #define MThread uintptr_t
45 #define MThread pthread_t
56 #pragma warning(disable: 4251)
59 namespace MTemplateEngine {
103 std::string filename;
108 std::string getMd5Hash();
109 std::string getFilename();
111 void setUid(
int _uid);
112 void setMd5Hash(std::string _hash);
113 void setFilename(std::string _filename);
131 static MManager* getUniqueClass(
bool alloc =
true);
132 static void destroyUniqueClass(
void);
133 static MManager* allocateClass(
void);
134 static void destroyClass(
MManager*);
135 static void setIsMacBundle(
bool isMacBundle);
136 static void setPythonPath(
const std::string& _pythonPath);
137 static std::string getPythonPath();
138 static std::string getInterpreterModuleName();
139 static void initializePythonPath(
bool showPath=
false, std::string moduleName=std::string());
141 bool installTemplate(
MTemplate* templateClass);
143 MTemplate* getNextTemplate(
int previous_uid);
144 std::string resolveMappingToJob(
int template_id,
const char* key) ;
145 std::string resolveMappingToTemplate(
int template_id,
const char* key) ;
149 void acquirePython(
void);
150 void releasePython(
void);
151 std::string getPyExceptionStr();
155 void onPythonStdout(
const char* out);
156 void onPythonStderr(
const char* out);
157 void onPythonStderrFlush();
158 void onPythonStdoutFlush();
160 bool _installPyTemplate(
void* templateClass);
167 MTemplate* getTemplate(
const char* name);
168 MTemplate* getTemplateByFilename(
const char* filename);
171 void unloadTemplate(
int id);
172 int getTemplatesCount();
173 int getNextFreeUID();
176 void fillInternalHashesMap();
183 void sortListByField(
const std::string& field, std::list<MTemplate*>* list);
191 static bool _isMacBundle;
192 static bool pythonFromHere;
193 static std::map<MThread,void*> threadStates;
194 static void* mainThreadState;
196 static void* m_PyFormatException;
197 static void* m_pMainModule;
198 static void* m_pMainDict;
199 static std::string pythonPath;
200 static std::string interpreterModuleName;
201 static std::list<MTemplate*> gc;
204 std::string callbackContext;
208 const std::string field;
209 sortFunctor(
const std::string& field) : field(field) {}