DCL 3.7.4
Loading...
Searching...
No Matches
DocSyntax Class Reference

#include <DocSyntax.h>

Inheritance diagram for DocSyntax:
Object

Public Member Functions

 DocSyntax (const String &strLanguageTitle, const String &strExtensions)
virtual ~DocSyntax ()
bool load (const wchar_t *pszFileName)
bool isValidLanguage (const wchar_t *pszLanguageTitle)
bool isValidExtension (const wchar_t *pszFileExt) const
bool isDelimeter (wchar_t c) const
bool isQuotation (wchar_t c) const
bool isEscapeChar (wchar_t c) const
bool isLineComment (const wchar_t *pch, size_t nLength) const
bool isCommentOn (const wchar_t *pch, size_t nLength) const
bool isCommentChar (wchar_t c) const
bool isCommentOff (const wchar_t *pch, size_t nLength) const
bool isReservedWord (const wchar_t *pch, size_t nLength) const
const String & languageTitle () const
int tabWidth () const
Public Member Functions inherited from Object
virtual String toString () const
virtual void destroy ()
String className () const
bool isInstanceOf (const std::type_info &typeinfo) const
virtual const std::type_info & typeInfo () const

Protected Attributes

String __strLanguageTitle
StringArray __listFileExtensions
String __strDelimeters
String __strQuotations
String __strLineComment
String __strCommentOn
String __strCommentOff
String __strEscapeChars
bool __bCaseSensitive
int __nTabWidth
StringArray __listReservedWords

Friends

class DocParser

Additional Inherited Members

Protected Member Functions inherited from Object
virtual ~Object ()
 Object ()

Detailed Description

Definition at line 18 of file DocSyntax.h.

Constructor & Destructor Documentation

◆ DocSyntax()

__DCL_BEGIN_NAMESPACE DocSyntax::DocSyntax ( const String & strLanguageTitle,
const String & strExtensions )

Definition at line 18 of file DocSyntax.cpp.

19{
20 __strLanguageTitle = strLanguageTitle;
21 strExtensions.split(' ', __listFileExtensions);
22}
String __strLanguageTitle
Definition DocSyntax.h:21
StringArray __listFileExtensions
Definition DocSyntax.h:22

◆ ~DocSyntax()

DocSyntax::~DocSyntax ( )
virtual

Definition at line 24 of file DocSyntax.cpp.

25{
26 /*
27 debug
28 for(StringArray::Iterator it = __listReservedWords.begin();
29 it != __listReservedWords.end(); it++
30 ) {
31 TRACE1(L"|%ls|\n", (*it).cstr());
32 }
33 */
34}

Member Function Documentation

◆ isCommentChar()

bool DocSyntax::isCommentChar ( wchar_t c) const
inline

Definition at line 67 of file DocSyntax.h.

68{
69 return __strLineComment.indexOf(c) != (size_t)-1
70 || __strCommentOn.indexOf(c) != (size_t)-1
71 || __strCommentOff.indexOf(c) != (size_t)-1;
72}
String __strLineComment
Definition DocSyntax.h:26
String __strCommentOff
Definition DocSyntax.h:28
String __strCommentOn
Definition DocSyntax.h:27

◆ isCommentOff()

bool DocSyntax::isCommentOff ( const wchar_t * pch,
size_t nLength ) const

Definition at line 94 of file DocSyntax.cpp.

95{
96 if (nLength >= __strCommentOff.length()) {
97 return __strCommentOff.compare(pch + nLength - __strCommentOff.length(),
98 __strCommentOff.length()) == 0;
99 }
100
101 return false;
102}

◆ isCommentOn()

bool DocSyntax::isCommentOn ( const wchar_t * pch,
size_t nLength ) const

Definition at line 86 of file DocSyntax.cpp.

87{
88 if (nLength == __strCommentOn.length())
89 return __strCommentOn.compare(pch, nLength) == 0;
90
91 return false;
92}

◆ isDelimeter()

bool DocSyntax::isDelimeter ( wchar_t c) const
inline

Definition at line 57 of file DocSyntax.h.

58{
59 return __strDelimeters.indexOf(c) != (size_t)-1;
60}
String __strDelimeters
Definition DocSyntax.h:24

◆ isEscapeChar()

bool DocSyntax::isEscapeChar ( wchar_t c) const
inline

Definition at line 74 of file DocSyntax.h.

75{
76 return __strEscapeChars.indexOf(c) != (size_t)-1;
77}
String __strEscapeChars
Definition DocSyntax.h:29

◆ isLineComment()

bool DocSyntax::isLineComment ( const wchar_t * pch,
size_t nLength ) const

Definition at line 78 of file DocSyntax.cpp.

79{
80 if (nLength == __strLineComment.length())
81 return __strLineComment.compare(pch, nLength) == 0;
82
83 return false;
84}

◆ isQuotation()

bool DocSyntax::isQuotation ( wchar_t c) const
inline

Definition at line 62 of file DocSyntax.h.

63{
64 return __strQuotations.indexOf(c) != (size_t)-1;
65}
String __strQuotations
Definition DocSyntax.h:25

◆ isReservedWord()

bool DocSyntax::isReservedWord ( const wchar_t * pch,
size_t nLength ) const

