crlib: update upstream
msvc: fix project paths
This commit is contained in:
parent
cf501b75b7
commit
785e927185
5 changed files with 267 additions and 268 deletions
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// CRLib - Simple library for STL replacement in private projects.
|
||||
// Copyright © 2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2020 YaPB Development Team <team@yapb.ru>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -33,9 +33,9 @@ CR_NAMESPACE_BEGIN
|
|||
// simple array class like std::vector
|
||||
template <typename T, ReservePolicy R = ReservePolicy::Multiple, size_t S = 0> class Array : public DenyCopying {
|
||||
private:
|
||||
T *m_data {};
|
||||
size_t m_capacity {};
|
||||
size_t m_length {};
|
||||
T *contents_ {};
|
||||
size_t capacity_ {};
|
||||
size_t length_ {};
|
||||
|
||||
public:
|
||||
explicit Array () {
|
||||
|
|
@ -49,9 +49,9 @@ public:
|
|||
}
|
||||
|
||||
Array (Array &&rhs) noexcept {
|
||||
m_data = rhs.m_data;
|
||||
m_length = rhs.m_length;
|
||||
m_capacity = rhs.m_capacity;
|
||||
contents_ = rhs.contents_;
|
||||
length_ = rhs.length_;
|
||||
capacity_ = rhs.capacity_;
|
||||
|
||||
rhs.reset ();
|
||||
}
|
||||
|
|
@ -68,8 +68,8 @@ public:
|
|||
|
||||
private:
|
||||
void destructElements () noexcept {
|
||||
for (size_t i = 0; i < m_length; ++i) {
|
||||
alloc.destruct (&m_data[i]);
|
||||
for (size_t i = 0; i < length_; ++i) {
|
||||
alloc.destruct (&contents_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -82,55 +82,55 @@ private:
|
|||
|
||||
void destroy () {
|
||||
destructElements ();
|
||||
alloc.deallocate (m_data);
|
||||
alloc.deallocate (contents_);
|
||||
}
|
||||
|
||||
void reset () {
|
||||
m_data = nullptr;
|
||||
m_capacity = 0;
|
||||
m_length = 0;
|
||||
contents_ = nullptr;
|
||||
capacity_ = 0;
|
||||
length_ = 0;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
bool reserve (const size_t amount) {
|
||||
if (m_length + amount < m_capacity) {
|
||||
if (length_ + amount < capacity_) {
|
||||
return true;
|
||||
}
|
||||
auto capacity = m_capacity ? m_capacity : 12;
|
||||
auto capacity = capacity_ ? capacity_ : 12;
|
||||
|
||||
if (cr::fix (R == ReservePolicy::Multiple)) {
|
||||
while (m_length + amount > capacity) {
|
||||
while (length_ + amount > capacity) {
|
||||
capacity *= 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
capacity = amount + m_capacity + 1;
|
||||
capacity = amount + capacity_ + 1;
|
||||
}
|
||||
auto data = alloc.allocate <T> (capacity);
|
||||
|
||||
if (m_data) {
|
||||
transferElements (data, m_data, m_length);
|
||||
alloc.deallocate (m_data);
|
||||
if (contents_) {
|
||||
transferElements (data, contents_, length_);
|
||||
alloc.deallocate (contents_);
|
||||
}
|
||||
|
||||
m_data = data;
|
||||
m_capacity = capacity;
|
||||
contents_ = data;
|
||||
capacity_ = capacity;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool resize (const size_t amount) {
|
||||
if (amount < m_length) {
|
||||
while (amount < m_length) {
|
||||
if (amount < length_) {
|
||||
while (amount < length_) {
|
||||
discard ();
|
||||
}
|
||||
}
|
||||
else if (amount > m_length) {
|
||||
else if (amount > length_) {
|
||||
if (!ensure (amount)) {
|
||||
return false;
|
||||
}
|
||||
size_t resizeLength = amount - m_length;
|
||||
size_t resizeLength = amount - length_;
|
||||
|
||||
while (resizeLength--) {
|
||||
emplace ();
|
||||
|
|
@ -140,30 +140,30 @@ public:
|
|||
}
|
||||
|
||||
bool ensure (const size_t amount) {
|
||||
if (amount <= m_length) {
|
||||
if (amount <= length_) {
|
||||
return true;
|
||||
}
|
||||
return reserve (amount - m_length);
|
||||
return reserve (amount - length_);
|
||||
}
|
||||
|
||||
template <typename U = size_t> U length () const {
|
||||
return static_cast <U> (m_length);
|
||||
return static_cast <U> (length_);
|
||||
}
|
||||
|
||||
size_t capacity () const {
|
||||
return m_capacity;
|
||||
return capacity_;
|
||||
}
|
||||
|
||||
template <typename U> bool set (size_t index, U &&object) {
|
||||
if (index >= m_capacity) {
|
||||
if (index >= capacity_) {
|
||||
if (!reserve (index + 1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
alloc.construct (&m_data[index], cr::forward <U> (object));
|
||||
alloc.construct (&contents_[index], cr::forward <U> (object));
|
||||
|
||||
if (index >= m_length) {
|
||||
m_length = index + 1;
|
||||
if (index >= length_) {
|
||||
length_ = index + 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -176,28 +176,28 @@ public:
|
|||
if (!objects || !count) {
|
||||
return false;
|
||||
}
|
||||
const size_t capacity = (m_length > index ? m_length : index) + count;
|
||||
const size_t capacity = (length_ > index ? length_ : index) + count;
|
||||
|
||||
if (capacity >= m_capacity && !reserve (capacity)) {
|
||||
if (capacity >= capacity_ && !reserve (capacity)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (index >= m_length) {
|
||||
if (index >= length_) {
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
alloc.construct (&m_data[i + index], cr::forward <U> (objects[i]));
|
||||
alloc.construct (&contents_[i + index], cr::forward <U> (objects[i]));
|
||||
}
|
||||
m_length = capacity;
|
||||
length_ = capacity;
|
||||
}
|
||||
else {
|
||||
size_t i = 0;
|
||||
|
||||
for (i = m_length; i > index; --i) {
|
||||
m_data[i + count - 1] = cr::move (m_data[i - 1]);
|
||||
for (i = length_; i > index; --i) {
|
||||
contents_[i + count - 1] = cr::move (contents_[i - 1]);
|
||||
}
|
||||
for (i = 0; i < count; ++i) {
|
||||
alloc.construct (&m_data[i + index], cr::forward <U> (objects[i]));
|
||||
alloc.construct (&contents_[i + index], cr::forward <U> (objects[i]));
|
||||
}
|
||||
m_length += count;
|
||||
length_ += count;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -206,20 +206,20 @@ public:
|
|||
if (&rhs == this) {
|
||||
return false;
|
||||
}
|
||||
return insert (at, &rhs.m_data[0], rhs.m_length);
|
||||
return insert (at, &rhs.contents_[0], rhs.length_);
|
||||
}
|
||||
|
||||
bool erase (const size_t index, const size_t count) {
|
||||
if (index + count > m_capacity) {
|
||||
if (index + count > capacity_) {
|
||||
return false;
|
||||
}
|
||||
for (size_t i = index; i < index + count; ++i) {
|
||||
alloc.destruct (&m_data[i]);
|
||||
alloc.destruct (&contents_[i]);
|
||||
}
|
||||
m_length -= count;
|
||||
length_ -= count;
|
||||
|
||||
for (size_t i = index; i < m_length; ++i) {
|
||||
m_data[i] = cr::move (m_data[i + count]);
|
||||
for (size_t i = index; i < length_; ++i) {
|
||||
contents_[i] = cr::move (contents_[i + count]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -240,8 +240,8 @@ public:
|
|||
if (!reserve (1)) {
|
||||
return false;
|
||||
}
|
||||
alloc.construct (&m_data[m_length], cr::forward <U> (object));
|
||||
++m_length;
|
||||
alloc.construct (&contents_[length_], cr::forward <U> (object));
|
||||
++length_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -250,41 +250,41 @@ public:
|
|||
if (!reserve (1)) {
|
||||
return false;
|
||||
}
|
||||
alloc.construct (&m_data[m_length], cr::forward <Args> (args)...);
|
||||
++m_length;
|
||||
alloc.construct (&contents_[length_], cr::forward <Args> (args)...);
|
||||
++length_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
T pop () {
|
||||
auto object = cr::move (m_data[m_length - 1]);
|
||||
auto object = cr::move (contents_[length_ - 1]);
|
||||
discard ();
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
void discard () {
|
||||
erase (m_length - 1, 1);
|
||||
erase (length_ - 1, 1);
|
||||
}
|
||||
|
||||
size_t index (const T &object) const {
|
||||
return &object - &m_data[0];
|
||||
return &object - &contents_[0];
|
||||
}
|
||||
|
||||
void shuffle () {
|
||||
for (size_t i = m_length; i >= 1; --i) {
|
||||
cr::swap (m_data[i - 1], m_data[rg.int_ (i, m_length - 2)]);
|
||||
for (size_t i = length_; i >= 1; --i) {
|
||||
cr::swap (contents_[i - 1], contents_[rg.int_ (i, length_ - 2)]);
|
||||
}
|
||||
}
|
||||
|
||||
void reverse () {
|
||||
for (size_t i = 0; i < m_length / 2; ++i) {
|
||||
cr::swap (m_data[i], m_data[m_length - 1 - i]);
|
||||
for (size_t i = 0; i < length_ / 2; ++i) {
|
||||
cr::swap (contents_[i], contents_[length_ - 1 - i]);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename U> bool extend (U &&rhs) {
|
||||
if (m_length == 0) {
|
||||
if (length_ == 0) {
|
||||
*this = cr::move (rhs);
|
||||
}
|
||||
else {
|
||||
|
|
@ -304,67 +304,67 @@ public:
|
|||
|
||||
void clear () {
|
||||
destructElements ();
|
||||
m_length = 0;
|
||||
length_ = 0;
|
||||
}
|
||||
|
||||
bool empty () const {
|
||||
return m_length == 0;
|
||||
return length_ == 0;
|
||||
}
|
||||
|
||||
bool shrink () {
|
||||
if (m_length == m_capacity || !m_length) {
|
||||
if (length_ == capacity_ || !length_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto data = alloc.allocate <T> (m_length);
|
||||
transferElements (data, m_data, m_length);
|
||||
auto data = alloc.allocate <T> (length_);
|
||||
transferElements (data, contents_, length_);
|
||||
|
||||
alloc.deallocate (m_data);
|
||||
alloc.deallocate (contents_);
|
||||
|
||||
m_data = data;
|
||||
m_capacity = m_length;
|
||||
contents_ = data;
|
||||
capacity_ = length_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const T &at (size_t index) const {
|
||||
return m_data[index];
|
||||
return contents_[index];
|
||||
}
|
||||
|
||||
T &at (size_t index) {
|
||||
return m_data[index];
|
||||
return contents_[index];
|
||||
}
|
||||
|
||||
const T &first () const {
|
||||
return m_data[0];
|
||||
return contents_[0];
|
||||
}
|
||||
|
||||
T &first () {
|
||||
return m_data[0];
|
||||
return contents_[0];
|
||||
}
|
||||
|
||||
T &last () {
|
||||
return m_data[m_length - 1];
|
||||
return contents_[length_ - 1];
|
||||
}
|
||||
|
||||
const T &last () const {
|
||||
return m_data[m_length - 1];
|
||||
return contents_[length_ - 1];
|
||||
}
|
||||
|
||||
const T &random () const {
|
||||
return m_data[rg.int_ <size_t> (0, m_length - 1)];
|
||||
return contents_[rg.int_ <size_t> (0, length_ - 1)];
|
||||
}
|
||||
|
||||
T &random () {
|
||||
return m_data[rg.int_ <size_t> (0u, m_length - 1u)];
|
||||
return contents_[rg.int_ <size_t> (0u, length_ - 1u)];
|
||||
}
|
||||
|
||||
T *data () {
|
||||
return m_data;
|
||||
return contents_;
|
||||
}
|
||||
|
||||
T *data () const {
|
||||
return m_data;
|
||||
return contents_;
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -372,9 +372,9 @@ public:
|
|||
if (this != &rhs) {
|
||||
destroy ();
|
||||
|
||||
m_data = rhs.m_data;
|
||||
m_length = rhs.m_length;
|
||||
m_capacity = rhs.m_capacity;
|
||||
contents_ = rhs.contents_;
|
||||
length_ = rhs.length_;
|
||||
capacity_ = rhs.capacity_;
|
||||
|
||||
rhs.reset ();
|
||||
}
|
||||
|
|
@ -393,19 +393,19 @@ public:
|
|||
// for range-based loops
|
||||
public:
|
||||
T *begin () {
|
||||
return m_data;
|
||||
return contents_;
|
||||
}
|
||||
|
||||
T *begin () const {
|
||||
return m_data;
|
||||
return contents_;
|
||||
}
|
||||
|
||||
T *end () {
|
||||
return m_data + m_length;
|
||||
return contents_ + length_;
|
||||
}
|
||||
|
||||
T *end () const {
|
||||
return m_data + m_length;
|
||||
return contents_ + length_;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// CRLib - Simple library for STL replacement in private projects.
|
||||
// Copyright © 2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2020 YaPB Development Team <team@yapb.ru>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -96,38 +96,38 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
Array <DictList *> m_table;
|
||||
Array <DictBucket> m_buckets{};
|
||||
H m_hasher;
|
||||
Array <DictList *> contents_;
|
||||
Array <DictBucket> buckets_;
|
||||
H hashFunction_;
|
||||
|
||||
private:
|
||||
uint32 hash (const K &key) const {
|
||||
return m_hasher (key);
|
||||
return hashFunction_ (key);
|
||||
}
|
||||
|
||||
size_t find (const K &key, bool allocate) {
|
||||
auto hashed = hash (key);
|
||||
auto pos = hashed % m_table.length ();
|
||||
auto pos = hashed % contents_.length ();
|
||||
|
||||
for (auto bucket = m_table[pos]; bucket != nullptr; bucket = bucket->next) {
|
||||
if (m_buckets[bucket->index].hash == hashed) {
|
||||
for (auto bucket = contents_[pos]; bucket != nullptr; bucket = bucket->next) {
|
||||
if (buckets_[bucket->index].hash == hashed) {
|
||||
return bucket->index;
|
||||
}
|
||||
}
|
||||
|
||||
if (allocate) {
|
||||
size_t created = m_buckets.length ();
|
||||
m_buckets.resize (created + 1);
|
||||
size_t created = buckets_.length ();
|
||||
buckets_.resize (created + 1);
|
||||
|
||||
auto allocated = alloc.allocate <DictList> ();
|
||||
|
||||
allocated->index = static_cast <int32> (created);
|
||||
allocated->next = m_table[pos];
|
||||
allocated->next = contents_[pos];
|
||||
|
||||
m_table[pos] = allocated;
|
||||
contents_[pos] = allocated;
|
||||
|
||||
m_buckets[created].key = key;
|
||||
m_buckets[created].hash = hashed;
|
||||
buckets_[created].key = key;
|
||||
buckets_[created].hash = hashed;
|
||||
|
||||
return created;
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ public:
|
|||
reset ();
|
||||
}
|
||||
|
||||
Dictionary (Dictionary &&rhs) noexcept : m_table (cr::move (rhs.m_table)), m_buckets (cr::move (rhs.m_buckets)), m_hasher (cr::move (rhs.m_hasher))
|
||||
Dictionary (Dictionary &&rhs) noexcept : contents_ (cr::move (rhs.contents_)), buckets_ (cr::move (rhs.buckets_)), hashFunction_ (cr::move (rhs.hashFunction_))
|
||||
{ }
|
||||
|
||||
~Dictionary () {
|
||||
|
|
@ -156,11 +156,11 @@ public:
|
|||
}
|
||||
|
||||
bool empty () const {
|
||||
return m_buckets.empty ();
|
||||
return buckets_.empty ();
|
||||
}
|
||||
|
||||
size_t length () const {
|
||||
return m_buckets.length ();
|
||||
return buckets_.length ();
|
||||
}
|
||||
|
||||
bool find (const K &key, V &value) const {
|
||||
|
|
@ -169,7 +169,7 @@ public:
|
|||
if (index == InvalidIndex) {
|
||||
return false;
|
||||
}
|
||||
value = m_buckets[index].value;
|
||||
value = buckets_[index].value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -181,20 +181,20 @@ public:
|
|||
bool remove (const K &key) {
|
||||
auto hashed = hash (key);
|
||||
|
||||
auto pos = hashed % m_table.length ();
|
||||
auto *bucket = m_table[pos];
|
||||
auto pos = hashed % contents_.length ();
|
||||
auto *bucket = contents_[pos];
|
||||
|
||||
DictList *next = nullptr;
|
||||
|
||||
while (bucket != nullptr) {
|
||||
if (m_buckets[bucket->index].hash == hashed) {
|
||||
if (buckets_[bucket->index].hash == hashed) {
|
||||
if (!next) {
|
||||
m_table[pos] = bucket->next;
|
||||
contents_[pos] = bucket->next;
|
||||
}
|
||||
else {
|
||||
next->next = bucket->next;
|
||||
}
|
||||
m_buckets.erase (bucket->index, 1);
|
||||
buckets_.erase (bucket->index, 1);
|
||||
|
||||
alloc.deallocate (bucket);
|
||||
bucket = nullptr;
|
||||
|
|
@ -208,7 +208,7 @@ public:
|
|||
}
|
||||
|
||||
void clear () {
|
||||
for (auto object : m_table) {
|
||||
for (auto object : contents_) {
|
||||
while (object != nullptr) {
|
||||
auto next = object->next;
|
||||
|
||||
|
|
@ -216,34 +216,34 @@ public:
|
|||
object = next;
|
||||
}
|
||||
}
|
||||
m_table.clear ();
|
||||
m_buckets.clear ();
|
||||
contents_.clear ();
|
||||
buckets_.clear ();
|
||||
|
||||
reset ();
|
||||
}
|
||||
|
||||
void reset () {
|
||||
m_table.resize (HashSize);
|
||||
contents_.resize (HashSize);
|
||||
|
||||
for (size_t i = 0; i < HashSize; ++i) {
|
||||
m_table[i] = nullptr;
|
||||
contents_[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
V &operator [] (const K &key) {
|
||||
return m_buckets[find (key, true)].value;
|
||||
return buckets_[find (key, true)].value;
|
||||
}
|
||||
|
||||
const V &operator [] (const K &key) const {
|
||||
return m_buckets[findIndex (key)].value;
|
||||
return buckets_[findIndex (key)].value;
|
||||
}
|
||||
|
||||
Dictionary &operator = (Dictionary &&rhs) noexcept {
|
||||
if (this != &rhs) {
|
||||
m_table = cr::move (rhs.m_table);
|
||||
m_buckets = cr::move (rhs.m_buckets);
|
||||
m_hasher = cr::move (rhs.m_hasher);
|
||||
contents_ = cr::move (rhs.contents_);
|
||||
buckets_ = cr::move (rhs.buckets_);
|
||||
hashFunction_ = cr::move (rhs.hashFunction_);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -251,19 +251,19 @@ public:
|
|||
// for range-based loops
|
||||
public:
|
||||
DictBucket *begin () {
|
||||
return m_buckets.begin ();
|
||||
return buckets_.begin ();
|
||||
}
|
||||
|
||||
DictBucket *begin () const {
|
||||
return m_buckets.begin ();
|
||||
return buckets_.begin ();
|
||||
}
|
||||
|
||||
DictBucket *end () {
|
||||
return m_buckets.end ();
|
||||
return buckets_.end ();
|
||||
}
|
||||
|
||||
DictBucket *end () const {
|
||||
return m_buckets.end ();
|
||||
return buckets_.end ();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// CRLib - Simple library for STL replacement in private projects.
|
||||
// Copyright © 2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2020 YaPB Development Team <team@yapb.ru>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -21,7 +21,6 @@
|
|||
#include <crlib/cr-basic.h>
|
||||
#include <crlib/cr-alloc.h>
|
||||
#include <crlib/cr-movable.h>
|
||||
#include <crlib/cr-twin.h>
|
||||
#include <crlib/cr-uniqueptr.h>
|
||||
#include <crlib/cr-array.h>
|
||||
|
||||
|
|
@ -504,7 +503,7 @@ public:
|
|||
}
|
||||
|
||||
StringRef str () const {
|
||||
return StringRef (chars_.get (), length_);
|
||||
return { chars_.get (), length_ };
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -824,8 +823,8 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
char m_data[RotationCount + 1][StaticBufferSize] {};
|
||||
size_t m_rotate = 0;
|
||||
char data_[RotationCount + 1][StaticBufferSize] {};
|
||||
size_t rotate_ = 0;
|
||||
|
||||
public:
|
||||
StringBuffer () = default;
|
||||
|
|
@ -833,24 +832,24 @@ public:
|
|||
|
||||
public:
|
||||
char *chars () noexcept {
|
||||
if (++m_rotate >= RotationCount) {
|
||||
m_rotate = 0;
|
||||
if (++rotate_ >= RotationCount) {
|
||||
rotate_ = 0;
|
||||
}
|
||||
auto result = m_data[cr::clamp <size_t> (m_rotate, 0, RotationCount)];
|
||||
auto result = data_[cr::clamp <size_t> (rotate_, 0, RotationCount)];
|
||||
result[0] = kNullChar;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename U, typename ...Args> U *format (const U *fmt, Args &&...args) noexcept {
|
||||
auto buffer = Singleton <StringBuffer>::instance ().chars ();
|
||||
auto buffer = Singleton <StringBuffer>::instance ()->chars ();
|
||||
fmtwrap.exec (buffer, StaticBufferSize, fmt, args...);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
template <typename U> U *format (const U *fmt) noexcept {
|
||||
auto buffer = Singleton <StringBuffer>::instance ().chars ();
|
||||
auto buffer = Singleton <StringBuffer>::instance ()->chars ();
|
||||
copy (buffer, fmt, StaticBufferSize);
|
||||
|
||||
return buffer;
|
||||
|
|
@ -918,7 +917,7 @@ private:
|
|||
};
|
||||
|
||||
private:
|
||||
Utf8CaseTable m_toUpperTable[Utf8MaxChars] = {
|
||||
Utf8CaseTable upperTable_[Utf8MaxChars] = {
|
||||
{ 0x0061, 0x0041 }, { 0x0062, 0x0042 }, { 0x0063, 0x0043 }, { 0x0064, 0x0044 }, { 0x0065, 0x0045 }, { 0x0066, 0x0046 }, { 0x0067, 0x0047 }, { 0x0068, 0x0048 },
|
||||
{ 0x0069, 0x0049 }, { 0x006a, 0x004a }, { 0x006b, 0x004b }, { 0x006c, 0x004c }, { 0x006d, 0x004d }, { 0x006e, 0x004e }, { 0x006f, 0x004f }, { 0x0070, 0x0050 },
|
||||
{ 0x0071, 0x0051 }, { 0x0072, 0x0052 }, { 0x0073, 0x0053 }, { 0x0074, 0x0054 }, { 0x0075, 0x0055 }, { 0x0076, 0x0056 }, { 0x0077, 0x0057 }, { 0x0078, 0x0058 },
|
||||
|
|
@ -1011,16 +1010,16 @@ private:
|
|||
};
|
||||
|
||||
private:
|
||||
SmallArray <Utf8Table> m_utfTable;
|
||||
SmallArray <Utf8Table> utfTable_;
|
||||
|
||||
private:
|
||||
void buildTable () {
|
||||
m_utfTable.emplace (0x80, 0x00, 0 * 6, 0x7f, 0); // 1 byte sequence
|
||||
m_utfTable.emplace (0xe0, 0xc0, 1 * 6, 0x7ff, 0x80); // 2 byte sequence
|
||||
m_utfTable.emplace (0xf0, 0xe0, 2 * 6, 0xffff, 0x800); // 3 byte sequence
|
||||
m_utfTable.emplace (0xf8, 0xf0, 3 * 6, 0x1fffff, 0x10000); // 4 byte sequence
|
||||
m_utfTable.emplace (0xfc, 0xf8, 4 * 6, 0x3ffffff, 0x200000); // 5 byte sequence
|
||||
m_utfTable.emplace (0xfe, 0xfc, 5 * 6, 0x7fffffff, 0x4000000); // 6 byte sequence
|
||||
utfTable_.emplace (0x80, 0x00, 0 * 6, 0x7f, 0); // 1 byte sequence
|
||||
utfTable_.emplace (0xe0, 0xc0, 1 * 6, 0x7ff, 0x80); // 2 byte sequence
|
||||
utfTable_.emplace (0xf0, 0xe0, 2 * 6, 0xffff, 0x800); // 3 byte sequence
|
||||
utfTable_.emplace (0xf8, 0xf0, 3 * 6, 0x1fffff, 0x10000); // 4 byte sequence
|
||||
utfTable_.emplace (0xfc, 0xf8, 4 * 6, 0x3ffffff, 0x200000); // 5 byte sequence
|
||||
utfTable_.emplace (0xfe, 0xfc, 5 * 6, 0x7fffffff, 0x4000000); // 6 byte sequence
|
||||
}
|
||||
|
||||
int32 multiByteToWideChar (wchar_t *wide, const char *mbs) {
|
||||
|
|
@ -1029,7 +1028,7 @@ private:
|
|||
auto ch = *mbs;
|
||||
auto lval = static_cast <int> (ch);
|
||||
|
||||
for (const auto &table : m_utfTable) {
|
||||
for (const auto &table : utfTable_) {
|
||||
len++;
|
||||
|
||||
if ((ch & table.cmask) == table.cval) {
|
||||
|
|
@ -1059,7 +1058,7 @@ private:
|
|||
long lmask = wide;
|
||||
int32 len = 0;
|
||||
|
||||
for (const auto &table : m_utfTable) {
|
||||
for (const auto &table : utfTable_) {
|
||||
len++;
|
||||
|
||||
if (lmask <= table.lmask) {
|
||||
|
|
@ -1092,10 +1091,10 @@ public:
|
|||
|
||||
while (bottom <= top) {
|
||||
const auto mid = (bottom + top) / 2;
|
||||
wchar_t cur = static_cast <wchar_t> (m_toUpperTable[mid].from);
|
||||
auto cur = static_cast <wchar_t> (upperTable_[mid].from);
|
||||
|
||||
if (ch == cur) {
|
||||
return static_cast <wchar_t> (m_toUpperTable[mid].to);
|
||||
return static_cast <wchar_t> (upperTable_[mid].to);
|
||||
}
|
||||
if (ch > cur) {
|
||||
bottom = mid + 1;
|
||||
|
|
|
|||
|
|
@ -11,36 +11,36 @@
|
|||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-alloc.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-array.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-basic.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-binheap.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-color.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-complete.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-dict.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-files.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-hook.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-http.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-lambda.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-library.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-logger.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-math.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-movable.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-platform.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-random.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-string.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-twin.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-ulz.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-uniqueptr.h" />
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-vector.h" />
|
||||
<ClInclude Include="..\ext\sdk\sdk\const.h" />
|
||||
<ClInclude Include="..\ext\sdk\sdk\eiface.h" />
|
||||
<ClInclude Include="..\ext\sdk\sdk\extdll.h" />
|
||||
<ClInclude Include="..\ext\sdk\sdk\metamod.h" />
|
||||
<ClInclude Include="..\ext\sdk\sdk\meta_api.h" />
|
||||
<ClInclude Include="..\ext\sdk\sdk\model.h" />
|
||||
<ClInclude Include="..\ext\sdk\sdk\progdefs.h" />
|
||||
<ClInclude Include="..\ext\sdk\sdk\util.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-alloc.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-array.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-basic.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-binheap.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-color.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-complete.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-dict.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-files.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-hook.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-http.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-lambda.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-library.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-logger.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-math.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-movable.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-platform.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-random.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-string.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-twin.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-ulz.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-uniqueptr.h" />
|
||||
<ClInclude Include="..\ext\crlib\cr-vector.h" />
|
||||
<ClInclude Include="..\ext\hlsdk\const.h" />
|
||||
<ClInclude Include="..\ext\hlsdk\eiface.h" />
|
||||
<ClInclude Include="..\ext\hlsdk\extdll.h" />
|
||||
<ClInclude Include="..\ext\hlsdk\metamod.h" />
|
||||
<ClInclude Include="..\ext\hlsdk\meta_api.h" />
|
||||
<ClInclude Include="..\ext\hlsdk\model.h" />
|
||||
<ClInclude Include="..\ext\hlsdk\progdefs.h" />
|
||||
<ClInclude Include="..\ext\hlsdk\util.h" />
|
||||
<ClInclude Include="..\inc\config.h" />
|
||||
<ClInclude Include="..\inc\control.h" />
|
||||
<ClInclude Include="..\inc\engine.h" />
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@
|
|||
<Filter Include="inc\ext\crlib">
|
||||
<UniqueIdentifier>{bec0fb46-08b4-4bfa-900c-d279a933ff77}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="inc\ext\sdk">
|
||||
<UniqueIdentifier>{f6a0fc04-bdf5-479b-8e5a-85eae698541e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="res">
|
||||
<UniqueIdentifier>{5e73b918-f42b-4df9-bbe9-918289e44ad2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="inc\ext\hlsdk">
|
||||
<UniqueIdentifier>{f6a0fc04-bdf5-479b-8e5a-85eae698541e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\inc\config.h">
|
||||
|
|
@ -42,96 +42,6 @@
|
|||
<ClInclude Include="..\inc\yapb.h">
|
||||
<Filter>inc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-alloc.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-array.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-basic.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-binheap.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-color.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-complete.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-dict.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-files.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-hook.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-http.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-lambda.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-library.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-logger.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-math.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-movable.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-platform.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-random.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-string.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-twin.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-ulz.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-uniqueptr.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\crlib\cr-vector.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\sdk\sdk\const.h">
|
||||
<Filter>inc\ext\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\sdk\sdk\eiface.h">
|
||||
<Filter>inc\ext\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\sdk\sdk\extdll.h">
|
||||
<Filter>inc\ext\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\sdk\sdk\meta_api.h">
|
||||
<Filter>inc\ext\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\sdk\sdk\metamod.h">
|
||||
<Filter>inc\ext\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\sdk\sdk\model.h">
|
||||
<Filter>inc\ext\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\sdk\sdk\progdefs.h">
|
||||
<Filter>inc\ext\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\sdk\sdk\util.h">
|
||||
<Filter>inc\ext\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\inc\product.h">
|
||||
<Filter>inc</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -141,6 +51,96 @@
|
|||
<ClInclude Include="..\inc\version.h">
|
||||
<Filter>inc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\hlsdk\const.h">
|
||||
<Filter>inc\ext\hlsdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\hlsdk\eiface.h">
|
||||
<Filter>inc\ext\hlsdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\hlsdk\extdll.h">
|
||||
<Filter>inc\ext\hlsdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\hlsdk\meta_api.h">
|
||||
<Filter>inc\ext\hlsdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\hlsdk\metamod.h">
|
||||
<Filter>inc\ext\hlsdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\hlsdk\model.h">
|
||||
<Filter>inc\ext\hlsdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\hlsdk\progdefs.h">
|
||||
<Filter>inc\ext\hlsdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\hlsdk\util.h">
|
||||
<Filter>inc\ext\hlsdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-alloc.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-array.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-basic.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-binheap.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-color.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-complete.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-dict.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-files.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-hook.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-http.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-lambda.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-library.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-logger.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-math.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-movable.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-platform.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-random.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-string.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-twin.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-ulz.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-uniqueptr.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\crlib\cr-vector.h">
|
||||
<Filter>inc\ext\crlib</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\android.cpp">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue