[DEV] coding style review

This commit is contained in:
2013-10-09 22:00:24 +02:00
parent d677075e16
commit 730f637695
30 changed files with 611 additions and 832 deletions

View File

@@ -11,36 +11,29 @@
#include <appl/Debug.h>
appl::Buffer::Buffer(void) :
m_cursorPos(0),
m_cursorPreferredCol(-1)
{
m_cursorPos(0),
m_cursorPreferredCol(-1) {
}
bool appl::Buffer::loadFile(const etk::UString& _name)
{
bool appl::Buffer::loadFile(const etk::UString& _name) {
APPL_DEBUG("Load file : '" << _name << "'");
m_fileName = _name;
etk::FSNode file(m_fileName);
if (file.Exist() == false) {
if (file.exist() == false) {
return false;
}
if (true == m_data.DumpFrom(file) ) {
if (true == m_data.dumpFrom(file) ) {
return true;
}
return false;
}
void appl::Buffer::setFileName(const etk::UString& _name)
{
void appl::Buffer::setFileName(const etk::UString& _name) {
// TODO : ...
}
void appl::Buffer::MoveCursorRight(appl::Buffer::moveMode _mode)
{
void appl::Buffer::moveCursorRight(appl::Buffer::moveMode _mode) {
m_cursorPreferredCol = -1;
etk::UniChar value;
esize_t nbElement;
@@ -62,8 +55,7 @@ void appl::Buffer::MoveCursorRight(appl::Buffer::moveMode _mode)
}
void appl::Buffer::MoveCursorLeft(appl::Buffer::moveMode _mode)
{
void appl::Buffer::moveCursorLeft(appl::Buffer::moveMode _mode) {
m_cursorPreferredCol = -1;
etk::UniChar value;
esize_t nbElement;
@@ -84,72 +76,67 @@ void appl::Buffer::MoveCursorLeft(appl::Buffer::moveMode _mode)
}
}
void appl::Buffer::MoveCursorUp(esize_t _nbLine)
{
void appl::Buffer::moveCursorUp(esize_t _nbLine) {
// find the position of the start of the line.
esize_t lineStartPos = StartLine(m_cursorPos);
esize_t lineStartPos = startLine(m_cursorPos);
// check if we can go up ...
if (lineStartPos == 0) {
return;
}
// Decide what column to move to, if there's a preferred column use that
if (m_cursorPreferredCol < 0) {
m_cursorPreferredCol = CountDispChars(lineStartPos, m_cursorPos);
m_cursorPreferredCol = countDispChars(lineStartPos, m_cursorPos);
}
EWOL_DEBUG("ploop : " << m_cursorPreferredCol);
// get the previous line
esize_t prevLineStartPos = CountBackwardNLines(lineStartPos, _nbLine);
esize_t prevLineStartPos = countBackwardNLines(lineStartPos, _nbLine);
//APPL_INFO("Move line UP result : prevLineStartPos=" << prevLineStartPos);
// get the display char position
esize_t newPos = CountForwardDispChars(prevLineStartPos, m_cursorPreferredCol);
esize_t newPos = countForwardDispChars(prevLineStartPos, m_cursorPreferredCol);
//APPL_INFO("Move to colomn : column=" << column << " newPos=" << newPos);
//SetInsertPosition(newPos);
m_cursorPos = newPos;
}
void appl::Buffer::MoveCursorDown(esize_t _nbLine)
{
void appl::Buffer::moveCursorDown(esize_t _nbLine) {
// check if we are not at the end of Buffer
if (m_cursorPos == m_data.size() ) {
return;
}
// find the position of the start of the line.
esize_t lineStartPos = StartLine(m_cursorPos);
esize_t lineStartPos = startLine(m_cursorPos);
if (m_cursorPreferredCol < 0) {
m_cursorPreferredCol = CountDispChars(lineStartPos, m_cursorPos);
m_cursorPreferredCol = countDispChars(lineStartPos, m_cursorPos);
}
EWOL_DEBUG("ploop : " << m_cursorPreferredCol);
// get the next line :
esize_t nextLineStartPos = CountForwardNLines(lineStartPos, _nbLine);
esize_t nextLineStartPos = countForwardNLines(lineStartPos, _nbLine);
//APPL_INFO("Move line DOWN result : nextLineStartPos=" << nextLineStartPos);
// get the display char position
esize_t newPos = CountForwardDispChars(nextLineStartPos, m_cursorPreferredCol);
esize_t newPos = countForwardDispChars(nextLineStartPos, m_cursorPreferredCol);
//APPL_INFO("Move to colomn : column=" << column << " newPos=" << newPos);
//SetInsertPosition(newPos);
m_cursorPos = newPos;
}
esize_t appl::Buffer::StartLine(esize_t _pos)
{
esize_t appl::Buffer::startLine(esize_t _pos) {
esize_t startPos;
if (false == SearchBack(_pos, etk::UniChar::Return, startPos)) {
if (false == searchBack(_pos, etk::UniChar::Return, startPos)) {
return 0;
}
return startPos + 1;
}
esize_t appl::Buffer::EndLine(esize_t _pos)
{
esize_t appl::Buffer::endLine(esize_t _pos) {
esize_t endPos;
if (false == Search(_pos, etk::UniChar::Return, endPos)) {
if (false == search(_pos, etk::UniChar::Return, endPos)) {
endPos = m_data.size();
}
return endPos;
}
bool appl::Buffer::Search(esize_t _pos, const etk::UniChar& _search, esize_t& _result)
{
bool appl::Buffer::search(esize_t _pos, const etk::UniChar& _search, esize_t& _result) {
// move in the string
esize_t nbElementBuffer = 0;
etk::UniChar value;
@@ -167,8 +154,7 @@ bool appl::Buffer::Search(esize_t _pos, const etk::UniChar& _search, esize_t& _r
return false;
}
bool appl::Buffer::SearchBack(esize_t _pos, const etk::UniChar& _search, esize_t& _result)
{
bool appl::Buffer::searchBack(esize_t _pos, const etk::UniChar& _search, esize_t& _result) {
// move in the string
esize_t nbElementBuffer = 0;
etk::UniChar value;
@@ -185,10 +171,8 @@ bool appl::Buffer::SearchBack(esize_t _pos, const etk::UniChar& _search, esize_t
_result = 0;
return false;
}
bool appl::Buffer::onEventEntry(const ewol::EventEntry& _event) // TODO : , vec2 _displaySize)
{
// TODO : vec2 _displaySize
bool appl::Buffer::onEventEntry(const ewol::EventEntry& _event, ewol::Text& _testDrawer) {
//APPL_DEBUG(" event : " << _event);
if (_event.getType() == ewol::keyEvent::keyboardChar) {
//APPL_DEBUG("KB EVENT : \"" << UTF8_data << "\" size=" << strlen(UTF8_data) << "type=" << (int32_t)typeEvent);
@@ -219,13 +203,13 @@ bool appl::Buffer::onEventEntry(const ewol::EventEntry& _event) // TODO : , vec2
} else {
// normal adding char ...
char output[5];
int32_t nbElement = _event.getChar().GetUtf8(output);
int32_t nbElement = _event.getChar().getUtf8(output);
if (_event.getSpecialKey().isSetInsert() == false) {
m_data.insert(m_cursorPos, (int8_t*)output, nbElement);
} else {
etk::UniChar value;
esize_t nbElementRemove = get(m_cursorPos, value);
m_data.Replace(m_cursorPos, nbElementRemove, (int8_t*)output, nbElement);
m_data.replace(m_cursorPos, nbElementRemove, (int8_t*)output, nbElement);
}
m_cursorPos += nbElement;
}
@@ -238,19 +222,19 @@ bool appl::Buffer::onEventEntry(const ewol::EventEntry& _event) // TODO : , vec2
switch(_event.getType()) {
case ewol::keyEvent::keyboardLeft:
//APPL_INFO("keyEvent : <LEFT>");
MoveCursorLeft();
moveCursorLeft();
break;
case ewol::keyEvent::keyboardRight:
//APPL_INFO("keyEvent : <RIGHT>");
MoveCursorRight();
moveCursorRight();
break;
case ewol::keyEvent::keyboardUp:
//APPL_INFO("keyEvent : <UP>");
MoveCursorUp(1);
moveCursorUp(1);
break;
case ewol::keyEvent::keyboardDown:
//APPL_INFO("keyEvent : <DOWN>");
MoveCursorDown(1);
moveCursorDown(1);
break;
case ewol::keyEvent::keyboardPageUp:
//APPL_INFO("keyEvent : <PAGE-UP>");
@@ -262,11 +246,11 @@ bool appl::Buffer::onEventEntry(const ewol::EventEntry& _event) // TODO : , vec2
break;
case ewol::keyEvent::keyboardStart:
//APPL_INFO("keyEvent : <Start of line>");
MoveCursorLeft(moveEnd);
moveCursorLeft(moveEnd);
break;
case ewol::keyEvent::keyboardEnd:
//APPL_INFO("keyEvent : <End of line>");
MoveCursorRight(moveEnd);
moveCursorRight(moveEnd);
break;
default:
break;
@@ -282,8 +266,7 @@ bool appl::Buffer::onEventEntry(const ewol::EventEntry& _event) // TODO : , vec2
}
esize_t appl::Buffer::get(esize_t _pos, etk::UniChar& _value, unicode::charset_te _charset) const
{
esize_t appl::Buffer::get(esize_t _pos, etk::UniChar& _value, unicode::charset_te _charset) const {
_value = '\0';
if (_pos<0 && _pos<m_data.size()) {
return 0;
@@ -292,7 +275,7 @@ esize_t appl::Buffer::get(esize_t _pos, etk::UniChar& _value, unicode::charset_t
char tmpVal[5];
memset(tmpVal, 0, sizeof(tmpVal));
tmpVal[0] = m_data[_pos];
int8_t nbChar = etk::UniChar::TheoricUTF8Len(tmpVal[0]);
int8_t nbChar = etk::UniChar::theoricUTF8Len(tmpVal[0]);
for (int32_t iii=1; iii<nbChar && _pos+iii<m_data.size(); ++iii) {
tmpVal[iii] = m_data[_pos+iii];
}
@@ -305,8 +288,7 @@ esize_t appl::Buffer::get(esize_t _pos, etk::UniChar& _value, unicode::charset_t
return 1;
}
esize_t appl::Buffer::getBack(esize_t _pos, etk::UniChar& _value, unicode::charset_te _charset) const
{
esize_t appl::Buffer::getBack(esize_t _pos, etk::UniChar& _value, unicode::charset_te _charset) const {
_value = '\0';
if (_pos<0 && _pos<m_data.size()) {
return 0;
@@ -317,7 +299,7 @@ esize_t appl::Buffer::getBack(esize_t _pos, etk::UniChar& _value, unicode::chars
memset(tmpVal, 0, sizeof(tmpVal));
*pointerVal = m_data[_pos];
int32_t iii=0;
while( etk::UniChar::TheoricUTF8First(*pointerVal) == false
while( etk::UniChar::theoricUTF8First(*pointerVal) == false
&& pointerVal > tmpVal
&& _pos-iii>0) {
--pointerVal;
@@ -336,8 +318,7 @@ 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::UniChar& _value, etk::UString& _out) const
{
void appl::Buffer::expand(esize_t& _indent, const etk::UniChar& _value, etk::UString& _out) const {
_out.clear();
int32_t tabDist = 4;
if (_value == etk::UniChar::Tabulation) {
@@ -383,8 +364,7 @@ void appl::Buffer::Expand(esize_t& _indent, const etk::UniChar& _value, etk::USt
//APPL_DEBUG("plop : " << _out);
}
int32_t appl::Buffer::CountDispChars(esize_t _posStart, esize_t _posEnd)
{
int32_t appl::Buffer::countDispChars(esize_t _posStart, esize_t _posEnd) {
int32_t charCount = 0;
etk::UString expanded;
esize_t bufferElementSize;
@@ -394,7 +374,7 @@ int32_t appl::Buffer::CountDispChars(esize_t _posStart, esize_t _posEnd)
// get the element value:
bufferElementSize = get(iii, value);
//APPL_DEBUG(" get : " << value << " size=" << bufferElementSize);
Expand(charCount, value, expanded);
expand(charCount, value, expanded);
charCount += expanded.size();
if (bufferElementSize <= 0) {
bufferElementSize = 1;
@@ -404,8 +384,7 @@ int32_t appl::Buffer::CountDispChars(esize_t _posStart, esize_t _posEnd)
return charCount;
}
esize_t appl::Buffer::CountForwardDispChars(esize_t _posStart, int32_t _nChars)
{
esize_t appl::Buffer::countForwardDispChars(esize_t _posStart, int32_t _nChars) {
int32_t charCount = 0;
etk::UString expanded;
esize_t bufferElementSize;
@@ -417,7 +396,7 @@ esize_t appl::Buffer::CountForwardDispChars(esize_t _posStart, int32_t _nChars)
if (value == etk::UniChar::Return) {
return iii;
}
Expand(charCount, value, expanded);
expand(charCount, value, expanded);
charCount += expanded.size();
if (bufferElementSize <= 0) {
bufferElementSize = 1;
@@ -427,8 +406,7 @@ esize_t appl::Buffer::CountForwardDispChars(esize_t _posStart, int32_t _nChars)
return iii;
}
esize_t appl::Buffer::CountForwardNLines(esize_t _startPos, int32_t _nLines)
{
esize_t appl::Buffer::countForwardNLines(esize_t _startPos, int32_t _nLines) {
if (_nLines <= 0) {
return _startPos;
} else if (_startPos > m_data.size() ) {
@@ -456,8 +434,7 @@ esize_t appl::Buffer::CountForwardNLines(esize_t _startPos, int32_t _nLines)
return m_data.size();
}
esize_t appl::Buffer::CountBackwardNLines(esize_t _startPos, int32_t _nLines)
{
esize_t appl::Buffer::countBackwardNLines(esize_t _startPos, int32_t _nLines) {
if (_startPos <= 0) {
return 0;
} else if (_startPos > m_data.size() ) {

View File

@@ -16,11 +16,10 @@
#include <etk/Buffer.h>
#include <ewol/renderer/EObject.h>
#include <ewol/widget/Widget.h>
#include <ewol/compositing/Text.h>
namespace appl
{
class Buffer : public ewol::EObject
{
namespace appl {
class Buffer : public ewol::EObject {
public:
Buffer(void);
~Buffer(void) { };
@@ -30,13 +29,17 @@ namespace appl
/**
* @brief get the curent filename of the Buffer
*/
const etk::UString& getFileName(void) { return m_fileName; }
const etk::UString& getFileName(void) {
return m_fileName;
}
bool loadFile(const etk::UString& _name);
void setFileName(const etk::UString& _name);
bool m_isModify; //!< true if the file is modify
etk::Buffer m_data; //!< copy of the file buffer
public:
etk::Buffer& getData(void) { return m_data; };
etk::Buffer& getData(void) {
return m_data;
};
/*
appl::History m_history;
Highlight m_highlight;
@@ -46,7 +49,8 @@ namespace appl
public:
esize_t m_cursorPos; //!< cursor position.
int32_t m_cursorPreferredCol; //!< position of the cursor when up and down is done.
bool onEventEntry(const ewol::EventEntry& _event);
// note : We need the text drawer interface due to the fact that the move depend on the text display properties.
bool onEventEntry(const ewol::EventEntry& _event, ewol::Text& _testDrawer);
/**
* @brief get the next element in the buffer.
* @param[in] _pos Position in the buffer
@@ -69,7 +73,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::UniChar& _value, etk::UString& _out) const;
void expand(esize_t& _indent, const etk::UniChar& _value, etk::UString& _out) const;
private:
enum moveMode {
moveLetter,
@@ -80,34 +84,34 @@ namespace appl
* Move the cursor right in the line (no stop of a new line)
* @param[in] _mode Moving mode char, word, ...
*/
void MoveCursorRight(moveMode _mode = moveLetter);
void moveCursorRight(moveMode _mode = moveLetter);
/**
* Move the cursor left in the line (no stop of a new line)
* @param[in] _mode Moving mode char, word, ...
*/
void MoveCursorLeft(moveMode _mode = moveLetter);
void moveCursorLeft(moveMode _mode = moveLetter);
/**
* @brief Move the cursor at an other position upper.
* @param[in] _nbLine number of up line that might be moved
*/
void MoveCursorUp(esize_t _nbLine);
void moveCursorUp(esize_t _nbLine);
/**
* @brief Move the cursor at an other position under.
* @param[in] _nbLine number of down line that might be moved
*/
void MoveCursorDown(esize_t _nbLine);
void moveCursorDown(esize_t _nbLine);
/**
* @brief get the start of a line with the position in the buffer.
* @param[in] _pos position in the buffer.
* @return The position in the buffer of the start of the line.
*/
esize_t StartLine(esize_t _pos);
esize_t startLine(esize_t _pos);
/**
* @brief get the end of a line with the position in the buffer.
* @param[in] _pos position in the buffer.
* @return The position in the buffer of the end of the line.
*/
esize_t EndLine(esize_t _pos);
esize_t endLine(esize_t _pos);
/**
* @brief Search a character in the buffer.
* @param[in] _pos Position to start the search of the element.
@@ -115,7 +119,7 @@ namespace appl
* @param[out] _result Research position.
* @return true if pos if fined.
*/
bool Search(esize_t _pos, const etk::UniChar& _search, esize_t& _result);
bool search(esize_t _pos, const etk::UniChar& _search, esize_t& _result);
/**
* @brief Search a character in the buffer in back mode.
* @param[in] _pos Position to start the search of the element.
@@ -123,7 +127,7 @@ namespace appl
* @param[out] _result Research position.
* @return true if pos if fined.
*/
bool SearchBack(esize_t _pos, const etk::UniChar& _search, esize_t& _result);
bool searchBack(esize_t _pos, const etk::UniChar& _search, esize_t& _result);
/**
* @brief Count the number of displayed characters between buffer position
* displayed characters are the characters shown on the screen to represent characters in the
@@ -132,28 +136,28 @@ namespace appl
* @param[in] _posEnd End position
* @return the ID in the buffer of the requested char
*/
int32_t CountDispChars(esize_t _posStart, esize_t _posEnd);
int32_t countDispChars(esize_t _posStart, esize_t _posEnd);
/**
* @brief Return the position of the nth diplaye char
* @param[in] _posStart Position of the start
* @param[in] _nChars search in the next nChars elements
* @return position of the char i the buffer
*/
esize_t CountForwardDispChars(esize_t _posStart, int32_t _nChars);
esize_t countForwardDispChars(esize_t _posStart, int32_t _nChars);
/**
* @brief find the first character of the line "nLines" forward
* @param[in,out] _startPos Start position.
* @param[in,out] _nLines Number of line to count.
* @return position of the starting the line.
*/
esize_t CountForwardNLines(esize_t _startPos, int32_t _nLines);
esize_t countForwardNLines(esize_t _startPos, int32_t _nLines);
/**
* @brief find the first character of the line "nLines" backwards
* @param[in,out] _startPos Start position to count (this caracter is not counted)
* @param[in,out] _nLines Number of line to count (if == 0 means find the beginning of the line)
* @return position of the starting the line
*/
esize_t CountBackwardNLines(esize_t _startPos, int32_t _nLines);
esize_t countBackwardNLines(esize_t _startPos, int32_t _nLines);
};
};

View File

@@ -14,9 +14,8 @@
#undef __class__
#define __class__ "classBufferManager"
class classBufferManager: public ewol::EObject
{
#if 0
class classBufferManager: public ewol::EObject {
public:
// Constructeur
classBufferManager(void);
@@ -30,7 +29,7 @@ class classBufferManager: public ewol::EObject
private:
// return the ID of the buffer allocated
// create a buffer with no element
int32_t Create(void);
int32_t create(void);
// open curent filename
int32_t open(etk::FSNode &myFile);
bool remove(int32_t BufferID);
@@ -38,13 +37,13 @@ class classBufferManager: public ewol::EObject
int32_t getSelected(void) { return m_idSelected;};
//void setSelected(int32_t id) {m_idSelected = id;};
BufferText* get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(etk::FSNode &myFile);
bool exist(int32_t BufferID);
bool exist(etk::FSNode &myFile);
int32_t getId(etk::FSNode &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close == > return 5
uint32_t size(void);
uint32_t sizeOpen(void);
int32_t WitchBuffer(int32_t iEmeElement);
int32_t witchBuffer(int32_t iEmeElement);
private:
@@ -234,22 +233,7 @@ void classBufferManager::onReceiveMessage(const ewol::EMessage& _msg)
*/
}
/**
* @brief remove all buffer opened
*
* @param[in,out] ---
*
* @return ---
*
*/
void classBufferManager::removeAll(void)
{
void classBufferManager::removeAll(void) {
int32_t i;
for (i=0; i<listBuffer.size(); i++) {
remove(i);
@@ -261,14 +245,9 @@ void classBufferManager::removeAll(void)
/**
* @brief Create a new buffer with no name and empty
*
* @param[in,out] ---
*
* @return The ID of the curent buffer where the file is loaded
*
*/
int32_t classBufferManager::Create(void)
{
int32_t classBufferManager::create(void) {
// allocate a new Buffer
BufferText *myBuffer = new BufferText();
// add at the list of element
@@ -280,17 +259,12 @@ int32_t classBufferManager::Create(void)
/**
* @brief open a file with the name set in parameters
*
* @param[in] filename curent filename
*
* @param[in] filename curent filename
* @return The ID of the curent buffer where the file is loaded
*
* @todo : check if this file is not curently open and return the old ID
*
*/
int32_t classBufferManager::open(etk::FSNode &myFile)
{
if (false == Exist(myFile)) {
int32_t classBufferManager::open(etk::FSNode &myFile) {
if (false == exist(myFile)) {
// allocate a new Buffer
BufferText *myBuffer = new BufferText(myFile);
// add at the list of element
@@ -302,10 +276,7 @@ int32_t classBufferManager::open(etk::FSNode &myFile)
}
}
BufferText * classBufferManager::get(int32_t BufferID)
{
BufferText * classBufferManager::get(int32_t BufferID) {
// possible special case : -1;
if (-1 >= BufferID) {
return NULL;
@@ -324,9 +295,7 @@ BufferText * classBufferManager::get(int32_t BufferID)
return NULL;
}
bool classBufferManager::Exist(int32_t BufferID)
{
bool classBufferManager::exist(int32_t BufferID) {
if (-1 >= BufferID) {
return false;
}
@@ -340,18 +309,14 @@ bool classBufferManager::Exist(int32_t BufferID)
return false;
}
bool classBufferManager::Exist(etk::FSNode &myFile )
{
bool classBufferManager::exist(etk::FSNode &myFile) {
if (-1 == getId(myFile)) {
return false;
}
return true;
}
int32_t classBufferManager::getId(etk::FSNode &myFile)
{
int32_t classBufferManager::getId(etk::FSNode &myFile) {
int32_t iii;
// check if the Buffer existed
for (iii=0; iii < listBuffer.size(); iii++) {
@@ -367,14 +332,12 @@ int32_t classBufferManager::getId(etk::FSNode &myFile)
// return the number of buffer (open in the past) if 5 buffer open and 4 close == > return 5
uint32_t classBufferManager::size(void)
{
uint32_t classBufferManager::size(void) {
return listBuffer.size();
}
// nb of opens file Now ...
uint32_t classBufferManager::sizeOpen(void)
{
uint32_t classBufferManager::sizeOpen(void) {
uint32_t jjj = 0;
// check if the Buffer existed
for (int32_t iii=0; iii<listBuffer.size(); iii++) {
@@ -386,16 +349,7 @@ uint32_t classBufferManager::sizeOpen(void)
return jjj;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
bool classBufferManager::remove(int32_t BufferID)
{
bool classBufferManager::remove(int32_t BufferID) {
if (-1 >= BufferID) {
return false;
}
@@ -427,15 +381,9 @@ bool classBufferManager::remove(int32_t BufferID)
}
/**
* @brief to get the element 14 in the buffer
*
* @param[in,out] ---
*
* @return ---
*
* @brief to get the element 14 in the buffer
*/
int32_t classBufferManager::WitchBuffer(int32_t iEmeElement)
{
int32_t classBufferManager::witchBuffer(int32_t iEmeElement) {
int32_t i;
for (i=0; i<listBuffer.size(); i++) {
if (NULL != listBuffer[i]) {
@@ -455,9 +403,9 @@ int32_t classBufferManager::WitchBuffer(int32_t iEmeElement)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static classBufferManager * localManager = NULL;
void BufferManager::init(void)
{
#endif
void BufferManager::init(void) {
/*
if (NULL != localManager) {
EWOL_ERROR("classBufferManager == > already exist, just unlink the previous ...");
localManager = NULL;
@@ -467,88 +415,106 @@ void BufferManager::init(void)
if (NULL == localManager) {
EWOL_CRITICAL("Allocation of classBufferManager not done ...");
}
*/
}
void BufferManager::UnInit(void)
{
void BufferManager::unInit(void) {
/*
if (NULL == localManager) {
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return;
}
delete(localManager);
localManager = NULL;
*/
}
int32_t BufferManager::getSelected(void)
{
int32_t BufferManager::getSelected(void) {
/*
if (NULL == localManager) {
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return -1;
}
return localManager->getSelected();
*/
return -1;
}
BufferText * BufferManager::get(int32_t BufferID)
{
appl::Buffer * BufferManager::get(int32_t BufferID) {
/*
if (NULL == localManager) {
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return NULL;
}
return localManager->get(BufferID);
*/
return NULL;
}
bool BufferManager::Exist(int32_t BufferID)
{
bool BufferManager::exist(int32_t BufferID) {
/*
if (NULL == localManager) {
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return false;
}
return localManager->Exist(BufferID);
return localManager->exist(BufferID);
*/
return false;
}
bool BufferManager::Exist(etk::FSNode &myFile)
{
bool BufferManager::exist(etk::FSNode &myFile) {
/*
if (NULL == localManager) {
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return false;
}
return localManager->Exist(myFile);
return localManager->exist(myFile);
*/
return false;
}
int32_t BufferManager::getId(etk::FSNode &myFile)
{
int32_t BufferManager::getId(etk::FSNode &myFile) {
/*
if (NULL == localManager) {
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return -1;
}
return localManager->getId(myFile);
*/
return -1;
}
uint32_t BufferManager::size(void)
{
uint32_t BufferManager::size(void) {
/*
if (NULL == localManager) {
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return 0;
}
return localManager->size();
*/
return 0;
}
uint32_t BufferManager::sizeOpen(void)
{
uint32_t BufferManager::sizeOpen(void) {
/*
if (NULL == localManager) {
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return 0;
}
return localManager->sizeOpen();
*/
return 0;
}
int32_t BufferManager::WitchBuffer(int32_t iEmeElement)
{
int32_t BufferManager::witchBuffer(int32_t iEmeElement) {
/*
if (NULL == localManager) {
EWOL_ERROR("classBufferManager == > request UnInit, but does not exist ...");
return -1;
}
return localManager->WitchBuffer(iEmeElement);
return localManager->witchBuffer(iEmeElement);
*/
return -1;
}

View File

@@ -9,23 +9,23 @@
#ifndef __BUFFER_MANAGER_H__
#define __BUFFER_MANAGER_H__
#include <BufferText.h>
#include <Buffer.h>
#include <appl/globalMsg.h>
#include <ewol/widget/Widget.h>
namespace BufferManager
{
void init(void);
void UnInit(void);
void unInit(void);
int32_t getSelected(void);
BufferText* get(int32_t BufferID);
bool Exist(int32_t BufferID);
bool Exist(etk::FSNode &myFile);
appl::Buffer* get(int32_t BufferID);
bool exist(int32_t BufferID);
bool exist(etk::FSNode &myFile);
int32_t getId(etk::FSNode &myFile);
// return the number of buffer (open in the past) if 5 buffer open and 4 close == > return 5
uint32_t size(void);
uint32_t sizeOpen(void);
int32_t WitchBuffer(int32_t iEmeElement);
int32_t witchBuffer(int32_t iEmeElement);
};
#endif