Răsfoiți Sursa

Replaced pragma warning with runtime error. Added toBool.

bkaradzic 12 ani în urmă
părinte
comite
0ed41d71e7
3 a modificat fișierele cu 18 adăugiri și 2 ștergeri
  1. 6 1
      include/bx/bx.h
  2. 5 1
      include/bx/os.h
  3. 7 0
      include/bx/string.h

+ 6 - 1
include/bx/bx.h

@@ -6,7 +6,9 @@
 #ifndef __BX_H__
 #define __BX_H__
 
-#include <stdint.h>
+#include <stdint.h> // uint32_t
+#include <stdlib.h> // size_t
+
 #include "platform.h"
 #include "macros.h"
 
@@ -18,4 +20,7 @@ namespace bx
 
 } // namespace bx
 
+// Annoying C++0x stuff..
+namespace std { namespace tr1 {}; using namespace tr1; }
+
 #endif // __BX_H__ 

+ 5 - 1
include/bx/os.h

@@ -20,6 +20,9 @@
 #		include <unistd.h> // syscall
 #		include <sys/syscall.h>
 #	endif // BX_PLATFORM_LINUX
+#	if BX_PLATFORM_ANDROID
+#		include "debug.h" // getTid is not implemented...
+#	endif // BX_PLATFORM_ANDROID
 #endif // BX_PLATFORM_
 
 namespace bx
@@ -58,7 +61,8 @@ namespace bx
 		// Casting __nc_basic_thread_data*... need better way to do this.
 		return *(uint32_t*)::pthread_self();
 #else
-#	pragma message "not implemented."
+//#	pragma message "not implemented."
+		debugOutput("getTid is not implemented"); debugBreak();
 		return 0;
 #endif //
 	}

+ 7 - 0
include/bx/string.h

@@ -8,6 +8,7 @@
 
 #include "bx.h"
 #include <alloca.h>
+#include <ctype.h> // tolower
 #include <stdarg.h> // va_list
 #include <stdio.h>  // vsnprintf, vsnwprintf
 #include <string.h>
@@ -16,6 +17,12 @@
 
 namespace bx
 {
+	inline bool toBool(const char* _str)
+	{
+		char ch = tolower(_str[0]);
+		return ch == 't' ||  ch == '1';
+	}
+
 	/// Case insensitive string compare.
 	inline int32_t stricmp(const char* _a, const char* _b)
 	{