summaryrefslogtreecommitdiff
path: root/core/os
diff options
context:
space:
mode:
Diffstat (limited to 'core/os')
-rw-r--r--core/os/file_access.cpp6
-rw-r--r--core/os/file_access.h2
-rw-r--r--core/os/os.cpp4
-rw-r--r--core/os/os.h9
-rw-r--r--core/os/thread.cpp4
-rw-r--r--core/os/thread.h6
6 files changed, 25 insertions, 6 deletions
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index d82d0b63c5..68c9dee84d 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -277,7 +277,9 @@ String FileAccess::get_line() const {
return String::utf8(line.get_data());
}
-Vector<String> FileAccess::get_csv_line() const {
+Vector<String> FileAccess::get_csv_line(String delim) const {
+
+ ERR_FAIL_COND_V(delim.length()!=1,Vector<String>());
String l;
int qc=0;
@@ -303,7 +305,7 @@ Vector<String> FileAccess::get_csv_line() const {
CharType s[2]={0,0};
- if (!in_quote && c==',') {
+ if (!in_quote && c==delim[0]) {
strings.push_back(current);
current=String();
} else if (c=='"') {
diff --git a/core/os/file_access.h b/core/os/file_access.h
index 51cf839117..3249e21ffb 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -102,7 +102,7 @@ public:
virtual int get_buffer(uint8_t *p_dst,int p_length) const; ///< get an array of bytes
virtual String get_line() const;
- virtual Vector<String> get_csv_line() const;
+ virtual Vector<String> get_csv_line(String delim=",") const;
/**< use this for files WRITTEN in _big_ endian machines (ie, amiga/mac)
* It's not about the current CPU type but file formats.
diff --git a/core/os/os.cpp b/core/os/os.cpp
index e93038f854..0bc06c8375 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -523,6 +523,10 @@ String OS::get_joy_guid(int p_device) const {
return "Default Joystick";
}
+void OS::set_context(int p_context) {
+
+}
+
OS::OS() {
last_error=NULL;
frames_drawn=0;
diff --git a/core/os/os.h b/core/os/os.h
index e53980a8fe..0d4edb035d 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -173,6 +173,8 @@ public:
virtual bool is_window_maximized() const { return true; }
+
+
virtual void set_iterations_per_second(int p_ips);
virtual int get_iterations_per_second() const;
@@ -402,6 +404,13 @@ public:
virtual bool is_joy_known(int p_device);
virtual String get_joy_guid(int p_device)const;
+ enum EngineContext {
+ CONTEXT_EDITOR,
+ CONTEXT_PROJECTMAN,
+ };
+
+ virtual void set_context(int p_context);
+
OS();
virtual ~OS();
diff --git a/core/os/thread.cpp b/core/os/thread.cpp
index 7fb1e969d4..f5d984876d 100644
--- a/core/os/thread.cpp
+++ b/core/os/thread.cpp
@@ -32,6 +32,7 @@
Thread* (*Thread::create_func)(ThreadCreateCallback,void *,const Settings&)=NULL;
Thread::ID (*Thread::get_thread_ID_func)()=NULL;
void (*Thread::wait_to_finish_func)(Thread*)=NULL;
+Error (*Thread::set_name_func)(const String&)=NULL;
Thread::ID Thread::_main_thread_id=0;
@@ -60,6 +61,9 @@ void Thread::wait_to_finish(Thread *p_thread) {
Error Thread::set_name(const String &p_name) {
+ if (set_name_func)
+ return set_name_func(p_name);
+
return ERR_UNAVAILABLE;
};
diff --git a/core/os/thread.h b/core/os/thread.h
index 5711561809..4fead72b94 100644
--- a/core/os/thread.h
+++ b/core/os/thread.h
@@ -63,6 +63,7 @@ protected:
static Thread* (*create_func)(ThreadCreateCallback p_callback,void *,const Settings&);
static ID (*get_thread_ID_func)();
static void (*wait_to_finish_func)(Thread*);
+ static Error (*set_name_func)(const String&);
friend class Main;
@@ -73,10 +74,9 @@ protected:
public:
- virtual Error set_name(const String& p_name);
-
virtual ID get_ID() const=0;
-
+
+ static Error set_name(const String &p_name);
_FORCE_INLINE_ static ID get_main_ID() { return _main_thread_id; } ///< get the ID of the main thread
static ID get_caller_ID(); ///< get the ID of the caller function ID
static void wait_to_finish(Thread *p_thread); ///< waits until thread is finished, and deallocates it.