Update to latest angelscript

This commit is contained in:
Marianne Gagnon
2015-05-11 19:40:43 -04:00
parent f269b44208
commit c48037984d
71 changed files with 11405 additions and 6307 deletions

View File

@@ -1,6 +1,6 @@
/*
AngelCode Scripting Library
Copyright (c) 2003-2012 Andreas Jonsson
Copyright (c) 2003-2014 Andreas Jonsson
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
@@ -31,8 +31,8 @@
#include "as_config.h"
#include <stdarg.h> // va_list, va_start(), etc
#include <stdlib.h> // strtod(), strtol()
#include <string.h> // some compilers declare memcpy() here
#include <stdlib.h> // strtod(), strtol()
#include <string.h> // some compilers declare memcpy() here
#if !defined(AS_NO_MEMORY_H)
#include <memory.h>
@@ -56,6 +56,26 @@ asCString::asCString(const asCString &str)
Assign(str.AddressOf(), str.length);
}
#ifdef AS_CAN_USE_CPP11
asCString::asCString(asCString &&str)
{
if( str.length <= 11 )
{
length = str.length;
memcpy(local, str.local, length);
local[length] = 0;
}
else
{
dynamic = str.dynamic;
length = str.length;
}
str.dynamic = 0;
str.length = 0;
}
#endif // c++11
asCString::asCString(const char *str, size_t len)
{
length = 0;
@@ -183,6 +203,37 @@ asCString &asCString::operator =(const asCString &str)
return *this;
}
#ifdef AS_CAN_USE_CPP11
asCString &asCString::operator =(asCString &&str)
{
if( this != &str )
{
if( length > 11 && dynamic )
{
asDELETEARRAY(dynamic);
}
if ( str.length <= 11 )
{
length = str.length;
memcpy(local, str.local, length);
local[length] = 0;
}
else
{
dynamic = str.dynamic;
length = str.length;
}
str.dynamic = 0;
str.length = 0;
}
return *this;
}
#endif // c++11
asCString &asCString::operator =(char ch)
{
Assign(&ch, 1);