[DEV] continue remove stl

This commit is contained in:
Edouard DUPIN 2017-08-30 21:20:20 +02:00
parent 2bcb9068aa
commit c3837bcc1b
4 changed files with 18 additions and 19 deletions

View File

@ -9,6 +9,7 @@
#include <elog/log.hpp> #include <elog/log.hpp>
#include <elog/elog.hpp> #include <elog/elog.hpp>
#include <elog/debug.hpp> #include <elog/debug.hpp>
#include <etk/String.hpp>
static elog::level getLogLevel(const etk::String& _value) { static elog::level getLogLevel(const etk::String& _value) {
if (_value == "0") { if (_value == "0") {
@ -40,7 +41,7 @@ static bool startWith(const etk::String& _obj, const etk::String& _val) {
for( size_t iii = 0; for( size_t iii = 0;
iii < _val.size(); iii < _val.size();
iii++) { iii++) {
if (std::tolower(_val[iii]) != std::tolower(_obj[iii])) { if (etk::toLower(_val[iii]) != etk::toLower(_obj[iii])) {
return false; return false;
} }
} }

View File

@ -152,7 +152,7 @@ int32_t elog::registerInstance(const etk::String& _name) {
if (_name.size() >= getNameSizeLog()) { if (_name.size() >= getNameSizeLog()) {
getNameSizeLog() = _name.size()+1; getNameSizeLog() = _name.size()+1;
} }
//std::cout << "register log : '" << _name << "'=" << getList().size()-1 << std::endl; //printf("register log : '%s'=%ld\n", _name.c_str(), getList().size()-1);
return getList().size()-1; return getList().size()-1;
} }
@ -721,7 +721,7 @@ void elog::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* _fun
#elif defined(__TARGET_OS__IOs) #elif defined(__TARGET_OS__IOs)
iosNSLog(handle); iosNSLog(handle);
#else #else
std::cout << handle << std::endl; printf("%s\n", handle);
#endif #endif
g_lock.unlock(); g_lock.unlock();
if (_level == level_critical) { if (_level == level_critical) {

View File

@ -58,7 +58,7 @@ def configure(target, my_module):
my_module.compile_version("c++", 2011) my_module.compile_version("c++", 2011)
my_module.compile_version("c", 1999) my_module.compile_version("c", 1999)
# add dependency of the generic C++ library: # add dependency of the generic C++ library:
my_module.add_depend('cxx') my_module.add_optionnal_depend('etk-base')
my_module.add_optionnal_depend('ethread-tools', ["c++", "-DELOG_BUILD_ETHREAD"]) my_module.add_optionnal_depend('ethread-tools', ["c++", "-DELOG_BUILD_ETHREAD"])
if "Windows" in target.get_type(): if "Windows" in target.get_type():

View File

@ -17,31 +17,31 @@ static void myExternalLogCallback(const char* _libName, enum elog::level _level,
//! [elog_sample_main_callback_DECLARATION] //! [elog_sample_main_callback_DECLARATION]
switch(_level) { switch(_level) {
default: default:
std::cout << "[?] "; printf("[?] ");
break; break;
case elog::level_print: case elog::level_print:
std::cout << "[P] "; printf("[P] ");
break; break;
case elog::level_critical: case elog::level_critical:
std::cout << "[C] "; printf("[C] ");
break; break;
case elog::level_error: case elog::level_error:
std::cout << "[E] "; printf("[E] ");
break; break;
case elog::level_warning: case elog::level_warning:
std::cout << "[W] "; printf("[W] ");
break; break;
case elog::level_info: case elog::level_info:
std::cout << "[I] "; printf("[I] ");
break; break;
case elog::level_debug: case elog::level_debug:
std::cout << "[D] "; printf("[D] ");
break; break;
case elog::level_verbose: case elog::level_verbose:
std::cout << "[V] "; printf("[V] ");
break; break;
} }
std::cout << _libName << " (" << _ligne << ") " << _funcName << " | " << _log << std::endl; printf("%s (%d) %s | %s\n", _libName, _ligne, _funcName, _log);
} }
//! [elog_sample_main_callback] //! [elog_sample_main_callback]
@ -49,8 +49,10 @@ static void myExternalLogCallback(const char* _libName, enum elog::level _level,
//! [elog_sample_main] //! [elog_sample_main]
/** /**
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...). * @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
* @param std IO * @param[in] _argc standard input argument count
* @return std IO * @param[in] _argv standard input argument data (pointer on strings)
* @return <0 an error occurred
* @return all is good otherwise
*/ */
//! [elog_sample_main_base] //! [elog_sample_main_base]
int main(int _argc, const char *_argv[]) { int main(int _argc, const char *_argv[]) {
@ -66,14 +68,12 @@ int main(int _argc, const char *_argv[]) {
APPL_PRINT("PRINT display"); APPL_PRINT("PRINT display");
//APPL_CRITICAL("CRITICAL display"); // Disable critical because it create an assert ... //APPL_CRITICAL("CRITICAL display"); // Disable critical because it create an assert ...
//! [elog_sample_main_log] //! [elog_sample_main_log]
// Change the global log level: // Change the global log level:
elog::setLevel(elog::level_verbose); elog::setLevel(elog::level_verbose);
//! [elog_sample_main_callback_link] //! [elog_sample_main_callback_link]
// Set a callback: // Set a callback:
elog::setCallbackLog(&myExternalLogCallback); elog::setCallbackLog(&myExternalLogCallback);
//! [elog_sample_main_callback_link] //! [elog_sample_main_callback_link]
// try again new logs: // try again new logs:
APPL_VERBOSE("VERBOSE display"); APPL_VERBOSE("VERBOSE display");
APPL_DEBUG("DEBUG display"); APPL_DEBUG("DEBUG display");
@ -81,8 +81,6 @@ int main(int _argc, const char *_argv[]) {
APPL_WARNING("WARNING display"); APPL_WARNING("WARNING display");
APPL_ERROR("ERROR display"); APPL_ERROR("ERROR display");
APPL_PRINT("PRINT display"); APPL_PRINT("PRINT display");
return 0; return 0;
} }
//! [elog_sample_main] //! [elog_sample_main]