Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,29 @@
/**
* wWidgets - Lightweight UI Toolkit.
* Copyright (C) 2009-2011 Evgeny Andreeshchev <eugene.andreeshchev@gmail.com>
* Alexander Kotliar <alexander.kotliar@gmail.com>
*
* This code is distributed under the MIT License:
* http://www.opensource.org/licenses/MIT
*/
// Modifications copyright Amazon.com, Inc. or its affiliates
#include <QPropertyTree/Unicode.h>
#include <vector>
#include <QtCore/QString>
string fromWideChar(const wchar_t* wstr)
{
return QString::fromWCharArray(wstr).toUtf8().data();
}
wstring toWideChar(const char* str)
{
QString s = QString::fromUtf8(str);
std::vector<wchar_t> result(s.size()+1);
s.toWCharArray(&result[0]);
return &result[0];
}
@@ -0,0 +1,14 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(FILES
../Common/UnixLike/QPropertyTree/Unicode_UnixLike.cpp
)
@@ -0,0 +1,14 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(FILES
../Common/UnixLike/QPropertyTree/Unicode_UnixLike.cpp
)
@@ -0,0 +1,41 @@
/**
* wWidgets - Lightweight UI Toolkit.
* Copyright (C) 2009-2011 Evgeny Andreeshchev <eugene.andreeshchev@gmail.com>
* Alexander Kotliar <alexander.kotliar@gmail.com>
*
* This code is distributed under the MIT License:
* http://www.opensource.org/licenses/MIT
*/
// Modifications copyright Amazon.com, Inc. or its affiliates
#include <QPropertyTree/Unicode.h>
#include <AzCore/PlatformIncl.h>
string fromWideChar(const wchar_t* wstr)
{
// We have different implementation for windows as Qt for windows
// is built with wchar_t of diferent size (4 bytes, as on linux).
// Therefore we avoid calling any wchar_t functions in Qt.
const unsigned int codepage = CP_UTF8;
int len = WideCharToMultiByte(codepage, 0, wstr, -1, NULL, 0, 0, 0);
char* buf = (char*)alloca(len);
if (len > 1) {
WideCharToMultiByte(codepage, 0, wstr, -1, buf, len, 0, 0);
return string(buf, len - 1);
}
return string();
}
wstring toWideChar(const char* str)
{
const unsigned int codepage = CP_UTF8;
int len = MultiByteToWideChar(codepage, 0, str, -1, NULL, 0);
wchar_t* buf = (wchar_t*)alloca(len * sizeof(wchar_t));
if (len > 1) {
MultiByteToWideChar(codepage, 0, str, -1, buf, len);
return wstring(buf, len - 1);
}
return wstring();
}
@@ -0,0 +1,14 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(FILES
QPropertyTree/Unicode_Windows.cpp
)