Common.h 815 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (C) 2009-2018, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <string>
  7. /// Write to log. Don't use it directly.
  8. void log(const char* file, int line, unsigned type, const char* fmt, ...);
  9. // Log and errors
  10. #define LOGI(...) log(__FILE__, __LINE__, 1, __VA_ARGS__)
  11. #define ERROR(...) \
  12. do \
  13. { \
  14. log(__FILE__, __LINE__, 2, __VA_ARGS__); \
  15. exit(0); \
  16. } while(0)
  17. #define LOGW(...) log(__FILE__, __LINE__, 3, __VA_ARGS__)
  18. /// Replace all @a from substrings in @a str to @a to
  19. std::string replaceAllString(const std::string& str, const std::string& from, const std::string& to);
  20. /// From a path return only the filename
  21. std::string getFilename(const std::string& path);