edn/sources/appl/Highlight.h

96 lines
2.7 KiB
C
Raw Normal View History

/**
* @author Edouard DUPIN
2012-11-25 11:55:06 +01:00
*
* @copyright 2010, Edouard DUPIN, all right reserved
*
* @license GPL v3 (see license file)
*/
#ifndef __HIGHLIGHT_H__
#define __HIGHLIGHT_H__
2013-10-25 22:12:34 +02:00
namespace appl {
2013-10-23 21:19:30 +02:00
class Highlight;
class HighlightPattern;
2013-10-27 11:34:45 +01:00
class HighlightInfo {
2013-10-23 21:19:30 +02:00
public:
int32_t beginStart;
int32_t beginStop;
int32_t endStart;
int32_t endStop;
bool notEnded;
appl::HighlightPattern* patern; // pointer on class :
};
};
2012-11-01 10:47:36 +01:00
#include <etk/os/FSNode.h>
#include <appl/HighlightPattern.h>
#include <appl/GlyphPainting.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>
2013-10-25 22:12:34 +02:00
namespace appl {
class Highlight : public ewol::Resource {
private:
appl::GlyphPainting* m_paintingProperties;
protected:
2013-10-23 21:19:30 +02:00
// Constructeur
2013-11-14 21:57:10 +01:00
Highlight(const std::string& _xmlFilename, const std::string& _colorFile);
2013-10-23 21:19:30 +02:00
~Highlight(void);
2013-10-27 11:34:45 +01:00
private:
2013-11-14 21:57:10 +01:00
std::string m_typeName; //!< descriptive string type like "C/C++"
2013-10-27 11:34:45 +01:00
public:
2013-11-14 21:57:10 +01:00
const std::string& getTypeName(void) {
2013-10-27 11:34:45 +01:00
return m_typeName;
}
2013-10-25 22:12:34 +02:00
public:
2013-11-14 21:57:10 +01:00
bool hasExtention(const std::string& _ext);
bool fileNameCompatible(const std::string& _fileName);
2013-10-23 21:19:30 +02:00
void display(void);
void parse(int32_t _start,
int32_t _stop,
2013-11-14 21:57:10 +01:00
std::vector<appl::HighlightInfo> &_metaData,
2013-10-23 21:19:30 +02:00
int32_t _addingPos,
etk::Buffer &_buffer);
void parse2(int32_t _start,
int32_t _stop,
2013-11-14 21:57:10 +01:00
std::vector<appl::HighlightInfo> &_metaData,
2013-10-23 21:19:30 +02:00
etk::Buffer &_buffer);
private:
void parseRules(exml::Element* _child,
2013-11-14 21:57:10 +01:00
std::vector<HighlightPattern*> &_mListPatern,
2013-10-23 21:19:30 +02:00
int32_t _level);
2013-11-14 21:57:10 +01:00
std::string m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
std::vector<std::string> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
std::vector<HighlightPattern*> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer)
std::vector<HighlightPattern*> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) )
2013-10-25 22:12:34 +02:00
public:
/**
* @brief keep the resource pointer.
* @note Never free this pointer by your own...
* @param[in] _filename Name of the configuration file.
* @return pointer on the resource or NULL if an error occured.
*/
2013-11-14 21:57:10 +01:00
static appl::Highlight* keep(const std::string& _filename);
2013-10-25 22:12:34 +02:00
/**
* @brief release the keeped resources
* @param[in,out] reference on the object pointer
*/
static void release(appl::Highlight*& _object);
public: // herited function :
virtual void updateContext(void) {
// no upfate to do ...
};
2013-10-23 21:19:30 +02:00
};
};
#endif