Common.h 869 B

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