diff --git a/sources/appl/Buffer.cpp b/sources/appl/Buffer.cpp index da176c6..8e94bdd 100644 --- a/sources/appl/Buffer.cpp +++ b/sources/appl/Buffer.cpp @@ -50,7 +50,7 @@ appl::Buffer::Iterator& appl::Buffer::Iterator::operator-- (void) { return *this; } -etk::UChar appl::Buffer::Iterator::operator* (void) { +char32_t appl::Buffer::Iterator::operator* (void) { if (m_value != etk::UChar::Null) { return m_value; } @@ -71,7 +71,7 @@ etk::UChar appl::Buffer::Iterator::operator* (void) { tmpVal[iii] = m_data->m_data[m_current+iii]; } // transform ... - m_value.setUtf8(tmpVal); + m_value = etk::setUtf8(tmpVal); return m_value; } @@ -119,7 +119,7 @@ appl::Buffer::~Buffer(void) { } } -bool appl::Buffer::loadFile(const etk::UString& _name) { +bool appl::Buffer::loadFile(const std::string& _name) { APPL_DEBUG("Load file : '" << _name << "'"); m_fileName = _name; m_isModify = true; @@ -139,7 +139,7 @@ bool appl::Buffer::loadFile(const etk::UString& _name) { return false; } -void appl::Buffer::setFileName(const etk::UString& _name) { +void appl::Buffer::setFileName(const std::string& _name) { if (m_fileName == _name) { return; } @@ -199,9 +199,9 @@ appl::Buffer::Iterator appl::Buffer::getEndLine(const appl::Buffer::Iterator& _p } -bool appl::Buffer::search(const appl::Buffer::Iterator& _pos, const etk::UChar& _search, appl::Buffer::Iterator& _result) { +bool appl::Buffer::search(const appl::Buffer::Iterator& _pos, const char32_t& _search, appl::Buffer::Iterator& _result) { // move in the string - etk::UChar value; + char32_t value; for (Iterator it = _pos; (bool)it == true; ++it) { @@ -214,9 +214,9 @@ bool appl::Buffer::search(const appl::Buffer::Iterator& _pos, const etk::UChar& return false; } -bool appl::Buffer::searchBack(const appl::Buffer::Iterator& _pos, const etk::UChar& _search, appl::Buffer::Iterator& _result) { +bool appl::Buffer::searchBack(const appl::Buffer::Iterator& _pos, const char32_t& _search, appl::Buffer::Iterator& _result) { // move in the string - etk::UChar value; + char32_t value; for (Iterator it = _pos - 1; (bool)it == true; --it) { @@ -255,7 +255,7 @@ void appl::Buffer::moveCursor(esize_t _pos) { bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos, appl::Buffer::Iterator &_beginPos, appl::Buffer::Iterator &_endPos) { - etk::UChar currentValue = *position(_startPos); + char32_t currentValue = *position(_startPos); _beginPos = begin(); _endPos = end(); if ( currentValue == etk::UChar::Tabulation @@ -284,7 +284,7 @@ bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos, } } return true; - } else if( false == currentValue.isSpecialChar()){ + } else if( false == etk::isSpecialChar(currentValue)){ APPL_DEBUG("select normal Char"); // Search back for (Iterator it = --position(_startPos); @@ -292,7 +292,7 @@ bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos, --it) { currentValue = *it; if ( currentValue != '_' - && true == currentValue.isSpecialChar()) { + && true == etk::isSpecialChar(currentValue)) { _beginPos = ++it; break; } @@ -303,7 +303,7 @@ bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos, ++it) { currentValue = *it; if ( currentValue != '_' - && true == currentValue.isSpecialChar()) { + && true == etk::isSpecialChar(currentValue)) { _endPos = it; break; } @@ -311,7 +311,7 @@ bool appl::Buffer::getPosAround(const appl::Buffer::Iterator& _startPos, return true; } else { APPL_DEBUG("select same char"); - etk::UChar comparechar = currentValue; + char32_t comparechar = currentValue; // Search back for (Iterator it = --position(_startPos); (bool)it == true; @@ -353,55 +353,47 @@ static const char *ControlCodeTable[32] = { "NUL", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs", "ht", "nl", "vt", "np", "cr", "so", "si", "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", "can", "em", "sub", "esc", "fs", "gs", "rs", "us"}; -void appl::Buffer::expand(esize_t& _indent, const etk::UChar& _value, etk::UString& _out) const { +void appl::Buffer::expand(esize_t& _indent, const char32_t& _value, std::u32string& _out) const { _out.clear(); int32_t tabDist = 4; if (_value == etk::UChar::Tabulation) { int32_t nSpaces = tabDist - (_indent % tabDist); for (int32_t iii=0; iii')); + _out += U""; return; } if (_value == etk::UChar::Return) { // nothing to display... - _out.append(etk::UChar::Return); + _out += etk::UChar::Return; return; } - if (_value.get() <= 31) { - _out.append(etk::UChar('<')); - const char * tmp = ControlCodeTable[_value.get()]; + if (_value <= 31) { + _out += '<'; + const char * tmp = ControlCodeTable[_value]; while (*tmp!='\0') { - _out.append(etk::UChar(*tmp)); + _out += *tmp; tmp++; } - _out.append(etk::UChar('>')); + _out += '>'; return; } if (_value == etk::UChar::Delete) { - _out.append(etk::UChar('<')); - _out.append(etk::UChar('d')); - _out.append(etk::UChar('e')); - _out.append(etk::UChar('l')); - _out.append(etk::UChar('>')); + _out += U""; return; } // nothing to do ... - _out.append(_value); + _out += _value; //APPL_DEBUG("plop : " << _out); } appl::Buffer::Iterator appl::Buffer::countForwardNLines(const appl::Buffer::Iterator& _startPos, int32_t _nLines) { - etk::UChar value; + char32_t value; int32_t lineCount = 0; //APPL_INFO("startPos=" << startPos << " nLines=" << nLines); for (Iterator it = ++position(_startPos); @@ -422,7 +414,7 @@ appl::Buffer::Iterator appl::Buffer::countForwardNLines(const appl::Buffer::Iter appl::Buffer::Iterator appl::Buffer::countBackwardNLines(const appl::Buffer::Iterator& _startPos, int32_t _nLines) { //APPL_INFO("startPos=" << startPos << " nLines=" << nLines); - etk::UChar value; + char32_t value; int32_t lineCount = 0; for (Iterator it = --position(_startPos); it != begin(); @@ -442,7 +434,7 @@ appl::Buffer::Iterator appl::Buffer::countBackwardNLines(const appl::Buffer::Ite -bool appl::Buffer::copy(etk::UString& _data) { +bool appl::Buffer::copy(std::string& _data) { _data.clear(); if (hasTextSelected() == true) { esize_t startPos = getStartSelectionPos(); @@ -458,7 +450,7 @@ bool appl::Buffer::copy(etk::UString& _data) { return false; } -void appl::Buffer::copy(etk::UString& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) { +void appl::Buffer::copy(std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) { _data.clear(); esize_t startPos = getStartSelectionPos(); esize_t endPos = getStopSelectionPos(); @@ -470,58 +462,57 @@ void appl::Buffer::copy(etk::UString& _data, const appl::Buffer::Iterator& _pos, } } -bool appl::Buffer::write(const etk::UString& _data, const appl::Buffer::Iterator& _pos) { - etk::Char output = _data.c_str(); - m_data.insert(_pos, (int8_t*)((void*)output), output.size()); - regenerateHighLightAt(_pos, 0, output.size()); +bool appl::Buffer::write(const std::string& _data, const appl::Buffer::Iterator& _pos) { + m_data.insert(_pos, (int8_t*)(_data.c_str()), _data.size()); + regenerateHighLightAt(_pos, 0, _data.size()); m_selectMode = false; - moveCursor((esize_t)_pos+output.size()); + moveCursor((esize_t)_pos+_data.size()); countNumberofLine(); // TODO : use more intelligent counter setModification(true); return true; } -bool appl::Buffer::replace(const etk::UString& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) { - etk::Char output = _data.c_str(); - m_data.replace(_pos, (esize_t)_posEnd-(esize_t)_pos, (int8_t*)((void*)output), output.size()); - regenerateHighLightAt(_pos, (esize_t)_posEnd-(esize_t)_pos, output.size()); +bool appl::Buffer::replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) { + m_data.replace(_pos, (esize_t)_posEnd-(esize_t)_pos, (int8_t*)(_data.c_str()), _data.size()); + regenerateHighLightAt(_pos, (esize_t)_posEnd-(esize_t)_pos, _data.size()); m_selectMode = false; - moveCursor((esize_t)_pos+output.size()); + moveCursor((esize_t)_pos+_data.size()); countNumberofLine(); // TODO : use more intelligent counter setModification(true); return true; } void appl::Buffer::removeSelection(void) { - if (hasTextSelected() == true) { - esize_t startPos = getStartSelectionPos(); - esize_t endPos = getStopSelectionPos(); - m_data.remove(startPos, endPos-startPos); - regenerateHighLightAt(startPos, endPos-startPos, 0); - m_selectMode = false; - moveCursor(startPos); - countNumberofLine(); // TODO : use more intelligent counter - setModification(true); + if (hasTextSelected() == false) { + return; } + esize_t startPos = getStartSelectionPos(); + esize_t endPos = getStopSelectionPos(); + m_data.remove(startPos, endPos-startPos); + regenerateHighLightAt(startPos, endPos-startPos, 0); + m_selectMode = false; + moveCursor(startPos); + countNumberofLine(); // TODO : use more intelligent counter + setModification(true); } void appl::Buffer::tryFindHighlightType(void) { - etk::FSNode file(m_name); - etk::UString type = appl::highlightManager::getTypeExtention(file.fileGetExtention()); + etk::FSNode file(m_fileName); + std::string type = appl::highlightManager::getTypeExtention(file.fileGetExtention()); if (type.size() == 0) { return; } - APPL_CRITICAL("Find extention : " << type); + APPL_DEBUG("Find extention type: " << type); setHighlightType(type); } -void appl::Buffer::setHighlightType(const etk::UString& _type) { +void appl::Buffer::setHighlightType(const std::string& _type) { m_highlightType = ""; cleanHighLight(); if (m_highlight == NULL) { appl::Highlight::release(m_highlight); } - etk::UString resourceName = appl::highlightManager::getFileWithTypeType(_type); + std::string resourceName = appl::highlightManager::getFileWithTypeType(_type); if (resourceName == "") { return; } @@ -548,67 +539,67 @@ void appl::Buffer::regenerateHighLightAt(int32_t _pos, int32_t _nbDeleted, int32 int32_t startId; int32_t stopId; // clean data if needed - if (0 != m_HLDataPass1.size() != 0) { - // find element previous - findMainHighLightPosition(_pos, posEnd, startId, stopId, true); - - // remove deprecated element - if ( startId == -1 - && stopId == -1) { - m_HLDataPass1.clear(); - } else if (startId == -1) { - if (stopId == 0){ - m_HLDataPass1.erase(0); - //APPL_DEBUG("1 * Erase 0"); - } else { - m_HLDataPass1.eraseLen(0, stopId); - //APPL_DEBUG("2 * Erase 0->" << stopId); - } - } else if (stopId == -1) { - //APPL_DEBUG("3 * Erase " << startId+1 << "-> end"); - m_HLDataPass1.eraseLen(startId+1, m_HLDataPass1.size() - startId); - stopId = -1; - } else { - int32_t currentSize = m_HLDataPass1.size(); - //APPL_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" ); - m_HLDataPass1.eraseLen(startId+1, stopId - startId); - if (stopId == currentSize-1) { - stopId = -1; - } - } - //APPL_DEBUG("new size=" << (int32_t)m_HLDataPass1.size()-1); - // update position after the range position : - int32_t elemStart; - if (startId == -1) { - elemStart = 0; - } else { - elemStart = startId+1; - } - for (esize_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) { - //APPL_DEBUG("move element=" << i); - m_HLDataPass1[iii].beginStart += _nbAdded - _nbDeleted; - m_HLDataPass1[iii].beginStop += _nbAdded - _nbDeleted; - m_HLDataPass1[iii].endStart += _nbAdded - _nbDeleted; - m_HLDataPass1[iii].endStop += _nbAdded - _nbDeleted; - } - //Regenerate Element inside range - if ( startId == -1 - && stopId == -1) { - //APPL_DEBUG("******* Regenerate ALL"); - generateHighLightAt(0, m_data.size()); - } else if(-1 == startId) { - //APPL_DEBUG("******* Regenerate START"); - generateHighLightAt(0, m_HLDataPass1[0].beginStart, 0); - } else if(-1 == stopId) { - //APPL_DEBUG("******* Regenerate STOP"); - generateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].endStop, m_data.size(), m_HLDataPass1.size()); - } else { - //APPL_DEBUG("******* Regenerate RANGE"); - generateHighLightAt(m_HLDataPass1[startId].endStop, m_HLDataPass1[startId+1].beginStart, startId+1); - } - } else { + if (m_HLDataPass1.size() == 0) { // Parse the new element ... generateHighLightAt(0, m_data.size()); + return; + } + // find element previous + findMainHighLightPosition(_pos, posEnd, startId, stopId, true); + + // remove deprecated element + if ( startId == -1 + && stopId == -1) { + m_HLDataPass1.clear(); + } else if (startId == -1) { + if (stopId == 0){ + m_HLDataPass1.erase(m_HLDataPass1.begin()); + //APPL_DEBUG("1 * Erase 0"); + } else { + m_HLDataPass1.erase(m_HLDataPass1.begin(), m_HLDataPass1.begin()+stopId); + //APPL_DEBUG("2 * Erase 0->" << stopId); + } + } else if (stopId == -1) { + //APPL_DEBUG("3 * Erase " << startId+1 << "-> end"); + m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.end()); + stopId = -1; + } else { + int32_t currentSize = m_HLDataPass1.size(); + //APPL_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" ); + m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.begin()+stopId); + if (stopId == currentSize-1) { + stopId = -1; + } + } + //APPL_DEBUG("new size=" << (int32_t)m_HLDataPass1.size()-1); + // update position after the range position : + int32_t elemStart; + if (startId == -1) { + elemStart = 0; + } else { + elemStart = startId+1; + } + for (esize_t iii = elemStart; iii < m_HLDataPass1.size(); ++iii) { + //APPL_DEBUG("move element=" << i); + m_HLDataPass1[iii].beginStart += _nbAdded - _nbDeleted; + m_HLDataPass1[iii].beginStop += _nbAdded - _nbDeleted; + m_HLDataPass1[iii].endStart += _nbAdded - _nbDeleted; + m_HLDataPass1[iii].endStop += _nbAdded - _nbDeleted; + } + //Regenerate Element inside range + if ( startId == -1 + && stopId == -1) { + //APPL_DEBUG("******* Regenerate ALL"); + generateHighLightAt(0, m_data.size()); + } else if(-1 == startId) { + //APPL_DEBUG("******* Regenerate START"); + generateHighLightAt(0, m_HLDataPass1[0].beginStart, 0); + } else if(-1 == stopId) { + //APPL_DEBUG("******* Regenerate STOP"); + generateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].endStop, m_data.size(), m_HLDataPass1.size()); + } else { + //APPL_DEBUG("******* Regenerate RANGE"); + generateHighLightAt(m_HLDataPass1[startId].endStop, m_HLDataPass1[startId+1].beginStart, startId+1); } } diff --git a/sources/appl/Buffer.h b/sources/appl/Buffer.h index 6bc9ca0..08a6ca4 100644 --- a/sources/appl/Buffer.h +++ b/sources/appl/Buffer.h @@ -23,7 +23,7 @@ namespace appl { class DisplayHLData { public: - etk::Vector HLData; + std::vector HLData; int32_t posHLPass1; int32_t posHLPass2; }; @@ -34,7 +34,7 @@ namespace appl { private: int64_t m_current; //!< curent Id in the Buffer appl::Buffer* m_data; //!< Pointer on the curent Buffer - etk::UChar m_value; //!< store vlue to prevent multiple calcule of getting the data + char32_t m_value; //!< store vlue to prevent multiple calcule of getting the data public: /** * @brief Basic itarator constructor with no link. @@ -212,7 +212,7 @@ namespace appl { * @brief Get the value on the current element * @return The request element value */ - etk::UChar operator* (void); + char32_t operator* (void); /** * @brief Get the position in the buffer * @return The requested position. @@ -268,12 +268,12 @@ namespace appl { Buffer(void); ~Buffer(void); private: - etk::UString m_fileName; //!< name of the file (with his path) + std::string m_fileName; //!< name of the file (with his path) public: /** * @brief get the curent filename of the Buffer */ - const etk::UString& getFileName(void) { + const std::string& getFileName(void) { return m_fileName; } /** @@ -281,12 +281,12 @@ namespace appl { * @param[in] _name name of the file. * @return true if file corectly opened. */ - bool loadFile(const etk::UString& _name); + bool loadFile(const std::string& _name); /** * @brief Set a file name at this buffer (no saving ...) * @param[in] _name name of the file. */ - void setFileName(const etk::UString& _name); + void setFileName(const std::string& _name); /** * @brief save the file in the specify path. * @return true is saving well done @@ -403,7 +403,7 @@ namespace appl { * @param[in] _value Current value to transform * @param[out] _out String that represent the curent value to display */ - void expand(esize_t& _indent, const etk::UChar& _value, etk::UString& _out) const; + void expand(esize_t& _indent, const char32_t& _value, std::u32string& _out) const; /** * @brief get the start of a line with the position in the buffer. * @param[in] _pos position in the buffer. @@ -423,7 +423,7 @@ namespace appl { * @param[out] _result Research position. * @return true if pos if fined. */ - bool search(const Iterator& _pos, const etk::UChar& _search, Iterator& _result); + bool search(const Iterator& _pos, const char32_t& _search, Iterator& _result); /** * @brief Search a character in the buffer in back mode. * @param[in] _pos Position to start the search of the element. @@ -431,7 +431,7 @@ namespace appl { * @param[out] _result Research position. * @return true if pos if fined. */ - bool searchBack(const Iterator& _pos, const etk::UChar& _search, Iterator& _result); + bool searchBack(const Iterator& _pos, const char32_t& _search, Iterator& _result); /** * @brief find the first character of the line "nLines" forward * @param[in] _startPos Start position. @@ -452,21 +452,21 @@ namespace appl { * @param[out] _data Output stream to copy. * @return true of no error occured. */ - bool copy(etk::UString& _data); + bool copy(std::string& _data); /** * @brief copy data in the _data ref value. * @param[out] _data Output stream to copy. * @param[in] _pos Position to add the data. * @param[in] _posEnd End position to end replace the data. */ - void copy(etk::UString& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd); + void copy(std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd); /** * @brief Write data at a specific position * @param[in] _data Data to insert in the buffer * @param[in] _pos Position to add the data. * @return true if the write is done corectly */ - bool write(const etk::UString& _data, const appl::Buffer::Iterator& _pos); + bool write(const std::string& _data, const appl::Buffer::Iterator& _pos); /** * @brief Write data at a specific position * @param[in] _data Data to insert in the buffer @@ -474,7 +474,7 @@ namespace appl { * @param[in] _posEnd End position to end replace the data. * @return true if the write is done corectly */ - bool replace(const etk::UString& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd); + bool replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd); public: // iterator section : /** * @brief Get an iterator an an specific position @@ -523,10 +523,10 @@ namespace appl { */ void countNumberofLine(void); protected: - etk::UString m_highlightType; //!< Name of the highlight type + std::string m_highlightType; //!< Name of the highlight type appl::Highlight* m_highlight; //!< internal link with the Highlight system - etk::Vector m_HLDataPass1; //!< colorisation position in the current buffer pass 1 + std::vector m_HLDataPass1; //!< colorisation position in the current buffer pass 1 public: /** * @brief Find the Highligh capability @@ -536,12 +536,12 @@ namespace appl { * @brief Set type of highlight * @param[in] _type type of the highlight */ - void setHighlightType(const etk::UString& _type); + void setHighlightType(const std::string& _type); /** * @brief Get type of highlight * @return Type of the highlight */ - const etk::UString& setHighlightType(void) { + const std::string& setHighlightType(void) { return m_highlightType; }; diff --git a/sources/appl/BufferManager.cpp b/sources/appl/BufferManager.cpp index 2b688c4..4c60bf2 100644 --- a/sources/appl/BufferManager.cpp +++ b/sources/appl/BufferManager.cpp @@ -36,7 +36,7 @@ appl::BufferManager::~BufferManager(void) { m_list.clear(); } -appl::Buffer* appl::BufferManager::get(const etk::UString& _fileName, bool _createIfNeeded) { +appl::Buffer* appl::BufferManager::get(const std::string& _fileName, bool _createIfNeeded) { for (esize_t iii = 0; iii < m_list.size(); ++iii) { if (m_list[iii] == NULL) { continue; @@ -53,7 +53,7 @@ appl::Buffer* appl::BufferManager::get(const etk::UString& _fileName, bool _crea return NULL; } tmp->loadFile(_fileName); - m_list.pushBack(tmp); + m_list.push_back(tmp); return tmp; } return NULL; @@ -72,12 +72,12 @@ void appl::BufferManager::onObjectRemove(ewol::EObject * _removeObject) { continue; } m_list[iii] = NULL; - m_list.remove(iii); + m_list.erase(m_list.begin()+iii); return; } } -bool appl::BufferManager::exist(const etk::UString& _fileName) { +bool appl::BufferManager::exist(const std::string& _fileName) { for (esize_t iii = 0; iii < m_list.size(); ++iii) { if (m_list[iii] == NULL) { continue; @@ -89,7 +89,7 @@ bool appl::BufferManager::exist(const etk::UString& _fileName) { return false; } -void appl::BufferManager::open(const etk::UString& _fileName) { +void appl::BufferManager::open(const std::string& _fileName) { if (exist(_fileName) == false) { (void)get(_fileName, true); sendMultiCast(appl::MsgSelectNewFile, _fileName); @@ -160,7 +160,7 @@ class classBufferManager: public ewol::EObject { private: - etk::Vector listBuffer; //!< element List of the char Elements + std::vector listBuffer; //!< element List of the char Elements void removeAll(void); //!< remove all buffer int32_t m_idSelected; @@ -363,7 +363,7 @@ int32_t classBufferManager::create(void) { // allocate a new Buffer BufferText *myBuffer = new BufferText(); // add at the list of element - listBuffer.pushBack(myBuffer); + listBuffer.push_back(myBuffer); int32_t basicID = listBuffer.size() - 1; return basicID; } @@ -380,7 +380,7 @@ int32_t classBufferManager::open(etk::FSNode &myFile) { // allocate a new Buffer BufferText *myBuffer = new BufferText(myFile); // add at the list of element - listBuffer.pushBack(myBuffer); + listBuffer.push_back(myBuffer); return listBuffer.size() - 1; } else { // the buffer already existed == > we open it ... @@ -510,7 +510,7 @@ int32_t classBufferManager::witchBuffer(int32_t iEmeElement) { } -appl::Buffer* get(const etk::UString& _filename); +appl::Buffer* get(const std::string& _filename); appl::Buffer* get(esize_t _bufferID); esize_t size(void): diff --git a/sources/appl/BufferManager.h b/sources/appl/BufferManager.h index ac61272..a05799c 100644 --- a/sources/appl/BufferManager.h +++ b/sources/appl/BufferManager.h @@ -20,7 +20,7 @@ namespace appl { BufferManager(void); ~BufferManager(void); private: - etk::Vector m_list; // list of all buffer curently open + std::vector m_list; // list of all buffer curently open public: /** * @brief Get a specific buffer with his name (can create a new buffer). @@ -28,18 +28,18 @@ namespace appl { * @param[in] _createIfNeeded Create the buffer if not existed. * @return a pointer on the buffer */ - appl::Buffer* get(const etk::UString& _fileName, bool _createIfNeeded=false); + appl::Buffer* get(const std::string& _fileName, bool _createIfNeeded=false); /** * @brief Load a specific file, event if it not existed: * @param[in] _fileName Name of the file to open or create. */ - void open(const etk::UString& _fileName); + void open(const std::string& _fileName); /** * @brief Check if a buffer is already open. * @param[in] _fileName name of the file. * @return true if the buffer is already open. */ - bool exist(const etk::UString& _fileName); + bool exist(const std::string& _fileName); /** * @brief Get count of all buffer availlable. * @return Number of buffer diff --git a/sources/appl/GlyphDecoration.cpp b/sources/appl/GlyphDecoration.cpp index e29fe63..2e324a9 100644 --- a/sources/appl/GlyphDecoration.cpp +++ b/sources/appl/GlyphDecoration.cpp @@ -14,7 +14,7 @@ #define __class__ "GlyphDecoration" -appl::GlyphDecoration::GlyphDecoration(const etk::UString &_newColorName) : +appl::GlyphDecoration::GlyphDecoration(const std::string &_newColorName) : m_colorName(_newColorName), m_colorFG(etk::color::black), m_colorBG(etk::color::none), diff --git a/sources/appl/GlyphDecoration.h b/sources/appl/GlyphDecoration.h index 47495d4..748e3a3 100644 --- a/sources/appl/GlyphDecoration.h +++ b/sources/appl/GlyphDecoration.h @@ -16,25 +16,25 @@ namespace appl { class GlyphDecoration { public: // Constructeur - GlyphDecoration(const etk::UString& _newColorName = "no_name"); + GlyphDecoration(const std::string& _newColorName = "no_name"); ~GlyphDecoration(void) { // nothing to do ... }; private: - etk::UString m_colorName; //!< curent color Name + std::string m_colorName; //!< curent color Name public: /** * @brief Set color name of the element. * @param[in] _newColorName new color name. */ - void setName(const etk::UString& _newColorName) { + void setName(const std::string& _newColorName) { m_colorName = _newColorName; }; /** * @brief Get the color name. * @return The name of the color. */ - const etk::UString& getName(void) const { + const std::string& getName(void) const { return m_colorName; }; private: @@ -44,7 +44,7 @@ namespace appl { * @brief Set foreground color. * @param[in] _myColor new color description. */ - void setForeground(const etk::UString& _myColor) { + void setForeground(const std::string& _myColor) { m_colorFG = _myColor; }; /** @@ -68,7 +68,7 @@ namespace appl { * @brief Set background color. * @param[in] _myColor new color description. */ - void setBackground(const etk::UString& _myColor) { + void setBackground(const std::string& _myColor) { m_colorBG = _myColor; }; /** diff --git a/sources/appl/GlyphPainting.cpp b/sources/appl/GlyphPainting.cpp index c6c81b3..586fb24 100644 --- a/sources/appl/GlyphPainting.cpp +++ b/sources/appl/GlyphPainting.cpp @@ -18,7 +18,7 @@ -appl::GlyphPainting::GlyphPainting(const etk::UString& _filename) : +appl::GlyphPainting::GlyphPainting(const std::string& _filename) : ewol::Resource(_filename) { EWOL_DEBUG("SFP : load \"" << _filename << "\""); reload(); @@ -34,6 +34,13 @@ void appl::GlyphPainting::reload(void) { APPL_ERROR("Can not load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName()); return; } + // for debug only : + /* + APPL_WARNING("Load file : '" << m_name << "' = " << etk::FSNode(m_name).getFileSystemName()); + std::string tmppppp; + doc.generate(tmppppp); + APPL_DEBUG(tmppppp); + */ ejson::Array* baseArray = doc.getArray("ednColor"); if (baseArray == NULL) { APPL_ERROR("Can not get basic array : 'ednColor'"); @@ -45,9 +52,9 @@ void appl::GlyphPainting::reload(void) { APPL_DEBUG(" can not get object in 'ednColor' id=" << iii); continue; } - etk::UString name = tmpObj->getStringValue("name", ""); - etk::UString background = tmpObj->getStringValue("background", "#FFF0"); - etk::UString foreground = tmpObj->getStringValue("foreground", "#000F"); + std::string name = tmpObj->getStringValue("name", ""); + std::string background = tmpObj->getStringValue("background", "#FFF0"); + std::string foreground = tmpObj->getStringValue("foreground", "#000F"); bool italic = tmpObj->getBooleanValue("italic", false); bool bold = tmpObj->getBooleanValue("bold", false); APPL_VERBOSE("find new color : '" << name << "' fg='" << foreground << "' bg='" << background << "' italic='" << italic << "' bold='" << bold << "'"); @@ -70,12 +77,12 @@ void appl::GlyphPainting::reload(void) { tmpDeco.setBackground(background); tmpDeco.setItalic(italic); tmpDeco.setBold(bold); - m_list.pushBack(tmpDeco); + m_list.push_back(tmpDeco); } } -esize_t appl::GlyphPainting::request(const etk::UString& _name) { +esize_t appl::GlyphPainting::request(const std::string& _name) { for (esize_t iii=0; iii(getManager().localKeep(_filename)); if (NULL != object) { diff --git a/sources/appl/GlyphPainting.h b/sources/appl/GlyphPainting.h index 02de505..30f1282 100644 --- a/sources/appl/GlyphPainting.h +++ b/sources/appl/GlyphPainting.h @@ -17,9 +17,9 @@ namespace appl { class GlyphPainting : public ewol::Resource { private: - etk::Vector m_list; + std::vector m_list; protected: - GlyphPainting(const etk::UString& _filename); + GlyphPainting(const std::string& _filename); virtual ~GlyphPainting(void); public: const char* getType(void) { @@ -34,7 +34,7 @@ namespace appl { * @param[in] _name Name of the deco. * @return id of the deco. */ - esize_t request(const etk::UString& _name); + esize_t request(const std::string& _name); /** * @brief Get Decoration handle. * @param[in] _id Id of the decoration. @@ -58,7 +58,7 @@ namespace appl { * @param[in] _filename Name of the configuration file. * @return pointer on the resource or NULL if an error occured. */ - static appl::GlyphPainting* keep(const etk::UString& _filename); + static appl::GlyphPainting* keep(const std::string& _filename); /** * @brief release the keeped resources * @param[in,out] reference on the object pointer diff --git a/sources/appl/Gui/BufferView.cpp b/sources/appl/Gui/BufferView.cpp index f97dbab..bb6037e 100644 --- a/sources/appl/Gui/BufferView.cpp +++ b/sources/appl/Gui/BufferView.cpp @@ -17,8 +17,8 @@ #undef __class__ #define __class__ "BufferView" -static void SortElementList(etk::Vector& _list) { - etk::Vector tmpList = _list; +static void SortElementList(std::vector& _list) { + std::vector tmpList = _list; _list.clear(); for(int32_t iii=0; iii& _list) { } } //EWOL_DEBUG("position="<getFileName(); appl::dataBufferStruct* tmpElement = new appl::dataBufferStruct(name, iii, isModify); if (NULL != tmpElement) { - m_list.pushBack(tmpElement); + m_list.push_back(tmpElement); } else { APPL_ERROR("Allocation error of the tmp buffer list element"); } @@ -175,7 +175,7 @@ void BufferView::onObjectRemove(ewol::EObject* _removeObject) { if (m_list[iii]->m_buffer != _removeObject) { continue; } - m_list.remove(iii); + m_list.erase(m_list.begin()+iii); markToRedraw(); return; } @@ -190,7 +190,7 @@ uint32_t BufferView::getNuberOfColomn(void) { return 1; } -bool BufferView::getTitle(int32_t _colomn, etk::UString &_myTitle, etk::Color<> &_fg, etk::Color<> &_bg) { +bool BufferView::getTitle(int32_t _colomn, std::string &_myTitle, etk::Color<> &_fg, etk::Color<> &_bg) { _myTitle = "Buffers : "; return true; } @@ -199,7 +199,7 @@ uint32_t BufferView::getNuberOfRaw(void) { return m_list.size(); } -bool BufferView::getElement(int32_t _colomn, int32_t _raw, etk::UString& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) { +bool BufferView::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) { if( _raw >= 0 && _raw m_list; + std::vector m_list; public: // Constructeur BufferView(void); @@ -61,9 +61,9 @@ class BufferView : public widget::List void removeAllElement(void); // Derived function virtual uint32_t getNuberOfColomn(void); - virtual bool getTitle(int32_t _colomn, etk::UString& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg); + virtual bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg); virtual uint32_t getNuberOfRaw(void); - virtual bool getElement(int32_t _colomn, int32_t _raw, etk::UString& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg); + virtual bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg); virtual bool onItemEvent(int32_t _IdInput, enum ewol::keyEvent::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y); }; diff --git a/sources/appl/Gui/MainWindows.cpp b/sources/appl/Gui/MainWindows.cpp index 7eb7586..86a68b1 100644 --- a/sources/appl/Gui/MainWindows.cpp +++ b/sources/appl/Gui/MainWindows.cpp @@ -34,14 +34,14 @@ namespace appl { - etk::UString getVersion(void) + std::string getVersion(void) { #define FIRST_YEAR (2010) - etk::UString tmpOutput = (date::getYear()-FIRST_YEAR); + std::string tmpOutput = std::to_string(date::getYear()-FIRST_YEAR); tmpOutput += "."; - tmpOutput += date::getMonth(); + tmpOutput += std::to_string(date::getMonth()); tmpOutput += "."; - tmpOutput += date::getDay(); + tmpOutput += std::to_string(date::getDay()); return tmpOutput; } @@ -67,7 +67,7 @@ class ParameterAboutGui : public widget::Sizer { mySpacer->setExpand(bvec2(true,true)); subWidgetAdd(mySpacer); } - etk::UString tmpLabel = ""; + std::string tmpLabel = ""; tmpLabel += " Editeur De N'ours : v:"; tmpLabel += appl::getVersion(); tmpLabel += "
"; @@ -239,7 +239,7 @@ MainWindows::MainWindows(void) { // add generic shortcut ... - // (shift, control, alt, meta, etk::UChar unicodeValue, const char * generateEventId, etk::UString& data) + // (shift, control, alt, meta, char32_t unicodeValue, const char * generateEventId, std::string& data) shortCutAdd("ctrl+o", ednMsgGuiOpen, "", true); shortCutAdd("ctrl+n", ednMsgGuiNew, "", true); @@ -322,7 +322,7 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg) { APPL_ERROR("can not call unexistant buffer manager ... "); return; } - if (_msg.getData().toLower() == "current") { + if (to_lower(_msg.getData()) == "current") { appl::Buffer* tmpBuffer = m_bufferManager->getBufferSelected(); if (tmpBuffer == NULL) { APPL_WARNING("No buffer selected !!! "); @@ -340,7 +340,7 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg) { APPL_ERROR("can not save the file !!! '" << tmpBuffer->getFileName() << "'"); } return; - } else if (_msg.getData().toLower() == "all") { + } else if (to_lower(_msg.getData()) == "all") { APPL_TODO("Need to save all the buffers ... "); for (esize_t iii=0; iii < m_bufferManager->size(); ++iii) { appl::Buffer* tmpBuffer = m_bufferManager->get(iii); @@ -386,8 +386,8 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg) { } else { tmpWidget->setTitle("Save files As..."); tmpWidget->setValidateLabel("Save"); - etk::UString folder = "/home/"; - etk::UString fileName = ""; + std::string folder = "/home/"; + std::string fileName = ""; if (true == myBuffer->haveName()) { etk::FSNode tmpName = myBuffer->getFileName(); folder = tmpName.getNameFolder(); @@ -403,7 +403,7 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg) { } } else if (_msg.getMessage() == ednEventPopUpFileSaveAs) { // get the filename : - etk::UString tmpData = _msg.getData(); + std::string tmpData = _msg.getData(); APPL_DEBUG("Request Saving As file : " << tmpData); /* BufferManager::get(m_currentSavingAsIdBuffer)->setFileName(tmpData); @@ -417,14 +417,14 @@ void MainWindows::onReceiveMessage(const ewol::EMessage& _msg) { if (NULL != tmpBuffer) { etk::FSNode compleateName = tmpBuffer->getFileName(); bool isModify = tmpBuffer->isModify(); - etk::UString directName = compleateName.getName(); + std::string directName = compleateName.getName(); if (true == isModify) { directName += " *"; } if (NULL != m_widgetLabelFileName) { - m_widgetLabelFileName->setLabel(etk::UString("") + directName + ""); + m_widgetLabelFileName->setLabel(std::string("") + directName + ""); } - etk::UString windowsTitle = "edn - "; + std::string windowsTitle = "edn - "; windowsTitle += directName; setTitle(windowsTitle); return; diff --git a/sources/appl/Gui/SearchData.cpp b/sources/appl/Gui/SearchData.cpp index 228d454..552336e 100644 --- a/sources/appl/Gui/SearchData.cpp +++ b/sources/appl/Gui/SearchData.cpp @@ -14,13 +14,13 @@ #define __class__ "SearchData" -static etk::UString m_findRequest = ""; +static std::string m_findRequest = ""; -void SearchData::setSearch(const etk::UString &myData) +void SearchData::setSearch(const std::string &myData) { m_findRequest = myData; } -void SearchData::getSearch(etk::UString &myData) +void SearchData::getSearch(std::string &myData) { myData = m_findRequest; } @@ -32,12 +32,12 @@ bool SearchData::isSearchEmpty(void) return true; } -static etk::UString m_replaceRequest = ""; -void SearchData::setReplace(const etk::UString &myData) +static std::string m_replaceRequest = ""; +void SearchData::setReplace(const std::string &myData) { m_replaceRequest = myData; } -void SearchData::getReplace(etk::UString &myData) +void SearchData::getReplace(std::string &myData) { myData = m_replaceRequest; } diff --git a/sources/appl/Gui/SearchData.h b/sources/appl/Gui/SearchData.h index dac53f4..3abe786 100644 --- a/sources/appl/Gui/SearchData.h +++ b/sources/appl/Gui/SearchData.h @@ -14,11 +14,11 @@ namespace SearchData { - void setSearch(const etk::UString &myData); - void getSearch(etk::UString &myData); + void setSearch(const std::string &myData); + void getSearch(std::string &myData); bool isSearchEmpty(void); - void setReplace(const etk::UString &myData); - void getReplace(etk::UString &myData); + void setReplace(const std::string &myData); + void getReplace(std::string &myData); bool isReplaceEmpty(void); void setCase(bool value); bool getCase(void); diff --git a/sources/appl/Gui/TagFileList.cpp b/sources/appl/Gui/TagFileList.cpp index b8b7d18..7a368b2 100644 --- a/sources/appl/Gui/TagFileList.cpp +++ b/sources/appl/Gui/TagFileList.cpp @@ -41,7 +41,7 @@ uint32_t appl::TagFileList::getNuberOfColomn(void) { return 2; } -bool appl::TagFileList::getTitle(int32_t _colomn, etk::UString& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg) { +bool appl::TagFileList::getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg) { _myTitle = "title"; return true; } @@ -50,10 +50,10 @@ uint32_t appl::TagFileList::getNuberOfRaw(void) { return m_list.size(); } -bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, etk::UString& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) { +bool appl::TagFileList::getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg) { if (_raw >= 0 && _raw < m_list.size() && NULL != m_list[_raw]) { if (0 == _colomn) { - _myTextToWrite = etk::UString(m_list[_raw]->fileLine); + _myTextToWrite = std::to_string(m_list[_raw]->fileLine); } else { _myTextToWrite = m_list[_raw]->filename; } @@ -102,7 +102,7 @@ bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::keyEvent::statu if( m_selectedLine >= 0 && m_selectedLine < m_list.size() && NULL != m_list[m_selectedLine] ) { - generateEventId(event, etk::UString(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename); + generateEventId(event, std::to_string(m_list[_raw]->fileLine)+":"+m_list[m_selectedLine]->filename); } else { generateEventId(applEventCtagsListUnSelect); } @@ -120,10 +120,10 @@ bool appl::TagFileList::onItemEvent(int32_t _IdInput, enum ewol::keyEvent::statu * @param[in] file Compleate file name * @param[in] jump line id */ -void appl::TagFileList::add(etk::UString& _file, int32_t _line) { +void appl::TagFileList::add(std::string& _file, int32_t _line) { appl::TagListElement *tmpFile = new appl::TagListElement(_file, _line); if (NULL != tmpFile) { - m_list.pushBack(tmpFile); + m_list.push_back(tmpFile); } markToRedraw(); } diff --git a/sources/appl/Gui/TagFileList.h b/sources/appl/Gui/TagFileList.h index 5913a98..c9ff4c4 100644 --- a/sources/appl/Gui/TagFileList.h +++ b/sources/appl/Gui/TagFileList.h @@ -20,9 +20,9 @@ extern const char * const applEventCtagsListUnSelect; namespace appl { class TagListElement { public: - etk::UString filename; + std::string filename; int32_t fileLine; - TagListElement(etk::UString& _file, int32_t _line) : + TagListElement(std::string& _file, int32_t _line) : filename(_file), fileLine(_line) { @@ -34,16 +34,16 @@ namespace appl { class TagFileList : public widget::List { private: int32_t m_selectedLine; - etk::Vector m_list; + std::vector m_list; public: TagFileList(void); ~TagFileList(void); // display API : virtual etk::Color<> getBasicBG(void); uint32_t getNuberOfColomn(void); - bool getTitle(int32_t _colomn, etk::UString& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg); + bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<>& _fg, etk::Color<>& _bg); uint32_t getNuberOfRaw(void); - bool getElement(int32_t _colomn, int32_t _raw, etk::UString& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg); + bool getElement(int32_t _colomn, int32_t _raw, std::string& _myTextToWrite, etk::Color<>& _fg, etk::Color<>& _bg); bool onItemEvent(int32_t _IdInput, enum ewol::keyEvent::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y); // derived function const char * const getObjectType(void) { @@ -55,7 +55,7 @@ namespace appl { * @param[in] file Compleate file name * @param[in] jump line id */ - void add(etk::UString& _file, int32_t _line); + void add(std::string& _file, int32_t _line); }; }; diff --git a/sources/appl/Gui/TagFileSelection.cpp b/sources/appl/Gui/TagFileSelection.cpp index d8e4f05..1c51bfe 100644 --- a/sources/appl/Gui/TagFileSelection.cpp +++ b/sources/appl/Gui/TagFileSelection.cpp @@ -159,7 +159,7 @@ void appl::TagFileSelection::onReceiveMessage(const ewol::EMessage& _msg) { * @param[in] file Compleate file name * @param[in] jump line id */ -void appl::TagFileSelection::addCtagsNewItem(etk::UString _file, int32_t _line) { +void appl::TagFileSelection::addCtagsNewItem(std::string _file, int32_t _line) { if (NULL != m_listTag) { m_listTag->add(_file, _line); } diff --git a/sources/appl/Gui/TagFileSelection.h b/sources/appl/Gui/TagFileSelection.h index 961cca1..205f5f1 100644 --- a/sources/appl/Gui/TagFileSelection.h +++ b/sources/appl/Gui/TagFileSelection.h @@ -20,7 +20,7 @@ namespace appl { class TagFileSelection : public widget::PopUp { private: appl::TagFileList* m_listTag; - etk::UString m_eventNamed; + std::string m_eventNamed; public: TagFileSelection(void); virtual ~TagFileSelection(void); @@ -29,7 +29,7 @@ namespace appl { * @param[in] file Compleate file name * @param[in] jump line id */ - void addCtagsNewItem(etk::UString file, int32_t line); + void addCtagsNewItem(std::string file, int32_t line); public: // herited function const char * const getObjectType(void) { return "EwolFileChooser"; }; void onReceiveMessage(const ewol::EMessage& _msg); diff --git a/sources/appl/Gui/TextViewer.cpp b/sources/appl/Gui/TextViewer.cpp index d73f365..163ba69 100644 --- a/sources/appl/Gui/TextViewer.cpp +++ b/sources/appl/Gui/TextViewer.cpp @@ -21,7 +21,7 @@ #undef __class__ #define __class__ "TextViewer" -appl::TextViewer::TextViewer(const etk::UString& _fontName, int32_t _fontSize) : +appl::TextViewer::TextViewer(const std::string& _fontName, int32_t _fontSize) : m_buffer(NULL), m_displayText(_fontName, _fontSize), m_insertMode(false) { @@ -109,7 +109,7 @@ void appl::TextViewer::onRegenerateDisplay(void) { m_maxSize.setY(256); m_displayText.setTextAlignement(10, m_size.x()-20, ewol::Text::alignLeft); m_displayText.setRelPos(vec3(10, 0, 0)); - etk::UString tmpString("
\n" + std::string tmpString("
\n" "\n" " \n" " edn - Editeur De N'ours\n" @@ -137,7 +137,7 @@ void appl::TextViewer::onRegenerateDisplay(void) { float countNbLine = 1; esize_t countColomn = 0; // the siplay string : - etk::UString stringToDisplay; + std::u32string stringToDisplay; esize_t bufferElementSize = 0; bool isSelect = false; appl::Buffer::Iterator selectPosStart = m_buffer->begin(); @@ -166,7 +166,7 @@ void appl::TextViewer::onRegenerateDisplay(void) { } // Display line number : m_lastOffsetDisplay = 0; - vec3 tmpLetterSize = m_displayText.calculateSize((etk::UChar)'A'); + vec3 tmpLetterSize = m_displayText.calculateSize((char32_t)'A'); { esize_t nbLine = m_buffer->getNumberOfLines(); float nbLineCalc = nbLine; @@ -277,7 +277,7 @@ void appl::TextViewer::onRegenerateDisplay(void) { } // set maximum size (X&Y) : { - vec3 tmpLetterSize = m_displayText.calculateSize((etk::UChar)'A'); + vec3 tmpLetterSize = m_displayText.calculateSize((char32_t)'A'); esize_t nbLines = m_buffer->getNumberOfLines(); m_maxSize.setX(maxSizeX+m_originScrooled.x()); m_maxSize.setY((float)nbLines*tmpLetterSize.y()); @@ -302,7 +302,7 @@ bool appl::TextViewer::onEventEntry(const ewol::EventEntry& _event) { if (_event.getStatus() != ewol::keyEvent::statusDown) { return false; } - etk::UChar localValue = _event.getChar(); + char32_t localValue = _event.getChar(); if (localValue == etk::UChar::Return) { if (true == _event.getSpecialKey().isSetShift()) { localValue = etk::UChar::CarrierReturn; @@ -333,15 +333,16 @@ bool appl::TextViewer::onEventEntry(const ewol::EventEntry& _event) { m_buffer->setSelectMode(false); // normal adding char ... char output[5]; - int32_t nbElement = localValue.getUtf8(output); + int32_t nbElement = etk::getUtf8(localValue, output); if ( m_buffer->hasTextSelected() == false && _event.getSpecialKey().isSetInsert() == true) { appl::Buffer::Iterator pos = m_buffer->cursor(); appl::Buffer::Iterator posEnd = pos; ++posEnd; - replace(localValue, pos, posEnd); + replace(output, pos, posEnd); + //TODO : choisce UTF ... replace(localValue, pos, posEnd); } else { - etk::UString myString = output; + std::string myString = output; write(myString); } return true; @@ -492,11 +493,11 @@ void appl::TextViewer::mouseEventTriple(void) { } appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativePos) { - etk::UChar currentValue; + char32_t currentValue; vec3 positionCurentDisplay(0,0,0); - vec3 tmpLetterSize = m_displayText.calculateSize((etk::UChar)'A'); + vec3 tmpLetterSize = m_displayText.calculateSize((char32_t)'A'); esize_t countColomn = 0; - etk::UString stringToDisplay; + std::u32string stringToDisplay; m_displayText.clear(); m_displayText.forceLineReturn(); for (appl::Buffer::Iterator it = m_buffer->begin(); @@ -532,7 +533,7 @@ appl::Buffer::Iterator appl::TextViewer::getMousePosition(const vec2& _relativeP void appl::TextViewer::onEventClipboard(enum ewol::clipBoard::clipboardListe _clipboardID) { if (m_buffer != NULL) { - etk::UString data = ewol::clipBoard::get(_clipboardID); + std::string data = ewol::clipBoard::get(_clipboardID); write(data); } markToRedraw(); @@ -602,7 +603,7 @@ void appl::TextViewer::setFontSize(int32_t _size) { setScrollingSize(_size*3.0*1.46); // 1.46 is a magic number ... } -void appl::TextViewer::setFontName(const etk::UString& _fontName) { +void appl::TextViewer::setFontName(const std::string& _fontName) { m_displayText.setFontName(_fontName); } @@ -618,7 +619,7 @@ bool appl::TextViewer::moveCursor(const appl::Buffer::Iterator& _pos) { return true; } -bool appl::TextViewer::write(const etk::UString& _data) { +bool appl::TextViewer::write(const std::string& _data) { if (m_buffer == NULL) { return false; } @@ -628,7 +629,7 @@ bool appl::TextViewer::write(const etk::UString& _data) { return write(_data, m_buffer->cursor()); } -bool appl::TextViewer::write(const etk::UString& _data, const appl::Buffer::Iterator& _pos) { +bool appl::TextViewer::write(const std::string& _data, const appl::Buffer::Iterator& _pos) { if (m_buffer == NULL) { return false; } @@ -642,7 +643,7 @@ bool appl::TextViewer::write(const etk::UString& _data, const appl::Buffer::Iter return ret; } -bool appl::TextViewer::replace(const etk::UString& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) { +bool appl::TextViewer::replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd) { if (m_buffer == NULL) { return false; } @@ -656,7 +657,7 @@ bool appl::TextViewer::replace(const etk::UString& _data, const appl::Buffer::It return ret; } -bool appl::TextViewer::replace(const etk::UString& _data) { +bool appl::TextViewer::replace(const std::string& _data) { if (m_buffer == NULL) { return false; } @@ -788,9 +789,9 @@ void appl::TextViewer::moveCursorDown(esize_t _nbLine) { // TODO : Rename ... appl::Buffer::Iterator appl::TextViewer::getPosSize(const appl::Buffer::Iterator& _startLinePos, float _distance) { - etk::UChar currentValue; + char32_t currentValue; esize_t countColomn = 0; - etk::UString stringToDisplay; + std::u32string stringToDisplay; m_displayText.clear(); m_displayText.forceLineReturn(); for (appl::Buffer::Iterator it = _startLinePos; @@ -816,9 +817,9 @@ appl::Buffer::Iterator appl::TextViewer::getPosSize(const appl::Buffer::Iterator // TODO : Rename ... float appl::TextViewer::getScreenSize(const appl::Buffer::Iterator& _startLinePos, const appl::Buffer::Iterator& _stopPos) { float ret = 0; - etk::UChar currentValue; + char32_t currentValue; esize_t countColomn = 0; - etk::UString stringToDisplay; + std::u32string stringToDisplay; m_displayText.clear(); for (appl::Buffer::Iterator it = _startLinePos; diff --git a/sources/appl/Gui/TextViewer.h b/sources/appl/Gui/TextViewer.h index 717f93c..80cc5c0 100644 --- a/sources/appl/Gui/TextViewer.h +++ b/sources/appl/Gui/TextViewer.h @@ -42,7 +42,7 @@ namespace appl { private: appl::BufferManager* m_bufferManager; //!< handle on the buffer manager public: - TextViewer(const etk::UString& _fontName="", int32_t _fontSize=-1); + TextViewer(const std::string& _fontName="", int32_t _fontSize=-1); virtual ~TextViewer(void); private: appl::Buffer* m_buffer; //!< pointer on the current buffer to display (can be null if the buffer is remover or in state of changing buffer) @@ -50,7 +50,7 @@ namespace appl { ewol::Drawing m_displayDrawing; //!< Other diaplay requested. public: void setFontSize(int32_t _size); - void setFontName(const etk::UString& _fontName); + void setFontName(const std::string& _fontName); protected: // derived function virtual void onDraw(void); public: // Derived function @@ -73,10 +73,10 @@ namespace appl { public: // TODO : Doc : write data on buffer bool moveCursor(const appl::Buffer::Iterator& _pos); - bool write(const etk::UString& _data); - bool write(const etk::UString& _data, const appl::Buffer::Iterator& _pos); - bool replace(const etk::UString& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd); - bool replace(const etk::UString& _data); + bool write(const std::string& _data); + bool write(const std::string& _data, const appl::Buffer::Iterator& _pos); + bool replace(const std::string& _data, const appl::Buffer::Iterator& _pos, const appl::Buffer::Iterator& _posEnd); + bool replace(const std::string& _data); void remove(void); diff --git a/sources/appl/Highlight.cpp b/sources/appl/Highlight.cpp index 72f762e..8a6332a 100644 --- a/sources/appl/Highlight.cpp +++ b/sources/appl/Highlight.cpp @@ -18,17 +18,17 @@ void appl::Highlight::parseRules(exml::Element* _child, - etk::Vector& _mListPatern, + std::vector& _mListPatern, int32_t _level) { // Create the patern ... HighlightPattern *myPattern = new HighlightPattern(m_paintingProperties); // parse under Element myPattern->parseRules(_child, _level); // add element in the list - _mListPatern.pushBack(myPattern); + _mListPatern.push_back(myPattern); } -appl::Highlight::Highlight(const etk::UString& _xmlFilename, const etk::UString& _colorFile) : +appl::Highlight::Highlight(const std::string& _xmlFilename, const std::string& _colorFile) : ewol::Resource(_xmlFilename), m_typeName("") { // keep color propertiy file : @@ -55,10 +55,10 @@ appl::Highlight::Highlight(const etk::UString& _xmlFilename, const etk::UString& continue; } if (child->getValue() == "ext") { - etk::UString myData = child->getText(); + std::string myData = child->getText(); if (myData.size()!=0) { //APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData); - m_listExtentions.pushBack(myData); + m_listExtentions.push_back(myData); } } else if (child->getValue() == "pass1") { // get sub Nodes ... @@ -107,17 +107,19 @@ appl::Highlight::~Highlight(void) { m_listExtentions.clear(); } -bool appl::Highlight::hasExtention(const etk::UString& _ext) { +bool appl::Highlight::hasExtention(const std::string& _ext) { for (int32_t iii=0; iii &metaData, + std::vector &metaData, int32_t addingPos, etk::Buffer &buffer) { if (0 > addingPos) { @@ -184,7 +186,8 @@ void appl::Highlight::parse(int32_t start, if (metaData[kkk].beginStart <= resultat.endStop) { // remove element //APPL_INFO("Erase element=" << kkk); - metaData.eraseLen(kkk, kkk+1); + // TODO : maybe an error here ... + metaData.erase(metaData.begin()+kkk, metaData.begin()+kkk*2+1); // Increase the end of search if (kkk < metaData.size()) { // just befor the end of the next element @@ -199,7 +202,7 @@ void appl::Highlight::parse(int32_t start, } } // add curent element in the list ... - metaData.insert(addingPos, resultat); + metaData.insert(metaData.begin()+addingPos, resultat); //APPL_DEBUG("INSERT at "<< addingPos << " S=" << resultat.beginStart << " E=" << resultat.endStop ); // update the current research starting element: (set position at the end of the current element elementStart = resultat.endStop-1; @@ -221,7 +224,7 @@ void appl::Highlight::parse(int32_t start, */ void appl::Highlight::parse2(int32_t start, int32_t stop, - etk::Vector &metaData, + std::vector &metaData, etk::Buffer &buffer) { //APPL_DEBUG("Parse element 0 => " << m_listHighlightPass2.size() << " == > position search: (" << start << "," << stop << ")" ); int32_t elementStart = start; @@ -239,7 +242,7 @@ void appl::Highlight::parse2(int32_t start, if (HLP_FIND_ERROR != ret) { //APPL_INFO("Find Pattern in the Buffer : (" << resultat.beginStart << "," << resultat.endStop << ")" ); // add curent element in the list ... - metaData.pushBack(resultat); + metaData.push_back(resultat); elementStart = resultat.endStop-1; // Exit current cycle break; @@ -250,7 +253,7 @@ void appl::Highlight::parse2(int32_t start, } } -appl::Highlight* appl::Highlight::keep(const etk::UString& _filename) { +appl::Highlight* appl::Highlight::keep(const std::string& _filename) { //EWOL_INFO("KEEP : appl::Highlight : file : \"" << _filename << "\""); appl::Highlight* object = static_cast(getManager().localKeep(_filename)); if (NULL != object) { diff --git a/sources/appl/Highlight.h b/sources/appl/Highlight.h index 468d829..7faab6b 100644 --- a/sources/appl/Highlight.h +++ b/sources/appl/Highlight.h @@ -37,35 +37,35 @@ namespace appl { appl::GlyphPainting* m_paintingProperties; protected: // Constructeur - Highlight(const etk::UString& _xmlFilename, const etk::UString& _colorFile); + Highlight(const std::string& _xmlFilename, const std::string& _colorFile); ~Highlight(void); private: - etk::UString m_typeName; //!< descriptive string type like "C/C++" + std::string m_typeName; //!< descriptive string type like "C/C++" public: - const etk::UString& getTypeName(void) { + const std::string& getTypeName(void) { return m_typeName; } public: - bool hasExtention(const etk::UString& _ext); - bool fileNameCompatible(const etk::UString& _fileName); + bool hasExtention(const std::string& _ext); + bool fileNameCompatible(const std::string& _fileName); void display(void); void parse(int32_t _start, int32_t _stop, - etk::Vector &_metaData, + std::vector &_metaData, int32_t _addingPos, etk::Buffer &_buffer); void parse2(int32_t _start, int32_t _stop, - etk::Vector &_metaData, + std::vector &_metaData, etk::Buffer &_buffer); private: void parseRules(exml::Element* _child, - etk::Vector &_mListPatern, + std::vector &_mListPatern, int32_t _level); - etk::UString m_styleName; //!< curent style name (like "c++" or "c" or "script Bash") - etk::Vector m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h" - etk::Vector m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer) - etk::Vector m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) ) + std::string m_styleName; //!< curent style name (like "c++" or "c" or "script Bash") + std::vector m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h" + std::vector m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer) + std::vector m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) ) public: /** * @brief keep the resource pointer. @@ -73,7 +73,7 @@ namespace appl { * @param[in] _filename Name of the configuration file. * @return pointer on the resource or NULL if an error occured. */ - static appl::Highlight* keep(const etk::UString& _filename); + static appl::Highlight* keep(const std::string& _filename); /** * @brief release the keeped resources * @param[in,out] reference on the object pointer diff --git a/sources/appl/HighlightManager.cpp b/sources/appl/HighlightManager.cpp index def0c04..e1f649d 100644 --- a/sources/appl/HighlightManager.cpp +++ b/sources/appl/HighlightManager.cpp @@ -15,21 +15,21 @@ #undef __class__ #define __class__ "highlightManager" -static etk::Vector& s_list(void) { - static etk::Vector list; +static std::vector& s_list(void) { + static std::vector list; return list; } void appl::highlightManager::init(void) { - etk::Vector& hlList = s_list(); + std::vector& hlList = s_list(); if (hlList.size() != 0) { APPL_ERROR("HighlightManager == > already exist, just unlink the previous ..."); hlList.clear(); } etk::FSNode myFile("DATA:languages/"); // get the subfolder list : - etk::Vector list = myFile.folderGetSubList(false, true, false,false); + std::vector list = myFile.folderGetSubList(false, true, false,false); for (esize_t iii = 0; iii < list.size(); ++iii) { if (list[iii] == NULL) { continue; @@ -37,11 +37,11 @@ void appl::highlightManager::init(void) { if (list[iii]->getNodeType() != etk::FSN_FOLDER) { continue; } - etk::UString filename = list[iii]->getName() + "/highlight.xml"; + std::string filename = list[iii]->getName() + "/highlight.xml"; APPL_DEBUG("Load xml name : " << filename); appl::Highlight *myHightLine = appl::Highlight::keep(filename); if (myHightLine != NULL) { - hlList.pushBack(myHightLine); + hlList.push_back(myHightLine); } else { APPL_ERROR("Can not allocate HighLight"); } @@ -58,7 +58,7 @@ void appl::highlightManager::init(void) { } void appl::highlightManager::unInit(void) { - etk::Vector& hlList = s_list(); + std::vector& hlList = s_list(); if (hlList.size() == 0) { APPL_DEBUG("HighlightManager ==> no highlight"); hlList.clear(); @@ -74,27 +74,31 @@ void appl::highlightManager::unInit(void) { hlList.clear(); } -etk::UString appl::highlightManager::getTypeExtention(const etk::UString& _extention) { +std::string appl::highlightManager::getTypeExtention(const std::string& _extention) { if (_extention.size() == 0) { return ""; } - etk::Vector& hlList = s_list(); + APPL_VERBOSE("Try to find type for extention : '" << _extention << "' in " << s_list().size() << " types"); + std::vector& hlList = s_list(); for (esize_t iii = 0; iii < hlList.size(); ++iii) { if (hlList[iii] == NULL) { continue; } + APPL_VERBOSE(" check : " << hlList[iii]->getTypeName()); if (hlList[iii]->hasExtention(_extention) == true) { + APPL_VERBOSE("Find type for extention : " << _extention + << " type : " << hlList[iii]->getTypeName()); return hlList[iii]->getTypeName(); } } return ""; } -etk::UString appl::highlightManager::getFileWithTypeType(const etk::UString& _type) { +std::string appl::highlightManager::getFileWithTypeType(const std::string& _type) { if (_type.size() == 0) { return ""; } - etk::Vector& hlList = s_list(); + std::vector& hlList = s_list(); for (esize_t iii = 0; iii < hlList.size(); ++iii) { if (hlList[iii] == NULL) { continue; @@ -106,8 +110,8 @@ etk::UString appl::highlightManager::getFileWithTypeType(const etk::UString& _ty return ""; } -etk::Vector appl::highlightManager::getTypeList(void) { - etk::Vector ret; +std::vector appl::highlightManager::getTypeList(void) { + std::vector ret; return ret; } diff --git a/sources/appl/HighlightManager.h b/sources/appl/HighlightManager.h index 3a635b8..9735eca 100644 --- a/sources/appl/HighlightManager.h +++ b/sources/appl/HighlightManager.h @@ -30,18 +30,18 @@ namespace appl { * @param[in] extention of the file * @return type of highlight */ - etk::UString getTypeExtention(const etk::UString& _extention); + std::string getTypeExtention(const std::string& _extention); /** * @brief Get filename with type. * @param[in] _type Type name of the highlight. * @return filename of the highlight. */ - etk::UString getFileWithTypeType(const etk::UString& _type); + std::string getFileWithTypeType(const std::string& _type); /** * @brief Get the list of extention type * @return the requested list. */ - etk::Vector getTypeList(void); + std::vector getTypeList(void); }; }; diff --git a/sources/appl/HighlightPattern.cpp b/sources/appl/HighlightPattern.cpp index 6876f09..4506872 100644 --- a/sources/appl/HighlightPattern.cpp +++ b/sources/appl/HighlightPattern.cpp @@ -36,14 +36,14 @@ appl::HighlightPattern::~HighlightPattern(void) { } } -void appl::HighlightPattern::setPaternStart(etk::UString& _regExp) { +void appl::HighlightPattern::setPaternStart(std::string& _regExp) { if (m_regExpStart == NULL) { return; } m_regExpStart->setRegExp(_regExp); } -void appl::HighlightPattern::setPaternStop(etk::UString& _regExp) { +void appl::HighlightPattern::setPaternStop(std::string& _regExp) { if (m_regExpStop != NULL) { delete(m_regExpStop); m_regExpStop = NULL; @@ -58,11 +58,11 @@ void appl::HighlightPattern::setPaternStop(etk::UString& _regExp) { } } -void appl::HighlightPattern::setEscapeChar(const etk::UChar& _EscapeChar) { +void appl::HighlightPattern::setEscapeChar(const char32_t& _EscapeChar) { m_escapeChar = _EscapeChar; } -void appl::HighlightPattern::setColorGlyph(etk::UString& _colorName) { +void appl::HighlightPattern::setColorGlyph(std::string& _colorName) { m_colorName = _colorName; m_colorId = m_glyphPainting->request(m_colorName); APPL_VERBOSE("Resuest color name '" << m_colorName << "' => id=" << m_colorId); @@ -94,8 +94,8 @@ void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) { */ //-------------------------------------------------------------------------------------------- // process attribute - etk::UString highLightName = _child->getAttribute("name"); - etk::UString myEdnDataTmp = "???"; + std::string highLightName = _child->getAttribute("name"); + std::string myEdnDataTmp = "???"; if (highLightName.size()!=0) { myEdnDataTmp = highLightName; } @@ -104,34 +104,34 @@ void appl::HighlightPattern::parseRules(exml::Element* _child, int32_t _level) { exml::Element* xChild = _child->getNamed("color"); if (NULL != xChild) { - etk::UString myData = xChild->getText(); + std::string myData = xChild->getText(); if (myData.size() != 0) { //APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData); - etk::UString myEdnData = myData; + std::string myEdnData = myData; setColorGlyph(myEdnData); } } xChild = _child->getNamed("start"); if (NULL != xChild) { - etk::UString myData = xChild->getText(); + std::string myData = xChild->getText(); if (myData.size() != 0) { //APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData); - etk::UString myEdnData = myData; + std::string myEdnData = myData; setPaternStart(myEdnData); } } xChild = _child->getNamed("end"); if (NULL != xChild) { - etk::UString myData = xChild->getText(); + std::string myData = xChild->getText(); if (myData.size() != 0) { //APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData); - etk::UString myEdnData = myData; + std::string myEdnData = myData; setPaternStop(myEdnData); } } xChild = _child->getNamed("EscapeChar"); if (NULL != xChild) { - etk::UString myData = xChild->getText(); + std::string myData = xChild->getText(); if (myData.size() != 0) { //APPL_INFO(PFX"(l %d) node fined : %s=\"%s\"", xChild->Row(), xChild->Value() , myData); setEscapeChar(myData[0]); diff --git a/sources/appl/HighlightPattern.h b/sources/appl/HighlightPattern.h index d68f659..dd1781f 100644 --- a/sources/appl/HighlightPattern.h +++ b/sources/appl/HighlightPattern.h @@ -35,34 +35,34 @@ namespace appl { HighlightPattern(appl::GlyphPainting*& _glyphPainting); ~HighlightPattern(void); private: - etk::UString m_paternName; //!< Current style name (like "c++" or "c" or "script Bash") + std::string m_paternName; //!< Current style name (like "c++" or "c" or "script Bash") public: - void setName(etk::UString& _name) { + void setName(std::string& _name) { m_paternName = _name; }; - etk::UString getName(void) { + std::string getName(void) { return m_paternName; }; private: etk::RegExp* m_regExpStart; //!< Start of Regular expression public: - void setPaternStart(etk::UString& _regExp); + void setPaternStart(std::string& _regExp); private: etk::RegExp* m_regExpStop; //!< Stop of Regular Expression public: - void setPaternStop(etk::UString& _regExp); + void setPaternStop(std::string& _regExp); private: - etk::UString m_colorName; //!< Current color name + std::string m_colorName; //!< Current color name esize_t m_colorId; //!< Id of the the glyph painting public: - void setColorGlyph(etk::UString& _colorName); + void setColorGlyph(std::string& _colorName); const appl::GlyphDecoration& getColorGlyph(void) { return (*m_glyphPainting)[m_colorId]; }; private: - etk::UChar m_escapeChar; //!< Escape char to prevent exeit of patern .... + char32_t m_escapeChar; //!< Escape char to prevent exeit of patern .... public: - void setEscapeChar(const etk::UChar& _EscapeChar); + void setEscapeChar(const char32_t& _EscapeChar); private: bool m_multiline; //!< The patern is multiline public: diff --git a/sources/appl/TextPlugin.h b/sources/appl/TextPlugin.h index c31c68f..f505833 100644 --- a/sources/appl/TextPlugin.h +++ b/sources/appl/TextPlugin.h @@ -121,7 +121,7 @@ namespace appl { */ virtual bool onWrite(appl::TextViewer& _textDrawer, const appl::Buffer::Iterator& _pos, - const etk::UString& _data) { + const std::string& _data) { return false; }; protected: @@ -144,7 +144,7 @@ namespace appl { */ virtual bool onReplace(appl::TextViewer& _textDrawer, const appl::Buffer::Iterator& _pos, - const etk::UString& _data, + const std::string& _data, const appl::Buffer::Iterator& _posEnd) { return false; }; diff --git a/sources/appl/TextPluginAutoIndent.cpp b/sources/appl/TextPluginAutoIndent.cpp index bf082a3..4f0850b 100644 --- a/sources/appl/TextPluginAutoIndent.cpp +++ b/sources/appl/TextPluginAutoIndent.cpp @@ -43,16 +43,16 @@ bool appl::TextPluginAutoIndent::onEventEntry(appl::TextViewer& _textDrawer, startLine = _textDrawer.m_buffer->selectStart(); } startLine = _textDrawer.m_buffer->getStartLine(startLine); - etk::UString data = etk::UChar::Return; + std::string data = "\n"; for (appl::Buffer::Iterator it = startLine+1; (bool)it == true; ++it) { if (*it == etk::UChar::Space) { - data.append(etk::UChar::Space); + data += etk::UChar::Space; } else if(*it == etk::UChar::Tabulation) { - data.append(etk::UChar::Tabulation); + data += etk::UChar::Tabulation; } else { break; } diff --git a/sources/appl/TextPluginCopy.cpp b/sources/appl/TextPluginCopy.cpp index 48f6dbd..e0e671a 100644 --- a/sources/appl/TextPluginCopy.cpp +++ b/sources/appl/TextPluginCopy.cpp @@ -41,7 +41,7 @@ bool appl::TextPluginCopy::onReceiveMessage(appl::TextViewer& _textDrawer, if ( _msg.getMessage() == ednMsgGuiCopy || _msg.getMessage() == ednMsgGuiCut) { if (_textDrawer.m_buffer != NULL) { - etk::UString value; + std::string value; _textDrawer.m_buffer->copy(value); if (value.size() != 0) { ewol::clipBoard::set(ewol::clipBoard::clipboardStd, value); diff --git a/sources/appl/TextPluginHistory.cpp b/sources/appl/TextPluginHistory.cpp index 8d20c7f..a2acebe 100644 --- a/sources/appl/TextPluginHistory.cpp +++ b/sources/appl/TextPluginHistory.cpp @@ -49,12 +49,12 @@ bool appl::TextPluginHistory::onReceiveMessage(appl::TextViewer& _textDrawer, return true; } if (m_redo[m_redo.size()-1] == NULL) { - m_redo.popBack(); + m_redo.pop_back(); return true; } appl::History *tmpElement = m_redo[m_redo.size()-1]; - m_redo.popBack(); - m_undo.pushBack(tmpElement); + m_redo.pop_back(); + m_undo.push_back(tmpElement); _textDrawer.m_buffer->replace(tmpElement->m_addedText, _textDrawer.m_buffer->position(tmpElement->m_posAdded), _textDrawer.m_buffer->position(tmpElement->m_endPosRemoved) ); @@ -65,7 +65,7 @@ bool appl::TextPluginHistory::onReceiveMessage(appl::TextViewer& _textDrawer, return true; } if (m_undo[m_undo.size()-1] == NULL) { - m_undo.popBack(); + m_undo.pop_back(); return true; } /* @@ -80,8 +80,8 @@ bool appl::TextPluginHistory::onReceiveMessage(appl::TextViewer& _textDrawer, } */ appl::History *tmpElement = m_undo[m_undo.size()-1]; - m_undo.popBack(); - m_redo.pushBack(tmpElement); + m_undo.pop_back(); + m_redo.push_back(tmpElement); _textDrawer.m_buffer->replace(tmpElement->m_removedText, _textDrawer.m_buffer->position(tmpElement->m_posAdded), _textDrawer.m_buffer->position(tmpElement->m_endPosAdded) ); @@ -122,7 +122,7 @@ void appl::TextPluginHistory::clearUndo(void) { bool appl::TextPluginHistory::onWrite(appl::TextViewer& _textDrawer, const appl::Buffer::Iterator& _pos, - const etk::UString& _data) { + const std::string& _data) { if (isEnable() == false) { return false; } @@ -136,7 +136,7 @@ bool appl::TextPluginHistory::onWrite(appl::TextViewer& _textDrawer, if (tmpElement != NULL) { tmpElement->m_endPosAdded = (esize_t)_textDrawer.m_buffer->cursor(); clearRedo(); - m_undo.pushBack(tmpElement); + m_undo.push_back(tmpElement); } appl::textPluginManager::onCursorMove(_textDrawer, _textDrawer.m_buffer->cursor()); return true; @@ -144,7 +144,7 @@ bool appl::TextPluginHistory::onWrite(appl::TextViewer& _textDrawer, bool appl::TextPluginHistory::onReplace(appl::TextViewer& _textDrawer, const appl::Buffer::Iterator& _pos, - const etk::UString& _data, + const std::string& _data, const appl::Buffer::Iterator& _posEnd) { if (isEnable() == false) { return false; @@ -160,7 +160,7 @@ bool appl::TextPluginHistory::onReplace(appl::TextViewer& _textDrawer, if (tmpElement != NULL) { tmpElement->m_endPosAdded = (esize_t)_textDrawer.m_buffer->cursor(); clearRedo(); - m_undo.pushBack(tmpElement); + m_undo.push_back(tmpElement); } appl::textPluginManager::onCursorMove(_textDrawer, _textDrawer.m_buffer->cursor()); return true; @@ -180,7 +180,7 @@ bool appl::TextPluginHistory::onRemove(appl::TextViewer& _textDrawer, tmpElement->m_endPosRemoved = (esize_t)_posEnd; _textDrawer.m_buffer->copy(tmpElement->m_removedText, _pos, _posEnd); clearRedo(); - m_undo.pushBack(tmpElement); + m_undo.push_back(tmpElement); } _textDrawer.m_buffer->removeSelection(); appl::textPluginManager::onCursorMove(_textDrawer, _textDrawer.m_buffer->cursor()); diff --git a/sources/appl/TextPluginHistory.h b/sources/appl/TextPluginHistory.h index 5883de7..6f86e3d 100644 --- a/sources/appl/TextPluginHistory.h +++ b/sources/appl/TextPluginHistory.h @@ -24,8 +24,8 @@ namespace appl { m_endPosRemoved(0) { }; - etk::UString m_addedText; - etk::UString m_removedText; + std::string m_addedText; + std::string m_removedText; esize_t m_posAdded; esize_t m_endPosAdded; esize_t m_endPosRemoved; @@ -35,8 +35,8 @@ namespace appl { TextPluginHistory(void); ~TextPluginHistory(void); private: - etk::Vector m_undo; //!< History storing data - etk::Vector m_redo; //!< History storing data + std::vector m_undo; //!< History storing data + std::vector m_redo; //!< History storing data public: virtual void onPluginEnable(appl::TextViewer& _textDrawer); virtual void onPluginDisable(appl::TextViewer& _textDrawer); @@ -44,10 +44,10 @@ namespace appl { const ewol::EMessage& _msg); virtual bool onWrite(appl::TextViewer& _textDrawer, const appl::Buffer::Iterator& _pos, - const etk::UString& _data); + const std::string& _data); virtual bool onReplace(appl::TextViewer& _textDrawer, const appl::Buffer::Iterator& _pos, - const etk::UString& _data, + const std::string& _data, const appl::Buffer::Iterator& _posEnd); virtual bool onRemove(appl::TextViewer& _textDrawer, const appl::Buffer::Iterator& _pos, diff --git a/sources/appl/TextPluginManager.cpp b/sources/appl/TextPluginManager.cpp index 2359235..fa5536f 100644 --- a/sources/appl/TextPluginManager.cpp +++ b/sources/appl/TextPluginManager.cpp @@ -16,36 +16,36 @@ #undef __class__ #define __class__ "textPluginManager" -static etk::Vector& getList(void) { - static etk::Vector s_list; +static std::vector& getList(void) { + static std::vector s_list; return s_list; } -static etk::Vector& getListOnEventEntry(void) { - static etk::Vector s_list; +static std::vector& getListOnEventEntry(void) { + static std::vector s_list; return s_list; } -static etk::Vector& getListOnEventInput(void) { - static etk::Vector s_list; +static std::vector& getListOnEventInput(void) { + static std::vector s_list; return s_list; } -static etk::Vector& getListOnWrite(void) { - static etk::Vector s_list; +static std::vector& getListOnWrite(void) { + static std::vector s_list; return s_list; } -static etk::Vector& getListOnReplace(void) { - static etk::Vector s_list; +static std::vector& getListOnReplace(void) { + static std::vector s_list; return s_list; } -static etk::Vector& getListOnRemove(void) { - static etk::Vector s_list; +static std::vector& getListOnRemove(void) { + static std::vector s_list; return s_list; } -static etk::Vector& getListOnReceiveMessage(void) { - static etk::Vector s_list; +static std::vector& getListOnReceiveMessage(void) { + static std::vector s_list; return s_list; } -static etk::Vector& getListOnCursorMove(void) { - static etk::Vector s_list; +static std::vector& getListOnCursorMove(void) { + static std::vector s_list; return s_list; } @@ -84,27 +84,27 @@ void appl::textPluginManager::addPlugin(appl::TextViewerPlugin* _plugin) { if (_plugin == NULL) { return; } - getList().pushBack(_plugin); + getList().push_back(_plugin); if (_plugin->isAvaillableOnEventEntry() == true) { - getListOnEventEntry().pushBack(_plugin); + getListOnEventEntry().push_back(_plugin); } if (_plugin->isAvaillableOnEventInput() == true) { - getListOnEventInput().pushBack(_plugin); + getListOnEventInput().push_back(_plugin); } if (_plugin->isAvaillableOnWrite() == true) { - getListOnWrite().pushBack(_plugin); + getListOnWrite().push_back(_plugin); } if (_plugin->isAvaillableOnReplace() == true) { - getListOnReplace().pushBack(_plugin); + getListOnReplace().push_back(_plugin); } if (_plugin->isAvaillableOnRemove() == true) { - getListOnRemove().pushBack(_plugin); + getListOnRemove().push_back(_plugin); } if (_plugin->isAvaillableOnReceiveMessage() == true) { - getListOnReceiveMessage().pushBack(_plugin); + getListOnReceiveMessage().push_back(_plugin); } if (_plugin->isAvaillableOnCursorMove() == true) { - getListOnCursorMove().pushBack(_plugin); + getListOnCursorMove().push_back(_plugin); } } @@ -128,7 +128,7 @@ void appl::textPluginManager::disconnect(appl::TextViewer& _widget) { bool appl::textPluginManager::onEventEntry(appl::TextViewer& _textDrawer, const ewol::EventEntry& _event) { - etk::Vector& list = getListOnEventEntry(); + std::vector& list = getListOnEventEntry(); for (esize_t iii=0; iii& list = getListOnEventInput(); + std::vector& list = getListOnEventInput(); for (esize_t iii=0; iii& list = getListOnWrite(); + const std::string& _data) { + std::vector& list = getListOnWrite(); for (esize_t iii=0; iii& list = getListOnReplace(); + std::vector& list = getListOnReplace(); for (esize_t iii=0; iii& list = getListOnRemove(); + std::vector& list = getListOnRemove(); for (esize_t iii=0; iii& list = getListOnReceiveMessage(); + std::vector& list = getListOnReceiveMessage(); for (esize_t iii=0; iii& list = getListOnCursorMove(); + std::vector& list = getListOnCursorMove(); for (esize_t iii=0; iiigetStartLine(itStart); itStop = _textDrawer.m_buffer->getEndLine(itStop); // copy the curent data in a classicle string: - etk::UString data; + std::string data; _textDrawer.m_buffer->copy(data, itStart, itStop); // TODO : Change this ... bool m_useTabs = true; @@ -51,17 +51,17 @@ bool appl::TextPluginMultiLineTab::onEventEntry(appl::TextViewer& _textDrawer, if (true == _event.getSpecialKey().isSetShift() ) { // un-indent - data.add(0, etk::UChar::Return); + data.insert(0, 1, etk::UChar::Return); for (esize_t iii=1; iii m_historyList; + std::vector m_historyList; void registerHistory(void); }; @@ -126,7 +126,7 @@ void CTagsManager::onReceiveMessage(const ewol::EMessage& _msg) { // remove element .... delete(m_historyList[id]); m_historyList[id]=NULL; - m_historyList.popBack(); + m_historyList.pop_back(); } } else { @@ -140,7 +140,7 @@ void CTagsManager::onReceiveMessage(const ewol::EMessage& _msg) { sscanf(_msg.getData().c_str(), "%d:%s", &lineID, tmp); // generate envents sendMultiCast(ednMsgOpenFile, tmp); - sendMultiCast(ednMsgGuiGotoLine, lineID - 1); + sendMultiCast(ednMsgGuiGotoLine, std::to_string(lineID - 1)); } } @@ -174,7 +174,7 @@ void CTagsManager::registerHistory(void) { etk::FSNode * bufferFilename = new etk::FSNode(); *bufferFilename = tmpBuf->getFileName(); // TODO : bufferFilename->setLineNumber(tmpBuf->getCurrentLine()); - m_historyList.pushBack(bufferFilename); + m_historyList.push_back(bufferFilename); } */ } @@ -182,7 +182,7 @@ void CTagsManager::registerHistory(void) { void CTagsManager::jumpTo(void) { if (NULL != m_ctagFile) { // get the middle button of the clipboard == > represent the current selection ... - etk::UString data = ewol::clipBoard::get(ewol::clipBoard::clipboardSelection); + std::string data = ewol::clipBoard::get(ewol::clipBoard::clipboardSelection); APPL_DEBUG("clipboard data : \"" << data << "\""); if (data.size() == 0) { APPL_INFO("No current selection"); @@ -194,7 +194,7 @@ void CTagsManager::jumpTo(void) { int32_t numberOfTags = 0; // For all tags : Save in an internal Structure : - etk::UString tmpFile(m_tagFolderBase + "/" + entry.file); + std::string tmpFile(m_tagFolderBase + "/" + entry.file); etk::FSNode myfile(tmpFile); int32_t lineID = entry.address.lineNumber; printTag(&entry); @@ -220,7 +220,7 @@ void CTagsManager::jumpTo(void) { registerHistory(); APPL_INFO(" OPEN the TAG file Destination : " << tmpFile ); sendMultiCast(ednMsgOpenFile, myfile.getName()); - sendMultiCast(ednMsgGuiGotoLine, lineID - 1); + sendMultiCast(ednMsgGuiGotoLine, std::to_string(lineID - 1)); } } else { APPL_INFO("no tag find ..."); diff --git a/sources/appl/global.cpp b/sources/appl/global.cpp index c575414..85a0882 100644 --- a/sources/appl/global.cpp +++ b/sources/appl/global.cpp @@ -46,24 +46,24 @@ class myParamGlobal : public ewol::EObject { bool onSetConfig(const ewol::EConfig& _conf) { // Not set the EObject node parameter (name == > not change ...) if (_conf.getConfig() == configEOL) { - m_displayEOL = _conf.getData().toBool(); + m_displayEOL = stobool(_conf.getData()); return true; } if (_conf.getConfig() == configAutoIndent) { - m_AutoIndent = _conf.getData().toBool(); + m_AutoIndent = stobool(_conf.getData()); return true; } if (_conf.getConfig() == configShowTabChar) { - m_displayTabChar = _conf.getData().toBool(); + m_displayTabChar = stobool(_conf.getData()); return true; } if (_conf.getConfig() == configShowSpaceChar) { - m_displaySpaceChar = _conf.getData().toBool(); + m_displaySpaceChar = stobool(_conf.getData()); return true; } return false; } - bool onGetConfig(const char* _config, etk::UString& _result) const { + bool onGetConfig(const char* _config, std::string& _result) const { // Not set the EObject node parameter (name == > not change ...) if (_config == configEOL) { if (true == m_displayEOL) { diff --git a/sources/appl/init.cpp b/sources/appl/init.cpp index e7a29ce..66e81e8 100644 --- a/sources/appl/init.cpp +++ b/sources/appl/init.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include char32_t mychar32; @@ -48,37 +49,69 @@ int main(int _argc, const char *_argv[]) { appl::BufferManager* bufferManager = NULL; etk::CCout& operator <<(etk::CCout& _os, const std::u32string& _obj) { - etk::Vector tmpp; + std::vector tmpp; for (size_t iii=0; iii<_obj.size(); ++iii) { - tmpp.pushBack(_obj[iii]); + tmpp.push_back(_obj[iii]); } - etk::Vector output_UTF8; + std::vector output_UTF8; unicode::convertUnicodeToUtf8(tmpp, output_UTF8); - output_UTF8.pushBack('\0'); + output_UTF8.push_back('\0'); _os << &output_UTF8[0]; return _os; } +etk::CCout& operator <<(etk::CCout& _os, const std::regex_error& _e) { + int32_t val = _e.code(); + switch(val) { + case std::regex_constants::error_collate: + _os << "{ error_collate = The expression contained an invalid collating element name.}"; + break; + case std::regex_constants::error_ctype: + _os << "{ error_ctype = The expression contained an invalid character class name.}"; + break; + case std::regex_constants::error_escape: + _os << "{ error_escape = The expression contained an invalid escaped character, or a trailing escape.}"; + break; + case std::regex_constants::error_backref: + _os << "{ error_backref = The expression contained an invalid back reference.}"; + break; + case std::regex_constants::error_brack: + _os << "{ error_brack = The expression contained mismatched brackets ([ and ]).}"; + break; + case std::regex_constants::error_paren: + _os << "{ error_paren = The expression contained mismatched parentheses (( and )).}"; + break; + case std::regex_constants::error_brace: + _os << "{ error_brace = The expression contained mismatched braces ({ and }).}"; + break; + case std::regex_constants::error_badbrace: + _os << "{ error_badbrace = The expression contained an invalid range between braces ({ and }).}"; + break; + case std::regex_constants::error_range: + _os << "{ error_range = The expression contained an invalid character range.}"; + break; + case std::regex_constants::error_space: + _os << "{ error_space = There was insufficient memory to convert the expression into a finite state machine.}"; + break; + case std::regex_constants::error_badrepeat: + _os << "{ error_badrepeat = The expression contained a repeat specifier (one of *?+{) that was not preceded by a valid regular expression.}"; + break; + case std::regex_constants::error_complexity: + _os << "{ error_complexity = The complexity of an attempted match against a regular expression exceeded a pre-set level.}"; + break; + case std::regex_constants::error_stack: + _os << "{ error_stack = There was insufficient memory to determine whether the regular expression could match the specified character sequence.}"; + break; + } + return _os; +} + /** * @brief main application function initialisation */ bool APP_Init(ewol::eContext& _context) { APPL_INFO(" == > init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")"); - std::vector valueExample; - valueExample.push_back(23); - valueExample.push_back(23); - valueExample.push_back(23); - valueExample.push_back(23); - APPL_INFO("test de vector : " << valueExample[0]); - std::cout << "test de debug direct ..." << std::endl; - std::cerr << "test de debug direct .2." << std::endl; - std::u32string ploppppp; - ploppppp = U"exemple de texte sans accent : "; - APPL_INFO( "retert : " << ploppppp); - APPL_CRITICAL("kjkjhkjh"); - - // TODO : remove this : Move if in the windows properties _context.setSize(vec2(800, 600)); @@ -134,7 +167,7 @@ bool APP_Init(ewol::eContext& _context) { APPL_INFO("show list of files : "); bool ctagDetected = false; for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) { - etk::UString tmpppp = _context.getCmd().get(iii); + std::string tmpppp = _context.getCmd().get(iii); if (tmpppp == "-t") { ctagDetected = true; } else if (true == ctagDetected) {