2011-07-20 10:33:24 +02:00
|
|
|
/**
|
|
|
|
*******************************************************************************
|
|
|
|
* @file HighlightPattern.h
|
|
|
|
* @brief Editeur De N'ours : Hightlight Patern (header)
|
|
|
|
* @author Edouard DUPIN
|
|
|
|
* @date 14/12/2010
|
|
|
|
* @par Project
|
|
|
|
* Edn
|
|
|
|
*
|
|
|
|
* @par Copyright
|
|
|
|
* Copyright 2010 Edouard DUPIN, all right reserved
|
|
|
|
*
|
|
|
|
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY.
|
|
|
|
*
|
|
|
|
* Licence summary :
|
|
|
|
* You can modify and redistribute the sources code and binaries.
|
|
|
|
* You can send me the bug-fix
|
|
|
|
* You can not earn money with this Software (if the source extract from Edn
|
|
|
|
* represent less than 50% of original Sources)
|
|
|
|
* Term of the licence in in the file licence.txt.
|
|
|
|
*
|
|
|
|
*******************************************************************************
|
|
|
|
*/
|
2011-07-29 10:44:12 +02:00
|
|
|
|
2012-01-11 15:26:53 +01:00
|
|
|
#include <Highlight.h>
|
2011-07-29 10:44:12 +02:00
|
|
|
|
2011-07-20 10:33:24 +02:00
|
|
|
#ifndef __HIGHLIGHT_PATTERN_H__
|
|
|
|
#define __HIGHLIGHT_PATTERN_H__
|
|
|
|
|
|
|
|
class HighlightPattern;
|
|
|
|
|
2012-01-11 15:26:53 +01:00
|
|
|
|
|
|
|
#include <etk/RegExp.h>
|
|
|
|
#include <Colorize.h>
|
2012-08-14 16:11:09 +02:00
|
|
|
#include <etk/Vector.h>
|
2012-01-11 15:26:53 +01:00
|
|
|
#include <tinyXML/tinyxml.h>
|
|
|
|
#include <EdnVectorBuf.h>
|
2011-07-20 10:33:24 +02:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
HLP_FIND_ERROR,
|
|
|
|
HLP_FIND_OK,
|
|
|
|
HLP_FIND_OK_NO_END,
|
|
|
|
}resultFind_te;
|
|
|
|
|
|
|
|
class HighlightPattern;
|
|
|
|
|
|
|
|
class HighlightPattern {
|
|
|
|
public:
|
|
|
|
// Constructeur
|
|
|
|
HighlightPattern(void);
|
|
|
|
~HighlightPattern(void);
|
|
|
|
|
2012-02-15 16:23:20 +01:00
|
|
|
void SetName(etk::UString &name) { m_paternName = name;};
|
|
|
|
etk::UString GetName(void) { return m_paternName;};
|
2011-07-20 10:33:24 +02:00
|
|
|
|
2012-02-15 16:23:20 +01:00
|
|
|
void SetPaternStart(etk::UString ®Exp);
|
|
|
|
void SetPaternStop(etk::UString ®Exp);
|
|
|
|
void SetColor(etk::UString &colorName);
|
|
|
|
void SetEscapeChar(etk::UString &EscapeChar);
|
2011-08-19 16:09:58 +02:00
|
|
|
void SetMultiline(bool enable) { m_multiline = enable; };
|
2011-07-20 10:33:24 +02:00
|
|
|
|
2011-08-19 16:09:58 +02:00
|
|
|
void SetLevel(int32_t newLevel) { m_level = newLevel; };
|
|
|
|
int32_t GetLevel(void) { return m_level; };
|
2011-07-20 10:33:24 +02:00
|
|
|
|
2011-08-19 16:09:58 +02:00
|
|
|
bool IsEnable(void);
|
|
|
|
void Display(void);
|
2011-08-08 10:24:24 +02:00
|
|
|
resultFind_te Find(int32_t start, int32_t stop, colorInformation_ts &resultat, EdnVectorBuf &buffer);
|
2011-08-19 16:09:58 +02:00
|
|
|
Colorize * GetColor(void) { return m_color; };
|
|
|
|
void ParseRules(TiXmlNode *child, int32_t level);
|
|
|
|
|
|
|
|
void ReloadColor(void);
|
2011-07-20 10:33:24 +02:00
|
|
|
|
|
|
|
private:
|
2012-08-09 14:26:30 +02:00
|
|
|
int32_t m_level; //!< Level of the pattern ==> this is to overwrite next pattern when we create an higher ....
|
|
|
|
etk::UString m_paternName; //!< Current style name (like "c++" or "c" or "script Bash")
|
|
|
|
etk::UString m_colorName; //!< Current color name
|
|
|
|
Colorize * m_color; //!< Link to the color manager
|
|
|
|
etk::RegExp<EdnVectorBuf> * m_regExpStart; //!< Start of Regular expression
|
|
|
|
etk::RegExp<EdnVectorBuf> * m_regExpStop; //!< Stop of Regular Expression
|
|
|
|
bool m_haveStopPatern; //!< Stop patern presence
|
|
|
|
bool m_multiline; //!< The patern is multiline
|
|
|
|
uniChar_t m_escapeChar; //!< Escape char to prevent exeit of patern ....
|
2012-08-14 16:11:09 +02:00
|
|
|
etk::Vector<HighlightPattern *> m_subPatern; //!< Under patern of this one
|
|
|
|
// etk::Vector<HighlightPattern *> m_subColor; //!< Under Color in the start RegExp ...
|
2011-07-20 10:33:24 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|