Merge pull request #826 from kugel-/doxygen-fixes2
[geany-mirror.git] / scintilla / src / ExternalLexer.h
bloba85213e31bec0397d7bebd1c93ddd4bb273c8cfc
1 // Scintilla source code edit control
2 /** @file ExternalLexer.h
3 ** Support external lexers in DLLs.
4 **/
5 // Copyright 2001 Simon Steele <ss@pnotepad.org>, portions copyright Neil Hodgson.
6 // The License.txt file describes the conditions under which this software may be distributed.
8 #ifndef EXTERNALLEXER_H
9 #define EXTERNALLEXER_H
11 #if PLAT_WIN
12 #define EXT_LEXER_DECL __stdcall
13 #else
14 #define EXT_LEXER_DECL
15 #endif
17 #ifdef SCI_NAMESPACE
18 namespace Scintilla {
19 #endif
21 typedef void*(EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index);
22 typedef int (EXT_LEXER_DECL *GetLexerCountFn)();
23 typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength);
24 typedef LexerFactoryFunction(EXT_LEXER_DECL *GetLexerFactoryFunction)(unsigned int Index);
26 /// Sub-class of LexerModule to use an external lexer.
27 class ExternalLexerModule : public LexerModule {
28 protected:
29 GetLexerFactoryFunction fneFactory;
30 std::string name;
31 public:
32 ExternalLexerModule(int language_, LexerFunction fnLexer_,
33 const char *languageName_=0, LexerFunction fnFolder_=0) :
34 LexerModule(language_, fnLexer_, 0, fnFolder_),
35 fneFactory(0), name(languageName_){
36 languageName = name.c_str();
38 virtual void SetExternal(GetLexerFactoryFunction fFactory, int index);
41 /// LexerMinder points to an ExternalLexerModule - so we don't leak them.
42 class LexerMinder {
43 public:
44 ExternalLexerModule *self;
45 LexerMinder *next;
48 /// LexerLibrary exists for every External Lexer DLL, contains LexerMinders.
49 class LexerLibrary {
50 DynamicLibrary *lib;
51 LexerMinder *first;
52 LexerMinder *last;
54 public:
55 explicit LexerLibrary(const char *ModuleName);
56 ~LexerLibrary();
57 void Release();
59 LexerLibrary *next;
60 std::string m_sModuleName;
63 /// LexerManager manages external lexers, contains LexerLibrarys.
64 class LexerManager {
65 public:
66 ~LexerManager();
68 static LexerManager *GetInstance();
69 static void DeleteInstance();
71 void Load(const char *path);
72 void Clear();
74 private:
75 LexerManager();
76 static LexerManager *theInstance;
78 void LoadLexerLibrary(const char *module);
79 LexerLibrary *first;
80 LexerLibrary *last;
83 class LMMinder {
84 public:
85 ~LMMinder();
88 #ifdef SCI_NAMESPACE
90 #endif
92 #endif