[DEV] continue removing stl

This commit is contained in:
Edouard DUPIN 2017-08-28 00:06:04 +02:00
parent 190376859f
commit 0071818a2d
53 changed files with 345 additions and 345 deletions

View File

@ -120,23 +120,23 @@ vec2 gale::Application::getPosition() const {
return vec2(0,0);
}
void gale::Application::setTitle(const std::string& _title) {
void gale::Application::setTitle(const etk::String& _title) {
m_title = _title;
gale::Context& context = gale::getContext();
context.setTitle(m_title);
}
std::string gale::Application::getTitle() {
etk::String gale::Application::getTitle() {
return m_title;
}
void gale::Application::setIcon(const std::string& _iconFile) {
void gale::Application::setIcon(const etk::String& _iconFile) {
m_iconName = _iconFile;
gale::Context& context = gale::getContext();
context.setIcon(m_iconName);
}
std::string gale::Application::getIcon() {
etk::String gale::Application::getIcon() {
return m_iconName;
}
@ -150,7 +150,7 @@ enum gale::context::cursor gale::Application::getCursor() {
return m_cursor;
}
void gale::Application::openURL(const std::string& _url) {
void gale::Application::openURL(const etk::String& _url) {
gale::Context& context = gale::getContext();
context.openURL(_url);
}

View File

@ -145,31 +145,31 @@ namespace gale {
*/
virtual vec2 getPosition() const;
private:
std::string m_title;
etk::String m_title;
public:
/**
* @brief Set the title of the application
* @param[in] _title New title to set at the application (if possible: Android and Ios does not support it)
*/
virtual void setTitle(const std::string& _title);
virtual void setTitle(const etk::String& _title);
/**
* @brief Get the current title of the application
* @return Current title
*/
virtual std::string getTitle();
virtual etk::String getTitle();
private:
std::string m_iconName;
etk::String m_iconName;
public:
/**
* @brief set the Icon of the application.
* @param[in] _iconFile File name icon (.bmp/.png).
*/
virtual void setIcon(const std::string& _iconFile);
virtual void setIcon(const etk::String& _iconFile);
/**
* @brief Get the current filename of the application.
* @return Filename of the icon.
*/
virtual std::string getIcon();
virtual etk::String getIcon();
private:
enum gale::context::cursor m_cursor;
public:
@ -188,7 +188,7 @@ namespace gale {
* @brief Open an URL on an internal brother.
* @param[in] _url URL to open.
*/
virtual void openURL(const std::string& _url);
virtual void openURL(const etk::String& _url);
private:
enum gale::orientation m_orientation;
public:

View File

@ -80,7 +80,7 @@ gale::Dimension::Dimension(const vec2& _size, enum gale::distance _type) :
set(_size, _type);
}
void gale::Dimension::set(std::string _config) {
void gale::Dimension::set(etk::String _config) {
m_data.setValue(0,0);
m_type = gale::distance::pixel;
enum distance type = gale::distance::pixel;
@ -121,8 +121,8 @@ gale::Dimension::~Dimension() {
// nothing to do ...
}
gale::Dimension::operator std::string() const {
std::string str;
gale::Dimension::operator etk::String() const {
etk::String str;
str = get(getType());
switch(getType()) {
@ -178,12 +178,12 @@ vec2 gale::Dimension::get(enum gale::distance _type) const {
void gale::Dimension::set(const vec2& _size, enum gale::distance _type) {
// set min max on input to limit error :
vec2 size(std::avg(0.0f,_size.x(),9999999.0f),
std::avg(0.0f,_size.y(),9999999.0f));
vec2 size(etk::avg(0.0f,_size.x(),9999999.0f),
etk::avg(0.0f,_size.y(),9999999.0f));
switch(_type) {
case gale::distance::pourcent: {
vec2 size2(std::avg(0.0f,_size.x(),100.0f),
std::avg(0.0f,_size.y(),100.0f));
vec2 size2(etk::avg(0.0f,_size.x(),100.0f),
etk::avg(0.0f,_size.y(),100.0f));
m_data = vec2(size2.x()*0.01f, size2.y()*0.01f);
//GALE_VERBOSE("Set % : " << size2 << " == > " << m_data);
break;
@ -259,7 +259,7 @@ vec2 gale::Dimension::getFoot() const {
return gale::Dimension::getMillimeter()*millimeterToFoot;
}
std::ostream& gale::operator <<(std::ostream& _os, enum gale::distance _obj) {
etk::Stream& gale::operator <<(etk::Stream& _os, enum gale::distance _obj) {
switch(_obj) {
case gale::distance::pourcent:
_os << "%";
@ -289,24 +289,24 @@ std::ostream& gale::operator <<(std::ostream& _os, enum gale::distance _obj) {
return _os;
}
std::ostream& gale::operator <<(std::ostream& _os, const gale::Dimension& _obj) {
etk::Stream& gale::operator <<(etk::Stream& _os, const gale::Dimension& _obj) {
_os << _obj.get(_obj.getType()) << _obj.getType();
return _os;
}
namespace etk {
template<> std::string to_string<gale::Dimension>(const gale::Dimension& _obj) {
template<> etk::String toString<gale::Dimension>(const gale::Dimension& _obj) {
return _obj;
}
template<> std::u32string to_u32string<gale::Dimension>(const gale::Dimension& _obj) {
return etk::to_u32string(etk::to_string(_obj));
template<> etk::UString toUString<gale::Dimension>(const gale::Dimension& _obj) {
return etk::toUString(etk::toString(_obj));
}
template<> bool from_string<gale::Dimension>(gale::Dimension& _variableRet, const std::string& _value) {
template<> bool from_string<gale::Dimension>(gale::Dimension& _variableRet, const etk::String& _value) {
_variableRet = gale::Dimension(_value);
return true;
}
template<> bool from_string<gale::Dimension>(gale::Dimension& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
template<> bool from_string<gale::Dimension>(gale::Dimension& _variableRet, const etk::UString& _value) {
return from_string(_variableRet, etk::toString(_value));
}
};

View File

@ -43,7 +43,7 @@ namespace gale {
* @brief Constructor
* @param[in] _config dimension configuration.
*/
Dimension(const std::string& _config) :
Dimension(const etk::String& _config) :
m_data(0,0),
m_type(gale::distance::pixel) {
set(_config);
@ -65,7 +65,7 @@ namespace gale {
/**
* @brief string cast :
*/
operator std::string() const;
operator etk::String() const;
/**
* @brief get the current dimention in requested type
@ -85,7 +85,7 @@ namespace gale {
* @brief set the current dimention in requested type
* @param[in] _config dimension configuration.
*/
void set(std::string _config);
void set(etk::String _config);
public:
/**
* @brief get the current dimention in pixel
@ -199,7 +199,7 @@ namespace gale {
static float getWindowsDiag(enum gale::distance _type);
};
std::ostream& operator <<(std::ostream& _os, enum gale::distance _obj);
std::ostream& operator <<(std::ostream& _os, const gale::Dimension& _obj);
etk::Stream& operator <<(etk::Stream& _os, enum gale::distance _obj);
etk::Stream& operator <<(etk::Stream& _os, const gale::Dimension& _obj);
}

View File

@ -131,6 +131,6 @@ enum gale::Thread::state gale::Thread::getState() {
return m_state;
}
void gale::Thread::setName(std::string _name) {
void gale::Thread::setName(etk::String _name) {
m_name = _name;
}

View File

@ -63,14 +63,14 @@ namespace gale {
*/
virtual void stop();
private:
std::string m_name; //!< thread Name
etk::String m_name; //!< thread Name
echrono::Steady m_lastUpdatateName;
public:
/**
* @brief change name of the thread
* @param[in] _name Name of the thread
*/
void setName(std::string m_name);
void setName(etk::String m_name);
private:
#if defined(__TARGET_OS__Android)
static void* threadCallback(void* _userData);

View File

@ -355,7 +355,7 @@ class AndroidContext : public gale::Context {
java_detach_current_thread(status);
}
void setTitle(const std::string& _title) {
void setTitle(const etk::String& _title) {
GALE_DEBUG("C->java : send message to the java : \"" << _title << "\"");
if (m_javaApplicationType == appl_application) {
int status;
@ -374,7 +374,7 @@ class AndroidContext : public gale::Context {
}
}
void openURL(const std::string& _url) {
void openURL(const etk::String& _url) {
GALE_DEBUG("C->java : send message to the java : open URL'" << _url << "'");
int status;
if(!java_attach_current_thread(&status)) {
@ -491,7 +491,7 @@ class AndroidContext : public gale::Context {
}
};
static std::vector<AndroidContext*> s_listInstance;
static etk::Vector<AndroidContext*> s_listInstance;
gale::Application* s_applicationInit = NULL;
extern "C" {
@ -559,7 +559,7 @@ extern "C" {
return -1;
}
// for future case : all time this ...
s_listInstance.push_back(tmpContext);
s_listInstance.pushBack(tmpContext);
int32_t newID = s_listInstance.size()-1;
return newID;
}

View File

@ -21,7 +21,7 @@
#include <gale/renderer/openGL/openGL.hpp>
#include <gale/context/Context.hpp>
#include <gale/resource/Manager.hpp>
#include <map>
#include <etk/Map.hpp>
#include <echrono/Steady.hpp>
@ -37,17 +37,17 @@ static std::mutex& mutexInterface() {
static std::mutex g_lockContextMap;
static std::map<std::thread::id, gale::Context*>& getContextList() {
static std::map<std::thread::id, gale::Context*> g_val;
static etk::Map<std::thread::id, gale::Context*>& getContextList() {
static etk::Map<std::thread::id, gale::Context*> g_val;
return g_val;
}
static gale::Context* lastContextSet = nullptr;
gale::Context& gale::getContext() {
std::map<std::thread::id, gale::Context*>& list = getContextList();
etk::Map<std::thread::id, gale::Context*>& list = getContextList();
g_lockContextMap.lock();
std::map<std::thread::id, gale::Context*>::iterator it = list.find(std::this_thread::get_id());
etk::Map<std::thread::id, gale::Context*>::iterator it = list.find(std::this_thread::get_id());
gale::Context* out = nullptr;
if (it != list.end()) {
out = it->second;
@ -85,15 +85,15 @@ gale::Context& gale::getContext() {
}
void gale::setContext(gale::Context* _context) {
std::map<std::thread::id, gale::Context*>& list = getContextList();
etk::Map<std::thread::id, gale::Context*>& list = getContextList();
//GALE_ERROR("Set context : " << std::this_thread::get_id() << " context pointer : " << uint64_t(_context));
g_lockContextMap.lock();
if (_context != nullptr) {
lastContextSet = _context;
}
std::map<std::thread::id, gale::Context*>::iterator it = list.find(std::this_thread::get_id());
etk::Map<std::thread::id, gale::Context*>::iterator it = list.find(std::this_thread::get_id());
if (it == list.end()) {
list.insert(std::pair<std::thread::id, gale::Context*>(std::this_thread::get_id(), _context));
list.insert(etk::Pair<std::thread::id, gale::Context*>(std::this_thread::get_id(), _context));
} else {
it->second = _context;
}
@ -105,12 +105,12 @@ void gale::contextRegisterThread(std::thread* _thread) {
return;
}
gale::Context* context = &gale::getContext();
std::map<std::thread::id, gale::Context*>& list = getContextList();
etk::Map<std::thread::id, gale::Context*>& list = getContextList();
//GALE_ERROR("REGISTER Thread : " << _thread->get_id() << " context pointer : " << uint64_t(context));
g_lockContextMap.lock();
std::map<std::thread::id, gale::Context*>::iterator it = list.find(_thread->get_id());
etk::Map<std::thread::id, gale::Context*>::iterator it = list.find(_thread->get_id());
if (it == list.end()) {
list.insert(std::pair<std::thread::id, gale::Context*>(_thread->get_id(), context));
list.insert(etk::Pair<std::thread::id, gale::Context*>(_thread->get_id(), context));
} else {
it->second = context;
}
@ -121,16 +121,16 @@ void gale::contextUnRegisterThread(std::thread* _thread) {
if (_thread == nullptr) {
return;
}
std::map<std::thread::id, gale::Context*>& list = getContextList();
etk::Map<std::thread::id, gale::Context*>& list = getContextList();
g_lockContextMap.lock();
std::map<std::thread::id, gale::Context*>::iterator it = list.find(_thread->get_id());
etk::Map<std::thread::id, gale::Context*>::iterator it = list.find(_thread->get_id());
if (it != list.end()) {
list.erase(it);
}
g_lockContextMap.unlock();
}
void gale::Context::setInitImage(const std::string& _fileName) {
void gale::Context::setInitImage(const etk::String& _fileName) {
//m_initDisplayImageName = _fileName;
}
@ -269,7 +269,7 @@ gale::Context::Context(gale::Application* _application, int32_t _argc, const cha
if (m_commandLine.get(iii) == "--gale-fps") {
m_displayFps=true;
} else if (etk::start_with(m_commandLine.get(iii), "--gale-simulation-file=") == true) {
m_simulationFile.setName(std::string(m_commandLine.get(iii).begin()+23, m_commandLine.get(iii).end()) );
m_simulationFile.setName(etk::String(m_commandLine.get(iii).begin()+23, m_commandLine.get(iii).end()) );
} else if (m_commandLine.get(iii) == "--gale-simulation-record") {
m_simulationActive = true;
} else if (etk::start_with(m_commandLine.get(iii), "--gale-backend=") == true) {
@ -345,7 +345,7 @@ gale::Context::Context(gale::Application* _application, int32_t _argc, const cha
GALE_CRITICAL("Can not create Simulation file : " << m_simulationFile);
m_simulationActive = false;
} else {
m_simulationFile.filePuts(etk::to_string(echrono::Steady::now()));
m_simulationFile.filePuts(etk::toString(echrono::Steady::now()));
m_simulationFile.filePuts(":INIT");
m_simulationFile.filePuts("\n");
}
@ -428,7 +428,7 @@ gale::Context::~Context() {
void gale::Context::requestUpdateSize() {
if (m_simulationActive == true) {
m_simulationFile.filePuts(etk::to_string(echrono::Steady::now()));
m_simulationFile.filePuts(etk::toString(echrono::Steady::now()));
m_simulationFile.filePuts(":RECALCULATE_SIZE\n");
}
std::unique_lock<std::recursive_mutex> lock(m_mutex);
@ -445,9 +445,9 @@ void gale::Context::OS_Resize(const vec2& _size) {
// TODO : Better in the thread ... ==> but generate some init error ...
gale::Dimension::setPixelWindowsSize(_size);
if (m_simulationActive == true) {
m_simulationFile.filePuts(etk::to_string(echrono::Steady::now()));
m_simulationFile.filePuts(etk::toString(echrono::Steady::now()));
m_simulationFile.filePuts(":RESIZE:");
m_simulationFile.filePuts(etk::to_string(_size));
m_simulationFile.filePuts(etk::toString(_size));
m_simulationFile.filePuts("\n");
}
std::unique_lock<std::recursive_mutex> lock(m_mutex);
@ -498,15 +498,15 @@ void gale::Context::OS_SetInput(enum gale::key::type _type,
int32_t _pointerID,
const vec2& _pos) {
if (m_simulationActive == true) {
m_simulationFile.filePuts(etk::to_string(echrono::Steady::now()));
m_simulationFile.filePuts(etk::toString(echrono::Steady::now()));
m_simulationFile.filePuts(":INPUT:");
m_simulationFile.filePuts(etk::to_string(_type));
m_simulationFile.filePuts(etk::toString(_type));
m_simulationFile.filePuts(":");
m_simulationFile.filePuts(etk::to_string(_status));
m_simulationFile.filePuts(etk::toString(_status));
m_simulationFile.filePuts(":");
m_simulationFile.filePuts(etk::to_string(_pointerID));
m_simulationFile.filePuts(etk::toString(_pointerID));
m_simulationFile.filePuts(":");
m_simulationFile.filePuts(etk::to_string(_pos));
m_simulationFile.filePuts(etk::toString(_pos));
m_simulationFile.filePuts("\n");
}
std::unique_lock<std::recursive_mutex> lock(m_mutex);
@ -535,15 +535,15 @@ void gale::Context::OS_setKeyboard(const gale::key::Special& _special,
}
}
if (m_simulationActive == true) {
m_simulationFile.filePuts(etk::to_string(echrono::Steady::now()));
m_simulationFile.filePuts(etk::toString(echrono::Steady::now()));
m_simulationFile.filePuts(":KEYBOARD:");
m_simulationFile.filePuts(etk::to_string(_special));
m_simulationFile.filePuts(etk::toString(_special));
m_simulationFile.filePuts(":");
m_simulationFile.filePuts(etk::to_string(_type));
m_simulationFile.filePuts(etk::toString(_type));
m_simulationFile.filePuts(":");
m_simulationFile.filePuts(etk::to_string(_state));
m_simulationFile.filePuts(etk::toString(_state));
m_simulationFile.filePuts(":");
m_simulationFile.filePuts(etk::to_string(uint64_t(_char)));
m_simulationFile.filePuts(etk::toString(uint64_t(_char)));
m_simulationFile.filePuts("\n");
}
std::unique_lock<std::recursive_mutex> lock(m_mutex);
@ -561,7 +561,7 @@ void gale::Context::OS_setKeyboard(const gale::key::Special& _special,
void gale::Context::OS_Hide() {
if (m_simulationActive == true) {
m_simulationFile.filePuts(etk::to_string(echrono::Steady::now()));
m_simulationFile.filePuts(etk::toString(echrono::Steady::now()));
m_simulationFile.filePuts(":VIEW:false\n");
}
std::unique_lock<std::recursive_mutex> lock(m_mutex);
@ -582,7 +582,7 @@ void gale::Context::OS_Hide() {
void gale::Context::OS_Show() {
if (m_simulationActive == true) {
m_simulationFile.filePuts(etk::to_string(echrono::Steady::now()));
m_simulationFile.filePuts(etk::toString(echrono::Steady::now()));
m_simulationFile.filePuts(":VIEW:true\n");
}
m_msgSystem.post([](gale::Context& _context){
@ -603,9 +603,9 @@ void gale::Context::OS_Show() {
void gale::Context::OS_ClipBoardArrive(enum gale::context::clipBoard::clipboardListe _clipboardID) {
if (m_simulationActive == true) {
m_simulationFile.filePuts(etk::to_string(echrono::Steady::now()));
m_simulationFile.filePuts(etk::toString(echrono::Steady::now()));
m_simulationFile.filePuts(":CLIPBOARD_ARRIVE:");
m_simulationFile.filePuts(etk::to_string(_clipboardID));
m_simulationFile.filePuts(etk::toString(_clipboardID));
m_simulationFile.filePuts("\n");
}
std::unique_lock<std::recursive_mutex> lock(m_mutex);
@ -628,9 +628,9 @@ void gale::Context::clipBoardSet(enum gale::context::clipBoard::clipboardListe _
bool gale::Context::OS_Draw(bool _displayEveryTime) {
if (m_simulationActive == true) {
m_simulationFile.filePuts(etk::to_string(echrono::Steady::now()));
m_simulationFile.filePuts(etk::toString(echrono::Steady::now()));
m_simulationFile.filePuts(":DRAW:");
m_simulationFile.filePuts(etk::to_string(_displayEveryTime));
m_simulationFile.filePuts(etk::toString(_displayEveryTime));
m_simulationFile.filePuts("\n");
}
echrono::Steady currentTime = echrono::Steady::now();
@ -848,7 +848,7 @@ void gale::Context::show() {
GALE_INFO("show: NOT implemented ...");
}
void gale::Context::setTitle(const std::string& _title) {
void gale::Context::setTitle(const etk::String& _title) {
GALE_INFO("setTitle: NOT implemented ...");
}
@ -895,12 +895,12 @@ void gale::Context::keyboardHide() {
int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
etk::init(_argc, _argv);
ememory::SharedPtr<gale::Context> context;
std::string request = "";
etk::String request = "";
// get the environement variable:
char * basicEnv = getenv("EWOL_BACKEND");
if (nullptr != basicEnv) {
std::string tmpVal = basicEnv;
etk::String tmpVal = basicEnv;
//TODO : Check if it leak ...
#if defined(__TARGET_OS__Linux)
if (false) { }
@ -966,7 +966,7 @@ int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
}
for(int32_t iii=0; iii<_argc; ++iii) {
if (etk::start_with(_argv[iii], "--gale-backend=") == true) {
std::string tmpVal = &(_argv[iii][15]);
etk::String tmpVal = &(_argv[iii][15]);
#if defined(__TARGET_OS__Linux)
if (false) { }
#ifdef GALE_BUILD_X11

View File

@ -230,12 +230,12 @@ namespace gale {
* @brief set the new title of the windows
* @param[in] title New desired title
*/
virtual void setTitle(const std::string& _title);
virtual void setTitle(const etk::String& _title);
/**
* @brief Open an URL on an eternal brother.
* @param[in] _url URL to open.
*/
virtual void openURL(const std::string& _url) { };
virtual void openURL(const etk::String& _url) { };
/**
* @brief force the screen orientation (availlable on portable elements ...
* @param[in] _orientation Selected orientation.
@ -261,7 +261,7 @@ namespace gale {
* @brief set the Icon of the program
* @param[in] _inputFile new filename icon of the curent program.
*/
virtual void setIcon(const std::string& _inputFile) { };
virtual void setIcon(const etk::String& _inputFile) { };
/**
* @brief Enable or Disable the decoration on the Windows (availlable only on Desktop)
* @param[in] _status "true" to enable decoration / false otherwise
@ -289,7 +289,7 @@ namespace gale {
* @brief Special for init (main) set the start image when loading data
* @param[in] _fileName Name of the image to load
*/
void setInitImage(const std::string& _fileName);
void setInitImage(const etk::String& _fileName);
/**
* @brief Internal API to run the processing of the event loop ...
* @return The Exit value of the program

View File

@ -81,13 +81,13 @@ namespace gale {
GALE_PRINT(m_displayName << ": processTime: " << processTimeLocal);
}
if (m_drawingDone == true) {
m_min = std::min(m_min, processTimeLocal);
m_max = std::max(m_max, processTimeLocal);
m_min = etk::min(m_min, processTimeLocal);
m_max = etk::max(m_max, processTimeLocal);
m_avg += processTimeLocal;
m_drawingDone = false;
} else {
m_min_idle = std::min(m_min_idle, processTimeLocal);
m_max_idle = std::max(m_max_idle, processTimeLocal);
m_min_idle = etk::min(m_min_idle, processTimeLocal);
m_max_idle = etk::max(m_max_idle, processTimeLocal);
m_avg_idle += processTimeLocal;
}
}

View File

@ -123,7 +123,7 @@ public:
_move,
(_isDown==true?gale::key::status::down:gale::key::status::up));
}
void openURL(const std::string& _url) {
void openURL(const etk::String& _url) {
mm_openURL(_url.c_str());
}
};

View File

@ -109,7 +109,7 @@ int32_t gale::context::InputManager::localGetDestinationId(enum gale::key::type
ememory::SharedPtr<gale::Application> tmpApplication = m_eventInputSaved[iii].curentApplicationEvent.lock();
if (tmpApplication == _destApplication) {
if (iii != _realInputId) {
lastMinimum = std::max(lastMinimum, m_eventInputSaved[iii].destinationInputId);
lastMinimum = etk::max(lastMinimum, m_eventInputSaved[iii].destinationInputId);
}
}
}

View File

@ -60,7 +60,7 @@ class GLUTInterface : public gale::Context {
bool m_positionChangeRequested; //!< the position modifiquation has been requested
vec2 m_curentGrabDelta; //!< the position in GLUT will arrive by pool
bool m_inputIsPressed[MAX_MANAGE_INPUT];
std::string m_uniqueWindowsName;
etk::String m_uniqueWindowsName;
enum gale::context::cursor m_currentCursor; //!< select the current cursor to display :
char32_t m_lastKeyPressed; //!< The last element key presed...
public:

View File

@ -113,7 +113,7 @@ class SDLInterface : public gale::Context {
bool m_positionChangeRequested; //!< the position modifiquation has been requested
vec2 m_curentGrabDelta; //!< the position in SDL will arrive by pool
bool m_inputIsPressed[MAX_MANAGE_INPUT];
std::string m_uniqueWindowsName;
etk::String m_uniqueWindowsName;
enum gale::context::cursor m_currentCursor; //!< select the current cursor to display :
char32_t m_lastKeyPressed; //!< The last element key presed...
SDL_Surface* m_screen;

View File

@ -114,7 +114,7 @@ class SDLInterface : public gale::Context {
bool m_positionChangeRequested; //!< the position modifiquation has been requested
vec2 m_curentGrabDelta; //!< the position in SDL will arrive by pool
bool m_inputIsPressed[MAX_MANAGE_INPUT];
std::string m_uniqueWindowsName;
etk::String m_uniqueWindowsName;
enum gale::context::cursor m_currentCursor; //!< select the current cursor to display :
char32_t m_lastKeyPressed; //!< The last element key presed...
SDL_Window* m_screen;

View File

@ -23,16 +23,16 @@
#include <windowsx.h>
#include <etk/etk.hpp>
static std::string GetLastErrorAsString() {
static etk::String GetLastErrorAsString() {
//Get the error message, if any.
DWORD errorMessageID = ::GetLastError();
if(errorMessageID == 0) {
return std::string(); //No error message has been recorded
return etk::String(); //No error message has been recorded
}
LPSTR messageBuffer = nullptr;
size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL);
std::string message(messageBuffer, size);
etk::String message(messageBuffer, size);
//Free the buffer.
LocalFree(messageBuffer);
return message;
@ -236,7 +236,7 @@ class WindowsContext : public gale::Context {
char* buffer = nullptr;
if(OpenClipboard(m_hWnd)) {
buffer = (char*)GetClipboardData(CF_TEXT);
std::string tmpppp((char*)buffer);
etk::String tmpppp((char*)buffer);
// TODO : Check if we need to free buffer ...
gale::context::clipBoard::setSystem(gale::context::clipBoard::clipboardSelection, tmpppp);
// just transmit an event , we have the data in the system
@ -262,7 +262,7 @@ class WindowsContext : public gale::Context {
case gale::context::clipBoard::clipboardStd:
// Request the clipBoard :
if (m_clipBoardOwnerStd == false) {
std::string tmpData = gale::context::clipBoard::get(_clipboardID);
etk::String tmpData = gale::context::clipBoard::get(_clipboardID);
//put your text in source
if(OpenClipboard(m_hWnd)) {
HGLOBAL clipbuffer;
@ -611,7 +611,7 @@ class WindowsContext : public gale::Context {
return DefWindowProc(_hWnd, _message, _wParam, _lParam);
}
/****************************************************************************************/
void setTitle(const std::string& _title) {
void setTitle(const etk::String& _title) {
GALE_VERBOSE("Windows: set Title (START)");
SetWindowText(m_hWnd, _title.c_str());
GALE_VERBOSE("Windows: set Title (END)");

View File

@ -53,8 +53,8 @@ static bool hasDisplay = false;
#define X11_INFO GALE_INFO
#define X11_CRITICAL GALE_CRITICAL
static int32_t callLevel = 0;
std::string getOffset(int32_t _size) {
std::string out;
etk::String getOffset(int32_t _size) {
etk::String out;
for (int32_t iii=0; iii<_size; ++iii) {
out += "....";
}
@ -62,10 +62,10 @@ static bool hasDisplay = false;
}
class GaleTmpFuncCall {
private:
std::string m_value;
etk::String m_value;
int32_t m_level;
public:
GaleTmpFuncCall(const std::string& _value) :
GaleTmpFuncCall(const etk::String& _value) :
m_value(_value),
m_level(callLevel++) {
GALE_INFO(getOffset(m_level) << " ==> " << m_value);
@ -161,7 +161,7 @@ class X11Interface : public gale::Context {
Atom XAtomTargetTarget;
Atom XAtomGALE;
Atom XAtomDeleteWindows;
std::string m_uniqueWindowsName;
etk::String m_uniqueWindowsName;
enum gale::context::cursor m_currentCursor; //!< select the current cursor to display :
char32_t m_lastKeyPressed; //!< The last element key presed...
public:
@ -216,7 +216,7 @@ class X11Interface : public gale::Context {
XAtomTargetString = XInternAtom(m_display, "STRING", 0);
XAtomTargetStringUTF8 = XInternAtom(m_display, "UTF8_STRING", 0);
XAtomTargetTarget = XInternAtom(m_display, "TARGETS", 0);
m_uniqueWindowsName = "GALE_" + etk::to_string(etk::tool::irand(0, 1999999999));
m_uniqueWindowsName = "GALE_" + etk::toString(etk::tool::irand(0, 1999999999));
XAtomGALE = XInternAtom(m_display, m_uniqueWindowsName.c_str(), 0);
XAtomDeleteWindows = XInternAtom(m_display, "WM_DELETE_WINDOW", 0);
m_run = true;
@ -311,12 +311,12 @@ class X11Interface : public gale::Context {
&buf// **prop_return);
);
if (m_clipBoardRequestPrimary == true) {
std::string tmpppp((char*)buf);
etk::String tmpppp((char*)buf);
gale::context::clipBoard::setSystem(gale::context::clipBoard::clipboardSelection, tmpppp);
// just transmit an event , we have the data in the system
OS_ClipBoardArrive(gale::context::clipBoard::clipboardSelection);
} else {
std::string tmpppp((char*)buf);
etk::String tmpppp((char*)buf);
gale::context::clipBoard::setSystem(gale::context::clipBoard::clipboardStd, tmpppp);
// just transmit an event , we have the data in the system
OS_ClipBoardArrive(gale::context::clipBoard::clipboardStd);
@ -350,7 +350,7 @@ class X11Interface : public gale::Context {
}
#endif
std::string tmpData = "";
etk::String tmpData = "";
if (req->selection == XAtomSelection) {
tmpData = gale::context::clipBoard::get(gale::context::clipBoard::clipboardSelection);
} else if (req->selection == XAtomClipBoard) {
@ -1252,7 +1252,7 @@ class X11Interface : public gale::Context {
return true;
}
/****************************************************************************************/
void setIcon(const std::string& _inputFile) {
void setIcon(const etk::String& _inputFile) {
X11_FUNC();
#if defined(GALE_BUILD_EGAMI) \
&& !defined(__TARGET_OS__Web)
@ -1459,7 +1459,7 @@ class X11Interface : public gale::Context {
return true;
}
/****************************************************************************************/
void setTitle(const std::string& _title) {
void setTitle(const etk::String& _title) {
X11_FUNC();
X11_INFO("X11: set Title (START)");
XTextProperty tp;
@ -1473,9 +1473,9 @@ class X11Interface : public gale::Context {
XSetWMIconName(m_display, m_WindowHandle, &tp);
X11_INFO("X11: set Title (END)");
}
void openURL(const std::string& _url) {
void openURL(const etk::String& _url) {
X11_FUNC();
std::string req = "xdg-open ";
etk::String req = "xdg-open ";
req += _url;
system(req.c_str());
return;

View File

@ -17,7 +17,7 @@ note: copy id data :
10 : middle button
*/
//!< Local copy of the clipboards
static std::string myCopy[gale::context::clipBoard::clipboardCount];
static etk::String myCopy[gale::context::clipBoard::clipboardCount];
static const char* clipboardDescriptionString[gale::context::clipBoard::clipboardCount+1] = {
"clipboard0",
@ -35,7 +35,7 @@ static const char* clipboardDescriptionString[gale::context::clipBoard::clipboar
"clipboardCount"
};
std::ostream& gale::operator <<(std::ostream& _os, enum gale::context::clipBoard::clipboardListe _obj) {
etk::Stream& gale::operator <<(etk::Stream& _os, enum gale::context::clipBoard::clipboardListe _obj) {
if (_obj >= 0 && _obj <gale::context::clipBoard::clipboardCount) {
_os << clipboardDescriptionString[int32_t(_obj)];
} else {
@ -45,11 +45,11 @@ std::ostream& gale::operator <<(std::ostream& _os, enum gale::context::clipBoard
}
namespace etk {
template<> std::string to_string<enum gale::context::clipBoard::clipboardListe>(const enum gale::context::clipBoard::clipboardListe& _obj) {
template<> etk::String toString<enum gale::context::clipBoard::clipboardListe>(const enum gale::context::clipBoard::clipboardListe& _obj) {
return clipboardDescriptionString[int32_t(_obj)];
}
template <> bool from_string<enum gale::context::clipBoard::clipboardListe>(enum gale::context::clipBoard::clipboardListe& _variableRet, const std::string& _value) {
template <> bool from_string<enum gale::context::clipBoard::clipboardListe>(enum gale::context::clipBoard::clipboardListe& _variableRet, const etk::String& _value) {
for (size_t iii=0; iii< sizeof(clipboardDescriptionString); ++iii) {
if (clipboardDescriptionString[iii] == _value) {
_variableRet = (enum gale::context::clipBoard::clipboardListe)iii;
@ -76,7 +76,7 @@ void gale::context::clipBoard::unInit() {
}
void gale::context::clipBoard::set(enum gale::context::clipBoard::clipboardListe _clipboardID, const std::string& _data) {
void gale::context::clipBoard::set(enum gale::context::clipBoard::clipboardListe _clipboardID, const etk::String& _data) {
// check if ID is correct
if(0 == _data.size()) {
GALE_INFO("request a copy of nothing");
@ -113,7 +113,7 @@ void gale::context::clipBoard::request(enum gale::context::clipBoard::clipboardL
}
void gale::context::clipBoard::setSystem(enum gale::context::clipBoard::clipboardListe _clipboardID, const std::string& _data) {
void gale::context::clipBoard::setSystem(enum gale::context::clipBoard::clipboardListe _clipboardID, const etk::String& _data) {
if(_clipboardID >= gale::context::clipBoard::clipboardCount) {
GALE_WARNING("request ClickBoard id error");
return;
@ -123,8 +123,8 @@ void gale::context::clipBoard::setSystem(enum gale::context::clipBoard::clipboar
}
const std::string& gale::context::clipBoard::get(enum gale::context::clipBoard::clipboardListe _clipboardID) {
static const std::string emptyString("");
const etk::String& gale::context::clipBoard::get(enum gale::context::clipBoard::clipboardListe _clipboardID) {
static const etk::String emptyString("");
if(_clipboardID >= gale::context::clipBoard::clipboardCount) {
GALE_WARNING("request ClickBoard id error");
return emptyString;

View File

@ -32,7 +32,7 @@ namespace gale {
* @param[in] _clipboardID Select the specific ID of the clipboard
* @param[in] _data The string that might be send to the clipboard
*/
void set(enum gale::context::clipBoard::clipboardListe _clipboardID, const std::string& _data);
void set(enum gale::context::clipBoard::clipboardListe _clipboardID, const etk::String& _data);
/**
* @brief Call system to request the current clipboard.
* @note Due to some system that manage the clipboard request asynchronous (like X11) and gale managing the system with only one thread,
@ -47,7 +47,7 @@ namespace gale {
* @param[in] _clipboardID selected clipboard ID
* @param[in] _data new buffer data
*/
void setSystem(enum gale::context::clipBoard::clipboardListe _clipboardID,const std::string& _data);
void setSystem(enum gale::context::clipBoard::clipboardListe _clipboardID,const etk::String& _data);
/**
* @brief get the gale internal buffer of the curent clipboard. The end user can use it when he receive the event in
* the widget : @ref onEventClipboard == > we can nothe this function is the only one which permit it.
@ -55,7 +55,7 @@ namespace gale {
* @param[in] _clipboardID selected clipboard ID
* @return the requested buffer
*/
const std::string& get(enum gale::context::clipBoard::clipboardListe _clipboardID);
const etk::String& get(enum gale::context::clipBoard::clipboardListe _clipboardID);
// internal section
@ -72,5 +72,5 @@ namespace gale {
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
std::ostream& operator <<(std::ostream& _os, const enum gale::context::clipBoard::clipboardListe _obj);
etk::Stream& operator <<(etk::Stream& _os, const enum gale::context::clipBoard::clipboardListe _obj);
}

View File

@ -6,12 +6,12 @@
#include <gale/debug.hpp>
#include <gale/context/commandLine.hpp>
#include <vector>
#include <etk/Vector.hpp>
void gale::context::CommandLine::parse(int32_t _argc, const char* _argv[]) {
for (int32_t i=1 ; i<_argc; i++) {
GALE_INFO("commandLine : \"" << _argv[i] << "\"" );
m_listArgs.push_back(_argv[i]);
m_listArgs.pushBack(_argv[i]);
}
}
@ -19,8 +19,8 @@ int32_t gale::context::CommandLine::size() {
return m_listArgs.size();
}
const std::string& gale::context::CommandLine::get(int32_t _id) {
static const std::string errorArg("");
const etk::String& gale::context::CommandLine::get(int32_t _id) {
static const etk::String errorArg("");
if ( _id < 0
&& _id >= (int64_t)m_listArgs.size()) {
return errorArg;
@ -28,8 +28,8 @@ const std::string& gale::context::CommandLine::get(int32_t _id) {
return m_listArgs[_id];
}
void gale::context::CommandLine::add(const std::string& _newElement) {
m_listArgs.push_back(_newElement);
void gale::context::CommandLine::add(const etk::String& _newElement) {
m_listArgs.pushBack(_newElement);
}
void gale::context::CommandLine::remove(int32_t _id) {

View File

@ -11,7 +11,7 @@ namespace gale {
namespace context {
class CommandLine {
private:
std::vector<std::string> m_listArgs; //!< list of all argument parsed
etk::Vector<etk::String> m_listArgs; //!< list of all argument parsed
public:
/**
* @brief Parse the command line parameters
@ -26,12 +26,12 @@ namespace gale {
* @brief get an element with a specific ID
* @return _id The cmdLine Id element
*/
const std::string& get(int32_t _id);
const etk::String& get(int32_t _id);
/**
* @brief add one element at the Command line
* @param[in] _newElement String in the input that might be added.
*/
void add(const std::string& _newElement);
void add(const etk::String& _newElement);
/**
* @brief remove an element
* @param[in] _id Id of the element

View File

@ -30,7 +30,7 @@ static const char* cursorDescriptionString[] = {
"cursor::none"
};
std::ostream& gale::context::operator <<(std::ostream& _os, enum gale::context::cursor _obj) {
etk::Stream& gale::context::operator <<(etk::Stream& _os, enum gale::context::cursor _obj) {
_os << cursorDescriptionString[int32_t(_obj)];
return _os;
}

View File

@ -35,7 +35,7 @@ namespace gale {
/**
* @brief Debug operator To display the curent element in a Human readable information
*/
std::ostream& operator <<(std::ostream& _os, enum gale::context::cursor _obj);
etk::Stream& operator <<(etk::Stream& _os, enum gale::context::cursor _obj);
}
}

View File

@ -86,12 +86,12 @@ static int screen_height = 600;
* @param title New desired title
* @return ---
*/
void guiInterface::setTitle(std::string& title) {
void guiInterface::setTitle(etk::String& title) {
// TODO : ...
}
void guiInterface::setIcon(std::string inputFile) {
void guiInterface::setIcon(etk::String inputFile) {
// TODO : ...
}

View File

@ -26,10 +26,10 @@
#include <gale/renderer/openGL/openGL-include.hpp>
static std::vector<std::string> localSplit(const std::string& _input) {
std::vector<std::string> out;
static etk::Vector<etk::String> localSplit(const etk::String& _input) {
etk::Vector<etk::String> out;
char lastValue = '\0';
std::string tmpInput;
etk::String tmpInput;
for(auto &it : _input) {
if ( lastValue == ':'
&& it == ':') {
@ -37,7 +37,7 @@ static std::vector<std::string> localSplit(const std::string& _input) {
lastValue = '\0';
continue;
} else if (lastValue == ':') {
out.push_back(tmpInput);
out.pushBack(tmpInput);
tmpInput = "";
tmpInput += it;
} else if (it == ':') {
@ -49,7 +49,7 @@ static std::vector<std::string> localSplit(const std::string& _input) {
}
if (tmpInput!="") {
out.push_back(tmpInput);
out.pushBack(tmpInput);
}
return out;
}
@ -78,7 +78,7 @@ class SimulationInterface : public gale::Context {
GALE_ERROR("can not open the simulation file");
return -1;
}
std::string action;
etk::String action;
// main cycle
while(m_run == true) {
bool lineIsOk = m_simulationFile.fileGets(action);
@ -90,7 +90,7 @@ class SimulationInterface : public gale::Context {
continue;
}
GALE_VERBOSE("SIM-EVENT : '" << action << "'");
std::vector<std::string> pads = localSplit(action);
etk::Vector<etk::String> pads = localSplit(action);
GALE_DEBUG(" " << pads);
// The first is the time ...
if (pads.size() < 2) {
@ -98,7 +98,7 @@ class SimulationInterface : public gale::Context {
continue;
}
uint64_t time = etk::string_to_uint64_t(pads[0]);
std::string localAction = pads[1];
etk::String localAction = pads[1];
if (localAction == "INIT") {
// nothing to do ...
} else if (localAction == "RECALCULATE_SIZE") {
@ -191,14 +191,14 @@ class SimulationInterface : public gale::Context {
GALE_DEBUG("SIMU-API: Grab Events");
}
/****************************************************************************************/
void setIcon(const std::string& _inputFile) {
void setIcon(const etk::String& _inputFile) {
GALE_DEBUG("SIMU set icon " << _inputFile);
}
/****************************************************************************************/
void setTitle(const std::string& _title) {
void setTitle(const etk::String& _title) {
GALE_INFO("SIMU: set Title " << _title);
}
void openURL(const std::string& _url) {
void openURL(const etk::String& _url) {
GALE_INFO("SIMU: open URL " << _url);
}
/****************************************************************************************/

View File

@ -216,7 +216,7 @@ class WAYLANDInterface : public gale::Context {
gale::key::Special m_guiKeyBoardMode;
ivec2 m_size;
bool m_inputIsPressed[MAX_MANAGE_INPUT];
std::string m_uniqueWindowsName;
etk::String m_uniqueWindowsName;
bool m_run;
bool m_fullscreen;
bool m_configured;
@ -326,7 +326,7 @@ class WAYLANDInterface : public gale::Context {
// set the DPI for the current screen: TODO : do it with real value, for now, we use a generic dpi value (most common screen)
gale::Dimension::setPixelRatio(vec2(75,75),gale::distance::inch);
m_uniqueWindowsName = "GALE_" + etk::to_string(etk::tool::irand(0, 1999999999));
m_uniqueWindowsName = "GALE_" + etk::toString(etk::tool::irand(0, 1999999999));
m_run = true;
GALE_WARNING("WAYLAND: INIT [STOP]");
start2ndThreadProcessing();
@ -518,7 +518,7 @@ class WAYLANDInterface : public gale::Context {
GALE_WARNING("Can not get the generic theme");
}
} else if (strcmp(_interface, "wl_data_device_manager") == 0) {
m_dataDeviceManagerVersion = std::min(3, int32_t(_version));
m_dataDeviceManagerVersion = etk::min(3, int32_t(_version));
m_dataDeviceManager = (struct wl_data_device_manager*)wl_registry_bind(_registry, _id, &wl_data_device_manager_interface, m_dataDeviceManagerVersion);
} else {
GALE_WARNING(" ==> Not used ... '" << _interface << "'");
@ -1162,7 +1162,7 @@ class WAYLANDInterface : public gale::Context {
}
void dataSourceSend(struct wl_data_source* _wl_data_source, const char* _mime_type, int _fd) {
GALE_VERBOSE("CALL : dataSourceSend " << _mime_type);
std::string data = gale::context::clipBoard::get(gale::context::clipBoard::clipboardStd);
etk::String data = gale::context::clipBoard::get(gale::context::clipBoard::clipboardStd);
if (_fd == 0) {
GALE_ERROR(" ==> No data availlable ...");
return;
@ -1374,7 +1374,7 @@ class WAYLANDInterface : public gale::Context {
*/
}
/****************************************************************************************/
void setIcon(const std::string& _inputFile) {
void setIcon(const etk::String& _inputFile) {
/*
#if defined(GALE_BUILD_EGAMI) \
&& !defined(__TARGET_OS__Web)
@ -1526,7 +1526,7 @@ class WAYLANDInterface : public gale::Context {
*/
}
/****************************************************************************************/
void setTitle(const std::string& _title) {
void setTitle(const etk::String& _title) {
WAYLAND_INFO("WAYLAND: set Title (START)");
m_uniqueWindowsName = _title;
if (m_shellSurface == nullptr) {
@ -1536,8 +1536,8 @@ class WAYLANDInterface : public gale::Context {
wl_shell_surface_set_title(m_shellSurface, m_uniqueWindowsName.c_str());
WAYLAND_INFO("WAYLAND: set Title (END)");
}
void openURL(const std::string& _url) {
std::string req = "xdg-open ";
void openURL(const etk::String& _url) {
etk::String req = "xdg-open ";
req += _url;
system(req.c_str());
return;
@ -1564,7 +1564,7 @@ class WAYLANDInterface : public gale::Context {
int len = 1;
char buffer[4097];
buffer[0] = '\0';
std::string localBufferData;
etk::String localBufferData;
struct pollfd fds;
fds.fd = pipe_fd[0];

View File

@ -16,7 +16,7 @@
#define GALE_VERSION "0.0.0"
#endif
std::string gale::getCompilationMode() {
etk::String gale::getCompilationMode() {
#ifdef MODE_RELEASE
return "Release";
#else
@ -24,7 +24,7 @@ std::string gale::getCompilationMode() {
#endif
}
std::string gale::getBoardType() {
etk::String gale::getBoardType() {
#ifdef __TARGET_OS__Linux
return "Linux";
#elif defined(__TARGET_OS__Android)
@ -40,7 +40,7 @@ std::string gale::getBoardType() {
#endif
}
std::string gale::getVersion() {
etk::String gale::getVersion() {
return GALE_VERSION;
}

View File

@ -26,16 +26,16 @@ namespace gale {
* @brief get GALE version
* @return The string that describe gale version
*/
std::string getVersion();
etk::String getVersion();
/**
* @brief get compilation mode (release/debug)
* @return the string of the mode of commpilation
*/
std::string getCompilationMode();
etk::String getCompilationMode();
/**
* @brief get the board type (Android/Linux/MacOs/...)
* @return the string of the mode of commpilation
*/
std::string getBoardType();
etk::String getBoardType();
}

View File

@ -203,7 +203,7 @@ void gale::key::Special::setInsert(bool _value) {
setFlag(GALE_FLAG_KEY_INSERT, _value);
}
std::ostream& gale::key::operator <<(std::ostream& _os, const gale::key::Special& _obj) {
etk::Stream& gale::key::operator <<(etk::Stream& _os, const gale::key::Special& _obj) {
_os << " capLock=" << _obj.getCapsLock();
_os << " shift=" << _obj.getShift();
_os << " ctrl=" << _obj.getCtrl();
@ -215,8 +215,8 @@ std::ostream& gale::key::operator <<(std::ostream& _os, const gale::key::Special
}
namespace etk {
template<> std::string to_string<gale::key::Special>(const gale::key::Special& _obj) {
std::string out;
template<> etk::String toString<gale::key::Special>(const gale::key::Special& _obj) {
etk::String out;
if (_obj.getCapsLock() == true) {
out += "CAPS";
}
@ -278,9 +278,9 @@ namespace etk {
}
return out;
}
template <> bool from_string<gale::key::Special>(gale::key::Special& _variableRet, const std::string& _value) {
template <> bool from_string<gale::key::Special>(gale::key::Special& _variableRet, const etk::String& _value) {
gale::key::Special out;
std::vector<std::string> listElem = etk::split(_value, "|");
etk::Vector<etk::String> listElem = etk::split(_value, "|");
for (auto &it : listElem) {
if (it == "CAPS") {
out.setCapsLock(true);

View File

@ -193,7 +193,7 @@ namespace gale {
*/
bool getFlag(uint32_t _flag) const;
};
std::ostream& operator <<(std::ostream& _os, const gale::key::Special& _obj);
etk::Stream& operator <<(etk::Stream& _os, const gale::key::Special& _obj);
}
}

View File

@ -55,17 +55,17 @@ static const char* keyboardDescriptionString[] = {
"keyboard::back",
};
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::keyboard _obj) {
etk::Stream& gale::key::operator <<(etk::Stream& _os, const enum gale::key::keyboard _obj) {
_os << keyboardDescriptionString[int32_t(_obj)];
return _os;
}
namespace etk {
template<> std::string to_string<enum gale::key::keyboard>(const enum gale::key::keyboard& _obj) {
template<> etk::String toString<enum gale::key::keyboard>(const enum gale::key::keyboard& _obj) {
return keyboardDescriptionString[int32_t(_obj)];
}
template <> bool from_string<enum gale::key::keyboard>(enum gale::key::keyboard& _variableRet, const std::string& _value) {
template <> bool from_string<enum gale::key::keyboard>(enum gale::key::keyboard& _variableRet, const etk::String& _value) {
for (size_t iii=0; iii< sizeof(keyboardDescriptionString); ++iii) {
if (keyboardDescriptionString[iii] == _value) {
_variableRet = (enum gale::key::keyboard)iii;

View File

@ -65,7 +65,7 @@ namespace gale {
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
std::ostream& operator <<(std::ostream& _os, const enum gale::key::keyboard _obj);
etk::Stream& operator <<(etk::Stream& _os, const enum gale::key::keyboard _obj);
}
}

View File

@ -26,17 +26,17 @@ static const char* statusDescriptionString[] = {
"status::transfert"
};
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::status _obj) {
etk::Stream& gale::key::operator <<(etk::Stream& _os, const enum gale::key::status _obj) {
_os << statusDescriptionString[int32_t(_obj)];
return _os;
}
namespace etk {
template<> std::string to_string<enum gale::key::status>(const enum gale::key::status& _obj) {
template<> etk::String toString<enum gale::key::status>(const enum gale::key::status& _obj) {
return statusDescriptionString[int32_t(_obj)];
}
template <> bool from_string<enum gale::key::status>(enum gale::key::status& _variableRet, const std::string& _value) {
template <> bool from_string<enum gale::key::status>(enum gale::key::status& _variableRet, const etk::String& _value) {
for (size_t iii=0; iii< sizeof(statusDescriptionString); ++iii) {
if (statusDescriptionString[iii] == _value) {
_variableRet = (enum gale::key::status)iii;

View File

@ -33,7 +33,7 @@ namespace gale {
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
std::ostream& operator <<(std::ostream& _os, const enum gale::key::status _obj);
etk::Stream& operator <<(etk::Stream& _os, const enum gale::key::status _obj);
}
}

View File

@ -15,17 +15,17 @@ static const char* typeDescriptionString[] = {
"type::stylet"
};
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::type _obj) {
etk::Stream& gale::key::operator <<(etk::Stream& _os, const enum gale::key::type _obj) {
_os << typeDescriptionString[int32_t(_obj)];
return _os;
}
namespace etk {
template<> std::string to_string<enum gale::key::type>(const enum gale::key::type& _obj) {
template<> etk::String toString<enum gale::key::type>(const enum gale::key::type& _obj) {
return typeDescriptionString[int32_t(_obj)];
}
template <> bool from_string<enum gale::key::type>(enum gale::key::type& _variableRet, const std::string& _value) {
template <> bool from_string<enum gale::key::type>(enum gale::key::type& _variableRet, const etk::String& _value) {
for (size_t iii=0; iii< sizeof(typeDescriptionString); ++iii) {
if (typeDescriptionString[iii] == _value) {
_variableRet = (enum gale::key::type)iii;

View File

@ -21,7 +21,7 @@ namespace gale {
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
std::ostream& operator <<(std::ostream& _os, enum gale::key::type _obj);
etk::Stream& operator <<(etk::Stream& _os, enum gale::key::type _obj);
}
}

View File

@ -13,7 +13,7 @@ static const char* listValues[] = {
"orientation::screenPortrait"
};
std::ostream& gale::operator <<(std::ostream& _os, const enum gale::orientation _obj) {
etk::Stream& gale::operator <<(etk::Stream& _os, const enum gale::orientation _obj) {
_os << listValues[int32_t(_obj)];
return _os;
}

View File

@ -11,5 +11,5 @@ namespace gale {
screenLandscape,
screenPortrait
};
std::ostream& operator <<(std::ostream& _os, enum gale::orientation _obj);
etk::Stream& operator <<(etk::Stream& _os, enum gale::orientation _obj);
}

View File

@ -4,7 +4,7 @@
* @license MPL v2.0 (see license file)
*/
#include <vector>
#include <etk/Vector.hpp>
#include <gale/debug.hpp>
#include <gale/renderer/openGL/openGL.hpp>
#include <etk/stdTools.hpp>
@ -60,7 +60,7 @@ static std::mutex& mutexOpenGl() {
return s_drawMutex;
}
std::vector<mat4> l_matrixList;
etk::Vector<mat4> l_matrixList;
mat4 l_matrixCamera;
static uint32_t l_flagsCurrent = 0;
static uint32_t l_flagsMustBeSet = 0;
@ -72,7 +72,7 @@ void gale::openGL::lock() {
mutexOpenGl().lock();
l_matrixList.clear();
mat4 tmpMat;
l_matrixList.push_back(tmpMat);
l_matrixList.pushBack(tmpMat);
l_matrixCamera.identity();
l_flagsCurrent = 0;
l_flagsMustBeSet = 0;
@ -84,8 +84,8 @@ void gale::openGL::unLock() {
mutexOpenGl().unlock();
}
static std::vector<std::thread::id>& getContextList() {
static std::vector<std::thread::id> g_val;
static etk::Vector<std::thread::id>& getContextList() {
static etk::Vector<std::thread::id> g_val;
return g_val;
}
@ -106,7 +106,7 @@ void gale::openGL::threadHasContext() {
if (it != getContextList().end()) {
GALE_ERROR("set openGL context associate with threadID a second time ... ");
} else {
getContextList().push_back(std::this_thread::get_id());
getContextList().pushBack(std::this_thread::get_id());
}
mutexOpenGl().unlock();
}
@ -127,13 +127,13 @@ void gale::openGL::setBasicMatrix(const mat4& _newOne) {
GALE_ERROR("matrix is not corect size in the stack : " << l_matrixList.size());
}
l_matrixList.clear();
l_matrixList.push_back(_newOne);
l_matrixList.pushBack(_newOne);
}
void gale::openGL::setMatrix(const mat4& _newOne) {
if (l_matrixList.size() == 0) {
GALE_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.size());
l_matrixList.push_back(_newOne);
l_matrixList.pushBack(_newOne);
return;
}
l_matrixList[l_matrixList.size()-1] = _newOne;
@ -143,11 +143,11 @@ void gale::openGL::push() {
if (l_matrixList.size() == 0) {
GALE_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.size());
mat4 tmp;
l_matrixList.push_back(tmp);
l_matrixList.pushBack(tmp);
return;
}
mat4 tmp = l_matrixList[l_matrixList.size()-1];
l_matrixList.push_back(tmp);
l_matrixList.pushBack(tmp);
}
void gale::openGL::pop() {
@ -155,11 +155,11 @@ void gale::openGL::pop() {
GALE_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.size());
l_matrixList.clear();
mat4 tmp;
l_matrixList.push_back(tmp);
l_matrixList.pushBack(tmp);
l_matrixCamera.identity();
return;
}
l_matrixList.pop_back();
l_matrixList.popBack();
l_matrixCamera.identity();
}
@ -167,7 +167,7 @@ const mat4& gale::openGL::getMatrix() {
if (l_matrixList.size() == 0) {
GALE_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.size());
mat4 tmp;
l_matrixList.push_back(tmp);
l_matrixList.pushBack(tmp);
}
return l_matrixList[l_matrixList.size()-1];
}
@ -297,37 +297,37 @@ void gale::openGL::clear(uint32_t _flags) {
#endif
}
std::ostream& gale::openGL::operator <<(std::ostream& _os, enum gale::openGL::flag _obj) {
static std::vector<std::pair<enum openGL::flag, const char*>> list = {
std::make_pair(openGL::flag_blend, "FLAG_BLEND"),
std::make_pair(openGL::flag_clipDistanceI, "FLAG_CLIP_DISTANCE_I"),
std::make_pair(openGL::flag_colorLogigOP, "FLAG_COLOR_LOGIC_OP"),
std::make_pair(openGL::flag_cullFace, "FLAG_CULL_FACE"),
std::make_pair(openGL::flag_debugOutput, "FLAG_DEBUG_OUTPUT"),
std::make_pair(openGL::flag_debugOutputSynchronous, "flag_debugOutput_SYNCHRONOUS"),
std::make_pair(openGL::flag_depthClamp, "FLAG_DEPTH_CLAMP"),
std::make_pair(openGL::flag_depthTest, "FLAG_DEPTH_TEST"),
std::make_pair(openGL::flag_dither, "FLAG_DITHER"),
std::make_pair(openGL::flag_framebufferSRGB, "FLAG_FRAMEBUFFER_SRGB"),
std::make_pair(openGL::flag_lineSmooth, "FLAG_LINE_SMOOTH"),
std::make_pair(openGL::flag_multisample, "FLAG_MULTISAMPLE"),
std::make_pair(openGL::flag_polygonOffsetFill, "FLAG_POLYGON_OFFSET_FILL"),
std::make_pair(openGL::flag_polygonOffsetLine, "FLAG_POLYGON_OFFSET_LINE"),
std::make_pair(openGL::flag_polygonOffsetPoint, "FLAG_POLYGON_OFFSET_POINT"),
std::make_pair(openGL::flag_polygonSmooth, "FLAG_POLYGON_SMOOTH"),
std::make_pair(openGL::flag_primitiveRestart, "FLAG_PRIMITIVE_RESTART"),
std::make_pair(openGL::flag_primitiveRestartFixedIndex, "flag_primitiveRestart_FIXED_INDEX"),
std::make_pair(openGL::flag_sampleAlphaToCoverage, "FLAG_SAMPLE_ALPHA_TO_COVERAGE"),
std::make_pair(openGL::flag_sampleAlphaToOne, "FLAG_SAMPLE_ALPHA_TO_ONE"),
std::make_pair(openGL::flag_sampleCoverage, "FLAG_SAMPLE_COVERAGE"),
std::make_pair(openGL::flag_sampleShading, "FLAG_SAMPLE_SHADING"),
std::make_pair(openGL::flag_sampleMask, "FLAG_SAMPLE_MASK"),
std::make_pair(openGL::flag_scissorTest, "FLAG_SCISSOR_TEST"),
std::make_pair(openGL::flag_stencilTest, "FLAG_STENCIL_TEST"),
std::make_pair(openGL::flag_programPointSize, "FLAG_PROGRAM_POINT_SIZE"),
std::make_pair(openGL::flag_texture2D, "FLAG_TEXTURE_2D"),
std::make_pair(openGL::flag_alphaTest, "FLAG_ALPHA_TEST"),
std::make_pair(openGL::flag_fog, "FLAG_FOG")
etk::Stream& gale::openGL::operator <<(etk::Stream& _os, enum gale::openGL::flag _obj) {
static etk::Vector<etk::Pair<enum openGL::flag, const char*>> list = {
etk::makePair(openGL::flag_blend, "FLAG_BLEND"),
etk::makePair(openGL::flag_clipDistanceI, "FLAG_CLIP_DISTANCE_I"),
etk::makePair(openGL::flag_colorLogigOP, "FLAG_COLOR_LOGIC_OP"),
etk::makePair(openGL::flag_cullFace, "FLAG_CULL_FACE"),
etk::makePair(openGL::flag_debugOutput, "FLAG_DEBUG_OUTPUT"),
etk::makePair(openGL::flag_debugOutputSynchronous, "flag_debugOutput_SYNCHRONOUS"),
etk::makePair(openGL::flag_depthClamp, "FLAG_DEPTH_CLAMP"),
etk::makePair(openGL::flag_depthTest, "FLAG_DEPTH_TEST"),
etk::makePair(openGL::flag_dither, "FLAG_DITHER"),
etk::makePair(openGL::flag_framebufferSRGB, "FLAG_FRAMEBUFFER_SRGB"),
etk::makePair(openGL::flag_lineSmooth, "FLAG_LINE_SMOOTH"),
etk::makePair(openGL::flag_multisample, "FLAG_MULTISAMPLE"),
etk::makePair(openGL::flag_polygonOffsetFill, "FLAG_POLYGON_OFFSET_FILL"),
etk::makePair(openGL::flag_polygonOffsetLine, "FLAG_POLYGON_OFFSET_LINE"),
etk::makePair(openGL::flag_polygonOffsetPoint, "FLAG_POLYGON_OFFSET_POINT"),
etk::makePair(openGL::flag_polygonSmooth, "FLAG_POLYGON_SMOOTH"),
etk::makePair(openGL::flag_primitiveRestart, "FLAG_PRIMITIVE_RESTART"),
etk::makePair(openGL::flag_primitiveRestartFixedIndex, "flag_primitiveRestart_FIXED_INDEX"),
etk::makePair(openGL::flag_sampleAlphaToCoverage, "FLAG_SAMPLE_ALPHA_TO_COVERAGE"),
etk::makePair(openGL::flag_sampleAlphaToOne, "FLAG_SAMPLE_ALPHA_TO_ONE"),
etk::makePair(openGL::flag_sampleCoverage, "FLAG_SAMPLE_COVERAGE"),
etk::makePair(openGL::flag_sampleShading, "FLAG_SAMPLE_SHADING"),
etk::makePair(openGL::flag_sampleMask, "FLAG_SAMPLE_MASK"),
etk::makePair(openGL::flag_scissorTest, "FLAG_SCISSOR_TEST"),
etk::makePair(openGL::flag_stencilTest, "FLAG_STENCIL_TEST"),
etk::makePair(openGL::flag_programPointSize, "FLAG_PROGRAM_POINT_SIZE"),
etk::makePair(openGL::flag_texture2D, "FLAG_TEXTURE_2D"),
etk::makePair(openGL::flag_alphaTest, "FLAG_ALPHA_TEST"),
etk::makePair(openGL::flag_fog, "FLAG_FOG")
};
_os << "{";
bool hasOne = false;
@ -345,25 +345,25 @@ std::ostream& gale::openGL::operator <<(std::ostream& _os, enum gale::openGL::fl
}
std::vector<std::pair<enum gale::openGL::renderMode, std::string>>& getListRenderMode() {
static std::vector<std::pair<enum gale::openGL::renderMode, std::string>> list = {
std::make_pair(gale::openGL::renderMode::point, "POINTS"),
std::make_pair(gale::openGL::renderMode::line, "LINES"),
std::make_pair(gale::openGL::renderMode::lineStrip, "LINES_STRIP"),
std::make_pair(gale::openGL::renderMode::lineLoop, "LINE_LOOP"),
std::make_pair(gale::openGL::renderMode::triangle, "TRIANGLE"),
std::make_pair(gale::openGL::renderMode::triangleStrip, "TRIANGLE_STRIP"),
std::make_pair(gale::openGL::renderMode::triangleFan, "TRIANGLE_FAN"),
std::make_pair(gale::openGL::renderMode::quad, "QUAD"),
std::make_pair(gale::openGL::renderMode::quadStrip, "QUAD_STRIP"),
std::make_pair(gale::openGL::renderMode::polygon, "POLYGON"),
etk::Vector<etk::Pair<enum gale::openGL::renderMode, etk::String>>& getListRenderMode() {
static etk::Vector<etk::Pair<enum gale::openGL::renderMode, etk::String>> list = {
etk::makePair(gale::openGL::renderMode::point, "POINTS"),
etk::makePair(gale::openGL::renderMode::line, "LINES"),
etk::makePair(gale::openGL::renderMode::lineStrip, "LINES_STRIP"),
etk::makePair(gale::openGL::renderMode::lineLoop, "LINE_LOOP"),
etk::makePair(gale::openGL::renderMode::triangle, "TRIANGLE"),
etk::makePair(gale::openGL::renderMode::triangleStrip, "TRIANGLE_STRIP"),
etk::makePair(gale::openGL::renderMode::triangleFan, "TRIANGLE_FAN"),
etk::makePair(gale::openGL::renderMode::quad, "QUAD"),
etk::makePair(gale::openGL::renderMode::quadStrip, "QUAD_STRIP"),
etk::makePair(gale::openGL::renderMode::polygon, "POLYGON"),
};
return list;
}
namespace etk {
template<> std::string to_string<gale::openGL::renderMode>(const gale::openGL::renderMode& _obj) {
template<> etk::String toString<gale::openGL::renderMode>(const gale::openGL::renderMode& _obj) {
for (auto &it : getListRenderMode()) {
if (it.first == _obj) {
return it.second;
@ -372,10 +372,10 @@ namespace etk {
GALE_ERROR("Can not convert : " << static_cast<int32_t>(_obj) << " return UNKNOW");
return "UNKNOW";
}
template<> std::u32string to_u32string<gale::openGL::renderMode>(const gale::openGL::renderMode& _obj) {
return etk::to_u32string(etk::to_string(_obj));
template<> etk::UString toUString<gale::openGL::renderMode>(const gale::openGL::renderMode& _obj) {
return etk::toUString(etk::toString(_obj));
}
template<> bool from_string<gale::openGL::renderMode>(gale::openGL::renderMode& _variableRet, const std::string& _value) {
template<> bool from_string<gale::openGL::renderMode>(gale::openGL::renderMode& _variableRet, const etk::String& _value) {
for (auto &it : getListRenderMode()) {
if (it.second == _value) {
_variableRet = it.first;
@ -386,13 +386,13 @@ namespace etk {
_variableRet = gale::openGL::renderMode::triangle;
return false;
}
template<> bool from_string<gale::openGL::renderMode>(gale::openGL::renderMode& _variableRet, const std::u32string& _value) {
return from_string(_variableRet, etk::to_string(_value));
template<> bool from_string<gale::openGL::renderMode>(gale::openGL::renderMode& _variableRet, const etk::UString& _value) {
return from_string(_variableRet, etk::toString(_value));
}
};
std::ostream& gale::openGL::operator <<(std::ostream& _os, enum gale::openGL::renderMode _obj) {
_os << etk::to_string(_obj);
etk::Stream& gale::openGL::operator <<(etk::Stream& _os, enum gale::openGL::renderMode _obj) {
_os << etk::toString(_obj);
return _os;
}
@ -611,7 +611,7 @@ void gale::openGL::drawArrays(enum gale::openGL::renderMode _mode, int32_t _firs
}
}
void gale::openGL::drawElements(enum renderMode _mode, const std::vector<uint32_t>& _indices) {
void gale::openGL::drawElements(enum renderMode _mode, const etk::Vector<uint32_t>& _indices) {
if (l_programId >= 0) {
updateAllFlags();
#ifdef GALE_BUILD_SIMULATION
@ -626,7 +626,7 @@ void gale::openGL::drawElements(enum renderMode _mode, const std::vector<uint32_
}
}
void gale::openGL::drawElements16(enum renderMode _mode, const std::vector<uint16_t>& _indices) {
void gale::openGL::drawElements16(enum renderMode _mode, const etk::Vector<uint16_t>& _indices) {
if (l_programId >= 0) {
updateAllFlags();
#ifdef GALE_BUILD_SIMULATION
@ -640,7 +640,7 @@ void gale::openGL::drawElements16(enum renderMode _mode, const std::vector<uint1
}
}
void gale::openGL::drawElements8(enum renderMode _mode, const std::vector<uint8_t>& _indices) {
void gale::openGL::drawElements8(enum renderMode _mode, const etk::Vector<uint8_t>& _indices) {
if (l_programId >= 0) {
updateAllFlags();
#ifdef GALE_BUILD_SIMULATION
@ -708,7 +708,7 @@ void gale::openGL::useProgram(int32_t _id) {
bool gale::openGL::genBuffers(std::vector<uint32_t>& _buffers) {
bool gale::openGL::genBuffers(etk::Vector<uint32_t>& _buffers) {
if (_buffers.size() == 0) {
GALE_WARNING("try to generate vector buffer with size 0");
return true;
@ -737,7 +737,7 @@ bool gale::openGL::genBuffers(std::vector<uint32_t>& _buffers) {
return hasError;
}
bool gale::openGL::deleteBuffers(std::vector<uint32_t>& _buffers) {
bool gale::openGL::deleteBuffers(etk::Vector<uint32_t>& _buffers) {
if (_buffers.size() == 0) {
GALE_WARNING("try to delete vector buffer with size 0");
return true;
@ -866,7 +866,7 @@ void gale::openGL::shader::remove(int64_t& _shader) {
_shader = -1;
}
bool gale::openGL::shader::compile(int64_t _shader, const std::string& _data) {
bool gale::openGL::shader::compile(int64_t _shader, const etk::String& _data) {
const char* data = &_data[0];
#ifdef GALE_BUILD_SIMULATION
if (s_simulationMode == false) {
@ -883,7 +883,7 @@ bool gale::openGL::shader::compile(int64_t _shader, const std::string& _data) {
l_bufferDisplayError[0] = '\0';
glGetShaderInfoLog(GLuint(_shader), LOG_OGL_INTERNAL_BUFFER_LEN, &infoLen, l_bufferDisplayError);
GALE_ERROR("Error " << l_bufferDisplayError);
std::vector<std::string> lines = etk::split(_data, '\n');
etk::Vector<etk::String> lines = etk::split(_data, '\n');
for (size_t iii=0; iii<lines.size(); iii++) {
GALE_ERROR("file " << (iii+1) << "|" << lines[iii]);
}
@ -998,7 +998,7 @@ bool gale::openGL::program::compile(int64_t _prog) {
return true;
}
int32_t gale::openGL::program::getAttributeLocation(int64_t _prog, const std::string& _name) {
int32_t gale::openGL::program::getAttributeLocation(int64_t _prog, const etk::String& _name) {
if (_prog < 0) {
GALE_ERROR("wrong program ID");
return -1;
@ -1022,7 +1022,7 @@ int32_t gale::openGL::program::getAttributeLocation(int64_t _prog, const std::st
return val;
}
int32_t gale::openGL::program::getUniformLocation(int64_t _prog, const std::string& _name) {
int32_t gale::openGL::program::getUniformLocation(int64_t _prog, const etk::String& _name) {
if (_prog < 0) {
GALE_ERROR("wrong program ID");
return -1;

View File

@ -6,7 +6,7 @@
#pragma once
#include <etk/types.hpp>
#include <vector>
#include <etk/Vector.hpp>
#include <etk/math/Matrix4x4.hpp>
#include <etk/math/Vector2D.hpp>
#include <etk/Color.hpp>
@ -193,9 +193,9 @@ namespace gale {
* @brief draw a specific array == > this enable mode difference ...
*/
void drawArrays(enum renderMode _mode, int32_t _first, int32_t _count);
void drawElements (enum renderMode _mode, const std::vector<uint32_t>& _indices);
void drawElements16(enum renderMode _mode, const std::vector<uint16_t>& _indices);
void drawElements8 (enum renderMode _mode, const std::vector<uint8_t>& _indices);
void drawElements (enum renderMode _mode, const etk::Vector<uint32_t>& _indices);
void drawElements16(enum renderMode _mode, const etk::Vector<uint16_t>& _indices);
void drawElements8 (enum renderMode _mode, const etk::Vector<uint8_t>& _indices);
/**
* @brief Use openGL program
* @param[in] id Id of the program that might be used
@ -204,8 +204,8 @@ namespace gale {
void reset();
bool genBuffers(std::vector<uint32_t>& _buffers);
bool deleteBuffers(std::vector<uint32_t>& _buffers);
bool genBuffers(etk::Vector<uint32_t>& _buffers);
bool deleteBuffers(etk::Vector<uint32_t>& _buffers);
bool bindBuffer(uint32_t _bufferId);
enum class usage {
streamDraw,
@ -222,18 +222,18 @@ namespace gale {
};
int64_t create(enum gale::openGL::shader::type _type);
void remove(int64_t& _shader);
bool compile(int64_t _shader, const std::string& _data);
bool compile(int64_t _shader, const etk::String& _data);
};
namespace program {
int64_t create();
void remove(int64_t& _prog);
bool attach(int64_t _prog, int64_t _shader);
bool compile(int64_t _prog);
int32_t getAttributeLocation(int64_t _prog, const std::string& _name);
int32_t getUniformLocation(int64_t _prog, const std::string& _name);
int32_t getAttributeLocation(int64_t _prog, const etk::String& _name);
int32_t getUniformLocation(int64_t _prog, const etk::String& _name);
};
std::ostream& operator <<(std::ostream& _os, enum openGL::flag _obj);
std::ostream& operator <<(std::ostream& _os, enum openGL::renderMode _obj);
etk::Stream& operator <<(etk::Stream& _os, enum openGL::flag _obj);
etk::Stream& operator <<(etk::Stream& _os, enum openGL::renderMode _obj);
}
}

View File

@ -105,7 +105,7 @@ void gale::resource::Manager::update(const ememory::SharedPtr<gale::Resource>& _
}
}
// add it ...
m_resourceListToUpdate.push_back(_object);
m_resourceListToUpdate.pushBack(_object);
}
// Specific to load or update the data in the openGl context == > system use only
@ -136,14 +136,14 @@ void gale::resource::Manager::updateContext() {
if (tmpRessource->updateContext() == false) {
// Lock error ==> postponned
std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_resourceListToUpdate.push_back(tmpRessource);
m_resourceListToUpdate.pushBack(tmpRessource);
}
}
}
}
}
} else {
std::vector<ememory::SharedPtr<gale::Resource>> resourceListToUpdate;
etk::Vector<ememory::SharedPtr<gale::Resource>> resourceListToUpdate;
{
std::unique_lock<std::recursive_mutex> lock(m_mutex);
resourceListToUpdate = m_resourceListToUpdate;
@ -159,7 +159,7 @@ void gale::resource::Manager::updateContext() {
if (it->updateContext() == false) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
// Lock error ==> postponned
m_resourceListToUpdate.push_back(it);
m_resourceListToUpdate.pushBack(it);
}
}
}
@ -187,7 +187,7 @@ void gale::resource::Manager::applicationExiting() {
}
// internal generic keeper ...
ememory::SharedPtr<gale::Resource> gale::resource::Manager::localKeep(const std::string& _filename) {
ememory::SharedPtr<gale::Resource> gale::resource::Manager::localKeep(const etk::String& _filename) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
GALE_VERBOSE("KEEP (DEFAULT) : file : '" << _filename << "' in " << m_resourceList.size() << " resources");
for (auto &it : m_resourceList) {
@ -213,7 +213,7 @@ void gale::resource::Manager::localAdd(const ememory::SharedPtr<gale::Resource>&
}
}
// add at the end if no slot is free
m_resourceList.push_back(_object);
m_resourceList.pushBack(_object);
}
// in case of error ...

View File

@ -6,7 +6,7 @@
#pragma once
#include <list>
#include <vector>
#include <etk/Vector.hpp>
#include <etk/types.hpp>
#include <gale/debug.hpp>
#include <gale/resource/Resource.hpp>
@ -16,7 +16,7 @@ namespace gale {
class Manager{
private:
std::list<ememory::WeakPtr<gale::Resource>> m_resourceList;
std::vector<ememory::SharedPtr<gale::Resource>> m_resourceListToUpdate;
etk::Vector<ememory::SharedPtr<gale::Resource>> m_resourceListToUpdate;
bool m_contextHasBeenRemoved;
bool m_exiting;
std::recursive_mutex m_mutex;
@ -62,7 +62,7 @@ namespace gale {
void applicationExiting();
public:
// internal API to extent eResources in extern Soft
ememory::SharedPtr<gale::Resource> localKeep(const std::string& _filename);
ememory::SharedPtr<gale::Resource> localKeep(const etk::String& _filename);
void localAdd(const ememory::SharedPtr<gale::Resource>& _object);
virtual void cleanInternalRemoved();
};

View File

@ -25,7 +25,7 @@ gale::resource::Program::Program() :
m_resourceLevel = 1;
}
void gale::resource::Program::init(const std::string& _filename) {
void gale::resource::Program::init(const etk::String& _filename) {
gale::Resource::init(_filename);
std::unique_lock<std::recursive_mutex> lock(m_mutex);
GALE_DEBUG("OGL : load PROGRAM '" << m_name << "'");
@ -34,7 +34,7 @@ void gale::resource::Program::init(const std::string& _filename) {
etk::FSNode file(m_name);
if (file.exist() == false) {
GALE_DEBUG("File does not Exist : \"" << file << "\" == > automatic load of framment and shader with same names... ");
std::string tmpFilename = m_name;
etk::String tmpFilename = m_name;
// remove extention ...
tmpFilename.erase(tmpFilename.size()-4, 4);
ememory::SharedPtr<gale::resource::Shader> tmpShader = gale::resource::Shader::create(tmpFilename+"vert");
@ -43,7 +43,7 @@ void gale::resource::Program::init(const std::string& _filename) {
return;
} else {
GALE_DEBUG("Add shader on program : "<< tmpFilename << "vert");
m_shaderList.push_back(tmpShader);
m_shaderList.pushBack(tmpShader);
}
tmpShader = gale::resource::Shader::create(tmpFilename+"frag");
if (tmpShader == nullptr) {
@ -51,10 +51,10 @@ void gale::resource::Program::init(const std::string& _filename) {
return;
} else {
GALE_DEBUG("Add shader on program : "<< tmpFilename << "frag");
m_shaderList.push_back(tmpShader);
m_shaderList.pushBack(tmpShader);
}
} else {
std::string fileExtention = file.fileGetExtention();
etk::String fileExtention = file.fileGetExtention();
if (fileExtention != "prog") {
GALE_ERROR("File does not have extention \".prog\" for program but : \"" << fileExtention << "\"");
return;
@ -80,13 +80,13 @@ void gale::resource::Program::init(const std::string& _filename) {
continue;
}
// get it with relative position :
std::string tmpFilename = file.getRelativeFolder() + tmpData;
etk::String tmpFilename = file.getRelativeFolder() + tmpData;
ememory::SharedPtr<gale::resource::Shader> tmpShader = gale::resource::Shader::create(tmpFilename);
if (tmpShader == nullptr) {
GALE_ERROR("Error while getting a specific shader filename : " << tmpFilename);
} else {
GALE_DEBUG("Add shader on program : "<< tmpFilename);
m_shaderList.push_back(tmpShader);
m_shaderList.pushBack(tmpShader);
}
}
@ -108,7 +108,7 @@ gale::resource::Program::~Program() {
m_hasTexture1 = false;
}
std::ostream& gale::resource::operator <<(std::ostream& _os, const gale::resource::progAttributeElement& _obj) {
etk::Stream& gale::resource::operator <<(etk::Stream& _os, const gale::resource::progAttributeElement& _obj) {
_os << "{";
_os << "[" << _obj.m_name << "] ";
_os << _obj.m_elementId << " ";
@ -117,7 +117,7 @@ std::ostream& gale::resource::operator <<(std::ostream& _os, const gale::resourc
return _os;
}
std::ostream& gale::resource::operator <<(std::ostream& _os, const std::vector<gale::resource::progAttributeElement>& _obj){
etk::Stream& gale::resource::operator <<(etk::Stream& _os, const etk::Vector<gale::resource::progAttributeElement>& _obj){
_os << "{";
for (auto &it : _obj) {
_os << it;
@ -170,7 +170,7 @@ bool gale::resource::Program::checkIdValidity(int32_t _idElem) {
return m_elementList[_idElem].m_isLinked;
}
int32_t gale::resource::Program::getAttribute(std::string _elementName) {
int32_t gale::resource::Program::getAttribute(etk::String _elementName) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
// check if it exist previously :
for(size_t iii=0; iii<m_elementList.size(); iii++) {
@ -199,11 +199,11 @@ int32_t gale::resource::Program::getAttribute(std::string _elementName) {
tmp.m_elementId = -1;
tmp.m_isLinked = false;
}
m_elementList.push_back(tmp);
m_elementList.pushBack(tmp);
return m_elementList.size()-1;
}
int32_t gale::resource::Program::getUniform(std::string _elementName) {
int32_t gale::resource::Program::getUniform(etk::String _elementName) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
// check if it exist previously :
for(size_t iii=0; iii<m_elementList.size(); iii++) {
@ -232,7 +232,7 @@ int32_t gale::resource::Program::getUniform(std::string _elementName) {
tmp.m_elementId = -1;
tmp.m_isLinked = false;
}
m_elementList.push_back(tmp);
m_elementList.pushBack(tmp);
return m_elementList.size()-1;
}
@ -427,7 +427,7 @@ void gale::resource::Program::sendAttributePointer(int32_t _idElem,
(GLvoid *)_offset); // Pointer on the buffer
checkGlError("glVertexAttribPointer", __LINE__, _idElem);
glEnableVertexAttribArray(m_elementList[_idElem].m_elementId);
m_listOfVBOUsed.push_back(m_elementList[_idElem].m_elementId);
m_listOfVBOUsed.pushBack(m_elementList[_idElem].m_elementId);
checkGlError("glEnableVertexAttribArray", __LINE__, _idElem);
}

View File

@ -23,15 +23,15 @@ namespace gale {
*/
class progAttributeElement {
public :
std::string m_name; //!< Name of the element
etk::String m_name; //!< Name of the element
int32_t m_elementId; //!< openGl Id if this element == > can not exist ==> @ref m_isLinked
bool m_isAttribute; //!< true if it was an attribute element, otherwite it was an uniform
bool m_isLinked; //!< if this element does not exist this is false
};
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const gale::resource::progAttributeElement& _obj);
etk::Stream& operator <<(etk::Stream& _os, const gale::resource::progAttributeElement& _obj);
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const std::vector<gale::resource::progAttributeElement>& _obj);
etk::Stream& operator <<(etk::Stream& _os, const etk::Vector<gale::resource::progAttributeElement>& _obj);
/**
* @brief Program is a compilation of some fragment Shader and vertex Shader. This construct automaticly this assiciation
* The input file must have the form : "myFile.prog"
@ -49,9 +49,9 @@ namespace gale {
private :
bool m_exist; //!< the file existed
int64_t m_program; //!< openGL id of the current program
std::vector<ememory::SharedPtr<gale::resource::Shader>> m_shaderList; //!< List of all the shader loaded
std::vector<gale::resource::progAttributeElement> m_elementList; //!< List of all the attribute requested by the user
std::vector<int32_t> m_listOfVBOUsed; //!< retain the list of VBO used to disable it when unuse program ...
etk::Vector<ememory::SharedPtr<gale::resource::Shader>> m_shaderList; //!< List of all the shader loaded
etk::Vector<gale::resource::progAttributeElement> m_elementList; //!< List of all the attribute requested by the user
etk::Vector<int32_t> m_listOfVBOUsed; //!< retain the list of VBO used to disable it when unuse program ...
bool m_hasTexture; //!< A texture has been set to the current shader
bool m_hasTexture1; //!< A texture has been set to the current shader
protected:
@ -60,7 +60,7 @@ namespace gale {
* @param[in] filename Standard file name format. see @ref etk::FSNode
*/
Program();
void init(const std::string& _filename);
void init(const etk::String& _filename);
public:
DECLARE_RESOURCE_NAMED_FACTORY(Program);
/**
@ -80,7 +80,7 @@ namespace gale {
* @param[in] _elementName Name of the requested attribute.
* @return An abstract ID of the current attribute (this value is all time availlable, even if the program will be reloaded)
*/
int32_t getAttribute(std::string _elementName);
int32_t getAttribute(etk::String _elementName);
/**
* @brief Send attribute table to the spefified ID attribure (not send if does not really exist in the openGL program).
* @param[in] _idElem Id of the Attribute that might be sended.
@ -106,16 +106,16 @@ namespace gale {
int32_t _nbElement,
const void* _pointer,
int32_t _jumpBetweenSample=0);
inline void sendAttribute(int32_t _idElem, const std::vector<vec2>& _data) {
inline void sendAttribute(int32_t _idElem, const etk::Vector<vec2>& _data) {
sendAttribute(_idElem, 2/*u,v / x,y*/, &_data[0]);
}
inline void sendAttribute(int32_t _idElem, const std::vector<vec3>& _data) {
inline void sendAttribute(int32_t _idElem, const etk::Vector<vec3>& _data) {
sendAttribute(_idElem, 3/*x,y,z,unused*/, &_data[0], 4*sizeof(btScalar));
}
inline void sendAttribute(int32_t _idElem, const std::vector<etk::Color<float>>& _data) {
inline void sendAttribute(int32_t _idElem, const etk::Vector<etk::Color<float>>& _data) {
sendAttribute(_idElem, 4/*r,g,b,a*/, &_data[0]);
}
inline void sendAttribute(int32_t _idElem, const std::vector<float>& _data) {
inline void sendAttribute(int32_t _idElem, const etk::Vector<float>& _data) {
sendAttribute(_idElem, 1, &_data[0]);
}
#endif
@ -125,7 +125,7 @@ namespace gale {
* @param[in] _elementName Name of the requested uniform.
* @return An abstract ID of the current uniform (this value is all time availlable, even if the program will be reloaded)
*/
int32_t getUniform(std::string _elementName);
int32_t getUniform(etk::String _elementName);
/**
* @brief Send a uniform element to the spefified ID (not send if does not really exist in the openGL program)
* @param[in] _idElem Id of the uniform that might be sended.

View File

@ -25,7 +25,7 @@ void gale::Resource::init() {
m_resourceHasBeenInit=true;
}
void gale::Resource::init(const std::string& _name) {
void gale::Resource::init(const etk::String& _name) {
m_resourceHasBeenInit=true;
m_name = _name;
}
@ -42,10 +42,10 @@ void gale::Resource::addResourceType(const char* _type) {
GALE_ERROR(" try to add a type with no value...");
return;
}
m_listType.push_back(_type);
m_listType.pushBack(_type);
}
std::string gale::Resource::getTypeDescription() {
std::string ret("gale::Resource");
etk::String gale::Resource::getTypeDescription() {
etk::String ret("gale::Resource");
for(auto element : m_listType) {
ret += "|";
ret += element;
@ -53,7 +53,7 @@ std::string gale::Resource::getTypeDescription() {
return ret;
}
bool gale::Resource::isTypeCompatible(const std::string& _type) {
bool gale::Resource::isTypeCompatible(const etk::String& _type) {
if (_type == "gale::Resource") {
return true;
}

View File

@ -28,7 +28,7 @@
}
#define DECLARE_RESOURCE_NAMED_FACTORY(className) \
template<typename ... GALE_TYPE> static ememory::SharedPtr<className> create(const std::string& _name, GALE_TYPE&& ... _all ) { \
template<typename ... GALE_TYPE> static ememory::SharedPtr<className> create(const etk::String& _name, GALE_TYPE&& ... _all ) { \
ememory::SharedPtr<className> resource; \
ememory::SharedPtr<gale::Resource> resource2; \
if (_name != "" && _name != "---") { \
@ -109,7 +109,7 @@ namespace gale {
*/
void init();
//! @previous
void init(const std::string& _name);
void init(const etk::String& _name);
public:
//! geenric destructor
virtual ~Resource() {
@ -128,7 +128,7 @@ namespace gale {
return m_resourceHasBeenInit;
}
private:
std::vector<const char*> m_listType;
etk::Vector<const char*> m_listType;
public:
/**
* @brief get the current type of the Resource
@ -139,13 +139,13 @@ namespace gale {
* @brief Get the herarchic of the Resource type.
* @return descriptive string.
*/
std::string getTypeDescription();
etk::String getTypeDescription();
/**
* @brief check if the element herited from a specific type
* @param[in] _type Type to check.
* @return true if the element is compatible.
*/
bool isTypeCompatible(const std::string& _type);
bool isTypeCompatible(const etk::String& _type);
protected:
/**
* @brief Add a type of the list of Object.
@ -153,20 +153,20 @@ namespace gale {
*/
void addResourceType(const char* _type);
protected:
std::string m_name; //!< name of the resource ...
etk::String m_name; //!< name of the resource ...
public:
/**
* @brief get the resource name
* @return The requested name
*/
const std::string& getName() const {
const etk::String& getName() const {
return m_name;
};
/**
* @brief get the resource name
* @param[in] _name The new name
*/
void setName(const std::string& _name) {
void setName(const etk::String& _name) {
m_name = _name;
};
protected:

View File

@ -22,7 +22,7 @@ gale::resource::Shader::Shader() :
m_resourceLevel = 0;
}
void gale::resource::Shader::init(const std::string& _filename) {
void gale::resource::Shader::init(const etk::String& _filename) {
std::unique_lock<std::recursive_mutex> lock(m_mutex);
gale::Resource::init(_filename);
GALE_DEBUG("OGL : load SHADER '" << _filename << "'");

View File

@ -18,7 +18,7 @@ namespace gale {
class Shader : public gale::Resource {
private :
bool m_exist; //!< The shader file existed and has been loaded
std::string m_fileData; //!< A copy of the data loaded from the file (usefull only when opengl context is removed)
etk::String m_fileData; //!< A copy of the data loaded from the file (usefull only when opengl context is removed)
int64_t m_shader; //!< opengl id of this element
gale::openGL::shader::type m_type; //!< Type of the current shader(vertex/fragment)
protected:
@ -28,7 +28,7 @@ namespace gale {
*/
Shader();
public:
void init(const std::string& _filename);
void init(const etk::String& _filename);
DECLARE_RESOURCE_NAMED_FACTORY(Shader);
/**
* @brief Destructor, remove the current Shader

View File

@ -29,7 +29,7 @@ static int32_t nextP2(int32_t _value) {
}
void gale::resource::Texture::init(const std::string& _filename) {
void gale::resource::Texture::init(const etk::String& _filename) {
gale::Resource::init(_filename);
}
void gale::resource::Texture::init() {
@ -109,7 +109,7 @@ void gale::resource::Texture::flush() {
getManager().update(ememory::dynamicPointerCast<gale::Resource>(sharedFromThis()));
}
void gale::resource::Texture::setTexture(const ememory::SharedPtr<std::vector<char>>& _data,
void gale::resource::Texture::setTexture(const ememory::SharedPtr<etk::Vector<char>>& _data,
const ivec2& _size,
enum gale::resource::Texture::dataType _dataType,
enum gale::resource::Texture::color _dataColorSpace) {

View File

@ -45,7 +45,7 @@ namespace gale {
};
// Public API:
protected:
void init(const std::string& _filename);
void init(const etk::String& _filename);
void init();
Texture();
public:
@ -57,12 +57,12 @@ namespace gale {
private:
// Image propoerties:
ememory::SharedPtr<std::vector<char>> m_data; //!< pointer on the image data.
ememory::SharedPtr<etk::Vector<char>> m_data; //!< pointer on the image data.
ivec2 m_size; //!< size of the image data.
enum dataType m_dataType; //!< Type of the image.
enum color m_dataColorSpace; //!< Color space of the image.
public:
void setTexture(const ememory::SharedPtr<std::vector<char>>& _data,
void setTexture(const ememory::SharedPtr<etk::Vector<char>>& _data,
const ivec2& _size,
enum gale::resource::Texture::dataType _dataType,
enum gale::resource::Texture::color _dataColorSpace);

View File

@ -113,9 +113,9 @@ void gale::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const vec3&
return;
}
m_vboUsed[_id] = true;
m_buffer[_id].push_back(_data.x());
m_buffer[_id].push_back(_data.y());
m_buffer[_id].push_back(_data.z());
m_buffer[_id].pushBack(_data.x());
m_buffer[_id].pushBack(_data.y());
m_buffer[_id].pushBack(_data.z());
}
vec3 gale::resource::VirtualBufferObject::getOnBufferVec3(int32_t _id, int32_t _elementID) const {
@ -146,8 +146,8 @@ void gale::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const vec2&
return;
}
m_vboUsed[_id] = true;
m_buffer[_id].push_back(_data.x());
m_buffer[_id].push_back(_data.y());
m_buffer[_id].pushBack(_data.x());
m_buffer[_id].pushBack(_data.y());
}
vec2 gale::resource::VirtualBufferObject::getOnBufferVec2(int32_t _id, int32_t _elementID) const {
@ -168,7 +168,7 @@ void gale::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const float&
return;
}
m_vboUsed[_id] = true;
m_buffer[_id].push_back(_data);
m_buffer[_id].pushBack(_data);
}
void gale::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const etk::Color<float,4>& _data) {
@ -180,10 +180,10 @@ void gale::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const etk::C
return;
}
m_vboUsed[_id] = true;
m_buffer[_id].push_back(_data.r());
m_buffer[_id].push_back(_data.g());
m_buffer[_id].push_back(_data.b());
m_buffer[_id].push_back(_data.a());
m_buffer[_id].pushBack(_data.r());
m_buffer[_id].pushBack(_data.g());
m_buffer[_id].pushBack(_data.b());
m_buffer[_id].pushBack(_data.a());
}
void gale::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const etk::Color<float,3>& _data) {
@ -195,9 +195,9 @@ void gale::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const etk::C
return;
}
m_vboUsed[_id] = true;
m_buffer[_id].push_back(_data.r());
m_buffer[_id].push_back(_data.g());
m_buffer[_id].push_back(_data.b());
m_buffer[_id].pushBack(_data.r());
m_buffer[_id].pushBack(_data.g());
m_buffer[_id].pushBack(_data.b());
}
void gale::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const etk::Color<float,2>& _data) {
@ -209,8 +209,8 @@ void gale::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const etk::C
return;
}
m_vboUsed[_id] = true;
m_buffer[_id].push_back(_data.r());
m_buffer[_id].push_back(_data.g());
m_buffer[_id].pushBack(_data.r());
m_buffer[_id].pushBack(_data.g());
}
void gale::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const etk::Color<float,1>& _data) {
@ -222,6 +222,6 @@ void gale::resource::VirtualBufferObject::pushOnBuffer(int32_t _id, const etk::C
return;
}
m_vboUsed[_id] = true;
m_buffer[_id].push_back(_data.r());
m_buffer[_id].pushBack(_data.r());
}

View File

@ -20,10 +20,10 @@ namespace gale {
class VirtualBufferObject : public gale::Resource {
private :
bool m_exist; //!< This data is availlable in the Graphic card
std::vector<uint32_t> m_vbo; //!< openGl ID of this VBO
std::vector<bool> m_vboUsed; //!< true if the VBO is allocated or used ...
std::vector<std::vector<float>> m_buffer; //!< data that is availlable in the VBO system ...
std::vector<int8_t> m_vboSizeDataOffset; //!< Internal size of the VBO (dynamicly set)
etk::Vector<uint32_t> m_vbo; //!< openGl ID of this VBO
etk::Vector<bool> m_vboUsed; //!< true if the VBO is allocated or used ...
etk::Vector<etk::Vector<float>> m_buffer; //!< data that is availlable in the VBO system ...
etk::Vector<int8_t> m_vboSizeDataOffset; //!< Internal size of the VBO (dynamicly set)
protected:
/**
* @brief Constructor of this VBO.
@ -54,7 +54,7 @@ namespace gale {
* @param[in] id Id of the buffer requested
* @return A reference on the data.
*/
std::vector<float>& getRefBuffer(int32_t _id) {
etk::Vector<float>& getRefBuffer(int32_t _id) {
m_vboUsed[_id] = true;
return m_buffer[_id];
};

View File

@ -172,7 +172,7 @@ def configure(target, my_module):
my_module.add_path(".")
my_module.add_flag('c++', [
"-DGALE_VERSION=\"\\\"" + tools.version_to_string(my_module.get_pkg("VERSION")) + "\\\"\""
"-DGALE_VERSION=\"\\\"" + tools.version_toString(my_module.get_pkg("VERSION")) + "\\\"\""
])
if "Web" in target.get_type():
@ -401,7 +401,7 @@ def tool_generate_main_java_class(target, module, package_name):
debug.warning("Missing application 'VERSION_CODE' ==> set it at '0' (this can creata an NON update on android play store)")
module.set_pkg("VERSION_CODE", "0")
tmpFile.write( ' android:versionCode="' + str(module.get_pkg("VERSION_CODE")) + '" \n')
tmpFile.write( ' android:versionName="'+tools.version_to_string(module.get_pkg("VERSION"))+'"> \n')
tmpFile.write( ' android:versionName="'+tools.version_toString(module.get_pkg("VERSION"))+'"> \n')
tmpFile.write( ' <uses-feature android:glEsVersion="0x00030000" android:required="true" />\n')
tmpFile.write( ' <uses-sdk android:minSdkVersion="' + str(target.board_id) + '" \n')
tmpFile.write( ' android:targetSdkVersion="' + str(target.board_id) + '" /> \n')