-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLexerFactory.cpp
53 lines (46 loc) · 1008 Bytes
/
LexerFactory.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "precompiled.h"
#pragma hdrstop
#include "LexerFactory.h"
LexerFactory::~LexerFactory()
{
}
Lexer *LexerFactory::MakeLexer(char const * const filename, int flags, bool OSPath)
{
return new Lexer(filename, flags | GetReadBinary() | GetWriteBinary(), OSPath);
}
Lexer *LexerFactory::MakeLexer(int flags)
{
return new Lexer(flags | GetReadBinary() | GetWriteBinary());
}
Lexer *LexerFactory::MakeLexer( char const * const ptr, int length, char const * const name, int flags)
{
return new Lexer(ptr, length, name, flags | GetWriteBinary() | GetReadBinary());
}
int LexerFactory::GetReadBinary()
{
if(cvarSystem->GetCVarBool("com_binaryRead"))
{
return LEXFL_READBINARY;
}
else
{
return 0;
}
}
int LexerFactory::GetWriteBinary()
{
int ret=0;
int writeBinary = cvarSystem->GetCVarInteger("com_binaryWrite");
switch(writeBinary)
{
case 0:
break;
case 1:
ret = LEXFL_WRITEBINARY;
break;
case 2:
ret = LEXFL_WRITEBINARY | LEXFL_BYTESWAP;
break;
}
return ret;
}