Definition at line 104 of file DocSyntax.cpp.

105{
106 if (__bCaseSensitive) {
107 for(StringArray::ConstIterator it = __listReservedWords.begin();
108 it != __listReservedWords.end(); it++
109 ) {
110 if ((*it).length() == nLength
111 && (*it).compare(pch, nLength) == 0) {
112 return true;
113 }
114 }
115 }
116 else {
117 for(StringArray::ConstIterator it = __listReservedWords.begin();
118 it != __listReservedWords.end(); it++
119 ) {
120 if ((*it).length() == nLength
121 && (*it).compareNoCase(pch, nLength) == 0
122 ) {
123 return true;
124 }
125 }
126 }
127
128 return false;
129}
StringArray __listReservedWords
Definition DocSyntax.h:32
bool __bCaseSensitive
Definition DocSyntax.h:30

◆ isValidExtension()

bool DocSyntax::isValidExtension ( const wchar_t * pszFileExt) const

Definition at line 67 of file DocSyntax.cpp.

68{
69 for(StringArray::ConstIterator it = __listFileExtensions.begin();
70 it != __listFileExtensions.end(); it++
71 ) {
72 if (!((*it).compareNoCase(pszFileExt)))
73 return true;
74 }
75 return false;
76}

◆ isValidLanguage()

bool DocSyntax::isValidLanguage ( const wchar_t * pszLanguageTitle)
inline

Definition at line 84 of file DocSyntax.h.

85{
86 return __strLanguageTitle.compareNoCase(pszLanguageTitle) == 0;
87}

◆ languageTitle()

const String & DocSyntax::languageTitle ( ) const
inline

Definition at line 79 of file DocSyntax.h.

80{
81 return __strLanguageTitle;
82}

◆ load()

bool DocSyntax::load ( const wchar_t * pszFileName)

Definition at line 36 of file DocSyntax.cpp.

37{
38 try {
39 IniFile file(pszFileName);
40
41 __strDelimeters = file.getString(__strLanguageTitle, L"DELIMITER");
42 __strQuotations = file.getString(__strLanguageTitle, L"QUOTATION");
43 __strLineComment = file.getString(__strLanguageTitle, L"LINECOMMENT");
44 __strCommentOn = file.getString(__strLanguageTitle, L"COMMENTON");
45 __strCommentOff = file.getString(__strLanguageTitle, L"COMMENTOFF");
46 __strEscapeChars = file.getString(__strLanguageTitle, L"ESCAPE");
47 String strTemp = file.getString(__strLanguageTitle, L"CASE_SENSITIVE");
48 if (!strTemp.compareNoCase(L"true"))
49 __bCaseSensitive = true;
50 else
51 __bCaseSensitive = false;
52
53 __nTabWidth = file.getInteger(__strLanguageTitle, L"TAB_WIDTH", 0);
54 strTemp = file.getString(__strLanguageTitle, L"RESERVED_WORD");
55 strTemp.split(' ', __listReservedWords);
56
57 file.close();
58 }
59 catch (Exception* _e) {
60 __DCL_TRACE1(L"Syntax File Load Error : %ls\n", _e->toStringAll().data());
61 _e->destroy();
62 return false;
63 }
64 return true;
65}
#define __DCL_TRACE1(fmt, arg1)
Definition Object.h:399
int __nTabWidth
Definition DocSyntax.h:31
virtual void destroy()
Definition Exception.cpp:74
String toStringAll() const
Definition Exception.cpp:45

◆ tabWidth()

int DocSyntax::tabWidth ( ) const
inline

Definition at line 89 of file DocSyntax.h.

90{
91 return __nTabWidth;
92}

◆ DocParser

friend class DocParser
friend

Definition at line 34 of file DocSyntax.h.

Member Data Documentation

◆ __bCaseSensitive

bool DocSyntax::__bCaseSensitive
protected

Definition at line 30 of file DocSyntax.h.

◆ __listFileExtensions

StringArray DocSyntax::__listFileExtensions
protected

Definition at line 22 of file DocSyntax.h.

◆ __listReservedWords

StringArray DocSyntax::__listReservedWords
protected

Definition at line 32 of file DocSyntax.h.

◆ __nTabWidth

int DocSyntax::__nTabWidth
protected

Definition at line 31 of file DocSyntax.h.

◆ __strCommentOff

String DocSyntax::__strCommentOff
protected

Definition at line 28 of file DocSyntax.h.

◆ __strCommentOn

String DocSyntax::__strCommentOn
protected

Definition at line 27 of file DocSyntax.h.

◆ __strDelimeters

String DocSyntax::__strDelimeters
protected

Definition at line 24 of file DocSyntax.h.

◆ __strEscapeChars

String DocSyntax::__strEscapeChars
protected

Definition at line 29 of file DocSyntax.h.

◆ __strLanguageTitle

String DocSyntax::__strLanguageTitle
protected

Definition at line 21 of file DocSyntax.h.

◆ __strLineComment

String DocSyntax::__strLineComment
protected

Definition at line 26 of file DocSyntax.h.

◆ __strQuotations

String DocSyntax::__strQuotations
protected

Definition at line 25 of file DocSyntax.h.


The documentation for this class was generated from the following files: