2011-07-20 10:33:24 +02:00
/**
* @ author Edouard DUPIN
2012-11-25 11:55:06 +01:00
*
* @ copyright 2010 , Edouard DUPIN , all right reserved
*
* @ license GPL v3 ( see license file )
2011-07-20 10:33:24 +02:00
*/
# ifndef __HIGHLIGHT_H__
# define __HIGHLIGHT_H__
class Highlight ;
class HighlightPattern ;
extern " C " {
2013-10-09 22:00:24 +02:00
typedef struct {
int32_t beginStart ;
int32_t beginStop ;
int32_t endStart ;
int32_t endStop ;
bool notEnded ;
HighlightPattern * patern ; // pointer on class :
2011-07-20 10:33:24 +02:00
} colorInformation_ts ;
}
2012-11-01 10:47:36 +01:00
# include <etk/os/FSNode.h>
2012-01-11 15:26:53 +01:00
# include <HighlightPattern.h>
# include <Colorize.h>
2012-11-19 22:45:55 +01:00
# include <etk/Buffer.h>
2013-06-24 21:17:45 +02:00
# include <exml/exml.h>
2011-07-20 10:33:24 +02:00
class Highlight {
public :
// Constructeur
2013-06-24 21:17:45 +02:00
Highlight ( const etk : : UString & _xmlFilename ) ;
2011-07-20 10:33:24 +02:00
~ Highlight ( void ) ;
2013-10-07 22:04:21 +02:00
bool hasExtention ( const etk : : UString & _ext ) ;
bool fileNameCompatible ( etk : : FSNode & _fileName ) ;
void display ( void ) ;
2013-10-09 22:00:24 +02:00
void reloadColor ( void ) ;
void parse ( int32_t start ,
2011-08-08 10:24:24 +02:00
int32_t stop ,
2012-08-14 16:11:09 +02:00
etk : : Vector < colorInformation_ts > & metaData ,
2011-08-08 10:24:24 +02:00
int32_t addingPos ,
2012-11-19 22:45:55 +01:00
etk : : Buffer & buffer ) ;
2013-10-09 22:00:24 +02:00
void parse2 ( int32_t start ,
2011-08-08 10:24:24 +02:00
int32_t stop ,
2012-08-14 16:11:09 +02:00
etk : : Vector < colorInformation_ts > & metaData ,
2012-11-19 22:45:55 +01:00
etk : : Buffer & buffer ) ;
2011-07-20 10:33:24 +02:00
private :
2013-10-09 22:00:24 +02:00
void parseRules ( exml : : Element * child , etk : : Vector < HighlightPattern * > & mListPatern , int32_t level ) ;
2013-06-26 23:48:23 +02:00
etk : : UString m_styleName ; //!< curent style name (like "c++" or "c" or "script Bash")
etk : : Vector < etk : : UString > m_listExtentions ; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
2013-10-07 22:04:21 +02:00
etk : : Vector < HighlightPattern * > m_listHighlightPass1 ; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer)
etk : : Vector < HighlightPattern * > m_listHighlightPass2 ; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) )
2011-07-20 10:33:24 +02:00
} ;
# endif