summaryrefslogtreecommitdiff
path: root/mysql/extra/yassl/taocrypt/mySTL
diff options
context:
space:
mode:
Diffstat (limited to 'mysql/extra/yassl/taocrypt/mySTL')
-rw-r--r--mysql/extra/yassl/taocrypt/mySTL/algorithm.hpp108
-rw-r--r--mysql/extra/yassl/taocrypt/mySTL/helpers.hpp153
-rw-r--r--mysql/extra/yassl/taocrypt/mySTL/list.hpp367
-rw-r--r--mysql/extra/yassl/taocrypt/mySTL/memory.hpp136
-rw-r--r--mysql/extra/yassl/taocrypt/mySTL/memory_array.hpp135
-rw-r--r--mysql/extra/yassl/taocrypt/mySTL/pair.hpp58
-rw-r--r--mysql/extra/yassl/taocrypt/mySTL/stdexcept.hpp76
-rw-r--r--mysql/extra/yassl/taocrypt/mySTL/vector.hpp153
8 files changed, 0 insertions, 1186 deletions
diff --git a/mysql/extra/yassl/taocrypt/mySTL/algorithm.hpp b/mysql/extra/yassl/taocrypt/mySTL/algorithm.hpp
deleted file mode 100644
index 83be964..0000000
--- a/mysql/extra/yassl/taocrypt/mySTL/algorithm.hpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
-
- 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
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
-
-
-/* mySTL algorithm implements max, min, for_each, swap, find_if, copy,
- * copy_backward, fill
- */
-
-#ifndef mySTL_ALGORITHM_HPP
-#define mySTL_ALGORITHM_HPP
-
-
-namespace mySTL {
-
-
-template<typename T>
-inline const T& max(const T& a, const T&b)
-{
- return a < b ? b : a;
-}
-
-
-template<typename T>
-inline const T& min(const T& a, const T&b)
-{
- return b < a ? b : a;
-}
-
-
-template<typename InIter, typename Func>
-Func for_each(InIter first, InIter last, Func op)
-{
- while (first != last) {
- op(*first);
- ++first;
- }
- return op;
-}
-
-
-template<typename T>
-inline void swap(T& a, T& b)
-{
- T tmp = a;
- a = b;
- b = tmp;
-}
-
-
-template<typename InIter, typename Pred>
-InIter find_if(InIter first, InIter last, Pred pred)
-{
- while (first != last && !pred(*first))
- ++first;
- return first;
-}
-
-
-template<typename InputIter, typename OutputIter>
-inline OutputIter copy(InputIter first, InputIter last, OutputIter place)
-{
- while (first != last) {
- *place = *first;
- ++first;
- ++place;
- }
- return place;
-}
-
-
-template<typename InputIter, typename OutputIter>
-inline OutputIter
-copy_backward(InputIter first, InputIter last, OutputIter place)
-{
- while (first != last)
- *--place = *--last;
- return place;
-}
-
-
-template<typename InputIter, typename T>
-void fill(InputIter first, InputIter last, const T& v)
-{
- while (first != last) {
- *first = v;
- ++first;
- }
-}
-
-
-} // namespace mySTL
-
-#endif // mySTL_ALGORITHM_HPP
diff --git a/mysql/extra/yassl/taocrypt/mySTL/helpers.hpp b/mysql/extra/yassl/taocrypt/mySTL/helpers.hpp
deleted file mode 100644
index fc6e89d..0000000
--- a/mysql/extra/yassl/taocrypt/mySTL/helpers.hpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
-
- 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
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
-
-
-/* mySTL helpers implements misc constructs for vector and list
- *
- */
-
-#ifndef mySTL_HELPERS_HPP
-#define mySTL_HELPERS_HPP
-
-#include <stdlib.h>
-#ifdef _MSC_VER
- #include <new>
-#endif
-
-/*
- Workaround for the lack of operator new(size_t, void*)
- in IBM VA C++ 6.0
- Also used as a workaround to avoid including <new>
-*/
- struct Dummy {};
-
- inline void* operator new(size_t size, Dummy* d)
- {
- return static_cast<void*>(d);
- }
-
- // for compilers that want matching delete
- inline void operator delete(void* ptr, Dummy* d)
- {
- }
-
- typedef Dummy* yassl_pointer;
-
-namespace mySTL {
-
-
-template <typename T, typename T2>
-inline void construct(T* p, const T2& value)
-{
- new (reinterpret_cast<yassl_pointer>(p)) T(value);
-}
-
-
-template <typename T>
-inline void construct(T* p)
-{
- new (reinterpret_cast<yassl_pointer>(p)) T();
-}
-
-
-template <typename T>
-inline void destroy(T* p)
-{
- p->~T();
-}
-
-
-template <typename Iter>
-void destroy(Iter first, Iter last)
-{
- while (first != last) {
- destroy(&*first);
- ++first;
- }
-}
-
-
-template <typename Iter, typename PlaceIter>
-PlaceIter uninit_copy(Iter first, Iter last, PlaceIter place)
-{
- while (first != last) {
- construct(&*place, *first);
- ++first;
- ++place;
- }
- return place;
-}
-
-
-template <typename PlaceIter, typename Size, typename T>
-PlaceIter uninit_fill_n(PlaceIter place, Size n, const T& value)
-{
- while (n) {
- construct(&*place, value);
- --n;
- ++place;
- }
- return place;
-}
-
-
-template <typename T>
-T* GetArrayMemory(size_t items)
-{
- unsigned char* ret;
-
- #ifdef YASSL_LIB
- ret = NEW_YS unsigned char[sizeof(T) * items];
- #else
- ret = NEW_TC unsigned char[sizeof(T) * items];
- #endif
-
- return reinterpret_cast<T*>(ret);
-}
-
-
-template <typename T>
-void FreeArrayMemory(T* ptr)
-{
- unsigned char* p = reinterpret_cast<unsigned char*>(ptr);
-
- #ifdef YASSL_LIB
- yaSSL::ysArrayDelete(p);
- #else
- TaoCrypt::tcArrayDelete(p);
- #endif
-}
-
-
-
-inline void* GetMemory(size_t bytes)
-{
- return GetArrayMemory<unsigned char>(bytes);
-}
-
-
-inline void FreeMemory(void* ptr)
-{
- FreeArrayMemory(ptr);
-}
-
-
-
-} // namespace mySTL
-
-#endif // mySTL_HELPERS_HPP
diff --git a/mysql/extra/yassl/taocrypt/mySTL/list.hpp b/mysql/extra/yassl/taocrypt/mySTL/list.hpp
deleted file mode 100644
index df03e0a..0000000
--- a/mysql/extra/yassl/taocrypt/mySTL/list.hpp
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
-
- 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
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
-
-
-/* mySTL list implements a simple list
- *
- */
-
-#ifndef mySTL_LIST_HPP
-#define mySTL_LIST_HPP
-
-
-#include "helpers.hpp"
-
-
-namespace mySTL {
-
-
-
-template<typename T>
-class list {
-
-#ifdef __SUNPRO_CC
-/*
- Sun Forte 7 C++ v. 5.4 needs class 'node' public to be visible to
- the nested class 'iterator' (a non-standard behaviour).
-*/
-public:
-#endif
-
- struct node {
- node(T t) : prev_(0), next_(0), value_(t) {}
-
- node* prev_;
- node* next_;
- T value_;
- };
-public:
- list() : head_(0), tail_(0), sz_(0) {}
- ~list();
-
- void push_front(T);
- void pop_front();
- T front() const;
- void push_back(T);
- void pop_back();
- T back() const;
- bool remove(T);
- size_t size() const { return sz_; }
- bool empty() const { return sz_ == 0; }
-
- class iterator {
- node* current_;
- public:
- explicit iterator(node* p = 0) : current_(p) {}
-
- T& operator*() const
- {
- return current_->value_;
- }
-
- T* operator->() const
- {
- return &(operator*());
- }
-
- iterator& operator++()
- {
- current_ = current_->next_;
- return *this;
- }
-
- iterator& operator--()
- {
- current_ = current_->prev_;
- return *this;
- }
-
- iterator operator++(int)
- {
- iterator tmp = *this;
- current_ = current_->next_;
- return tmp;
- }
-
- iterator operator--(int)
- {
- iterator tmp = *this;
- current_ = current_->prev_;
- return tmp;
- }
-
- bool operator==(const iterator& other) const
- {
- return current_ == other.current_;
- }
-
- bool operator!=(const iterator& other) const
- {
- return current_ != other.current_;
- }
-
- friend class list<T>;
- };
-
-
- class reverse_iterator {
- node* current_;
- public:
- explicit reverse_iterator(node* p = 0) : current_(p) {}
-
- T& operator*() const
- {
- return current_->value_;
- }
-
- T* operator->() const
- {
- return &(operator*());
- }
-
- reverse_iterator& operator++()
- {
- current_ = current_->prev_;
- return *this;
- }
-
- reverse_iterator& operator--()
- {
- current_ = current_->next_;
- return *this;
- }
-
- reverse_iterator operator++(int)
- {
- reverse_iterator tmp = *this;
- current_ = current_->prev_;
- return tmp;
- }
-
- reverse_iterator operator--(int)
- {
- reverse_iterator tmp = *this;
- current_ = current_->next_;
- return tmp;
- }
-
- bool operator==(const reverse_iterator& other) const
- {
- return current_ == other.current_;
- }
-
- bool operator!=(const reverse_iterator& other) const
- {
- return current_ != other.current_;
- }
-
- friend class list<T>;
- };
-
- bool erase(iterator);
-
- iterator begin() const { return iterator(head_); }
- reverse_iterator rbegin() const { return reverse_iterator(tail_); }
- iterator end() const { return iterator(); }
- reverse_iterator rend() const { return reverse_iterator(); }
-
- typedef iterator const_iterator; // for now
-
- class underflow {};
- class overflow {};
-private:
- node* head_;
- node* tail_;
- size_t sz_;
-
- node* look_up(T);
-
- list(const list&); // hide copy
- list& operator=(const list&); // and assign
-};
-
-
-template<typename T>
-list<T>::~list()
-{
- node* start = head_;
- node* next_;
-
- for (; start; start = next_) {
- next_ = start->next_;
- destroy(start);
- FreeMemory(start);
- }
-}
-
-
-template<typename T>
-void list<T>::push_front(T t)
-{
- void* mem = GetMemory(sizeof(node));
- node* add = new (reinterpret_cast<yassl_pointer>(mem)) node(t);
-
- if (head_) {
- add->next_ = head_;
- head_->prev_ = add;
- }
- else
- tail_ = add;
-
- head_ = add;
- ++sz_;
-}
-
-
-template<typename T>
-void list<T>::pop_front()
-{
- node* front = head_;
-
- if (head_ == 0)
- return;
- else if (head_ == tail_)
- head_ = tail_ = 0;
- else {
- head_ = head_->next_;
- head_->prev_ = 0;
- }
- destroy(front);
- FreeMemory(front);
- --sz_;
-}
-
-
-template<typename T>
-T list<T>::front() const
-{
- if (head_ == 0) return T();
- return head_->value_;
-}
-
-
-template<typename T>
-void list<T>::push_back(T t)
-{
- void* mem = GetMemory(sizeof(node));
- node* add = new (reinterpret_cast<yassl_pointer>(mem)) node(t);
-
- if (tail_) {
- tail_->next_ = add;
- add->prev_ = tail_;
- }
- else
- head_ = add;
-
- tail_ = add;
- ++sz_;
-}
-
-
-template<typename T>
-void list<T>::pop_back()
-{
- node* rear = tail_;
-
- if (tail_ == 0)
- return;
- else if (tail_ == head_)
- tail_ = head_ = 0;
- else {
- tail_ = tail_->prev_;
- tail_->next_ = 0;
- }
- destroy(rear);
- FreeMemory(rear);
- --sz_;
-}
-
-
-template<typename T>
-T list<T>::back() const
-{
- if (tail_ == 0) return T();
- return tail_->value_;
-}
-
-
-template<typename T>
-typename list<T>::node* list<T>::look_up(T t)
-{
- node* list = head_;
-
- if (list == 0) return 0;
-
- for (; list; list = list->next_)
- if (list->value_ == t)
- return list;
-
- return 0;
-}
-
-
-template<typename T>
-bool list<T>::remove(T t)
-{
- node* del = look_up(t);
-
- if (del == 0)
- return false;
- else if (del == head_)
- pop_front();
- else if (del == tail_)
- pop_back();
- else {
- del->prev_->next_ = del->next_;
- del->next_->prev_ = del->prev_;
-
- destroy(del);
- FreeMemory(del);
- --sz_;
- }
- return true;
-}
-
-
-template<typename T>
-bool list<T>::erase(iterator iter)
-{
- node* del = iter.current_;
-
- if (del == 0)
- return false;
- else if (del == head_)
- pop_front();
- else if (del == tail_)
- pop_back();
- else {
- del->prev_->next_ = del->next_;
- del->next_->prev_ = del->prev_;
-
- destroy(del);
- FreeMemory(del);
- --sz_;
- }
- return true;
-}
-
-
-
-} // namespace mySTL
-
-#endif // mySTL_LIST_HPP
diff --git a/mysql/extra/yassl/taocrypt/mySTL/memory.hpp b/mysql/extra/yassl/taocrypt/mySTL/memory.hpp
deleted file mode 100644
index 7e709be..0000000
--- a/mysql/extra/yassl/taocrypt/mySTL/memory.hpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
-
- 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
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
-
-
-/* mySTL memory implements auto_ptr
- *
- */
-
-#ifndef mySTL_MEMORY_HPP
-#define mySTL_MEMORY_HPP
-
-#include "memory_array.hpp" // for auto_array
-
-#ifdef _MSC_VER
- // disable operator-> warning for builtins
- #pragma warning(disable:4284)
-#endif
-
-
-namespace mySTL {
-
-
-template<typename T>
-struct auto_ptr_ref {
- T* ptr_;
- explicit auto_ptr_ref(T* p) : ptr_(p) {}
-};
-
-
-template<typename T>
-class auto_ptr {
- T* ptr_;
-
- void Destroy()
- {
- #ifdef YASSL_LIB
- yaSSL::ysDelete(ptr_);
- #else
- TaoCrypt::tcDelete(ptr_);
- #endif
- }
-public:
- explicit auto_ptr(T* p = 0) : ptr_(p) {}
-
- ~auto_ptr()
- {
- Destroy();
- }
-
-
- auto_ptr(auto_ptr& other) : ptr_(other.release()) {}
-
- auto_ptr& operator=(auto_ptr& that)
- {
- if (this != &that) {
- Destroy();
- ptr_ = that.release();
- }
- return *this;
- }
-
-
- T* operator->() const
- {
- return ptr_;
- }
-
- T& operator*() const
- {
- return *ptr_;
- }
-
- T* get() const
- {
- return ptr_;
- }
-
- T* release()
- {
- T* tmp = ptr_;
- ptr_ = 0;
- return tmp;
- }
-
- void reset(T* p = 0)
- {
- if (ptr_ != p) {
- Destroy();
- ptr_ = p;
- }
- }
-
- // auto_ptr_ref conversions
- auto_ptr(auto_ptr_ref<T> ref) : ptr_(ref.ptr_) {}
-
- auto_ptr& operator=(auto_ptr_ref<T> ref)
- {
- if (this->ptr_ != ref.ptr_) {
- Destroy();
- ptr_ = ref.ptr_;
- }
- return *this;
- }
-
- template<typename T2>
- operator auto_ptr<T2>()
- {
- return auto_ptr<T2>(this->release());
- }
-
- template<typename T2>
- operator auto_ptr_ref<T2>()
- {
- return auto_ptr_ref<T2>(this->release());
- }
-};
-
-
-} // namespace mySTL
-
-#endif // mySTL_MEMORY_HPP
diff --git a/mysql/extra/yassl/taocrypt/mySTL/memory_array.hpp b/mysql/extra/yassl/taocrypt/mySTL/memory_array.hpp
deleted file mode 100644
index 1c238d9..0000000
--- a/mysql/extra/yassl/taocrypt/mySTL/memory_array.hpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
-
- 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
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
-
-
-/* mySTL memory_arry implements auto_array
- *
- */
-
-#ifndef mySTL_MEMORY_ARRAY_HPP
-#define mySTL_MEMORY_ARRAY_HPP
-
-
-#ifdef _MSC_VER
- // disable operator-> warning for builtins
- #pragma warning(disable:4284)
-#endif
-
-
-namespace mySTL {
-
-
-template<typename T>
-struct auto_array_ref {
- T* ptr_;
- explicit auto_array_ref(T* p) : ptr_(p) {}
-};
-
-
-template<typename T>
-class auto_array {
- T* ptr_;
-
- void Destroy()
- {
- #ifdef YASSL_LIB
- yaSSL::ysArrayDelete(ptr_);
- #else
- TaoCrypt::tcArrayDelete(ptr_);
- #endif
- }
-public:
- explicit auto_array(T* p = 0) : ptr_(p) {}
-
- ~auto_array()
- {
- Destroy();
- }
-
-
- auto_array(auto_array& other) : ptr_(other.release()) {}
-
- auto_array& operator=(auto_array& that)
- {
- if (this != &that) {
- Destroy();
- ptr_ = that.release();
- }
- return *this;
- }
-
-
- T* operator->() const
- {
- return ptr_;
- }
-
- T& operator*() const
- {
- return *ptr_;
- }
-
- T* get() const
- {
- return ptr_;
- }
-
- T* release()
- {
- T* tmp = ptr_;
- ptr_ = 0;
- return tmp;
- }
-
- void reset(T* p = 0)
- {
- if (ptr_ != p) {
- Destroy();
- ptr_ = p;
- }
- }
-
- // auto_array_ref conversions
- auto_array(auto_array_ref<T> ref) : ptr_(ref.ptr_) {}
-
- auto_array& operator=(auto_array_ref<T> ref)
- {
- if (this->ptr_ != ref.ptr_) {
- Destroy();
- ptr_ = ref.ptr_;
- }
- return *this;
- }
-
- template<typename T2>
- operator auto_array<T2>()
- {
- return auto_array<T2>(this->release());
- }
-
- template<typename T2>
- operator auto_array_ref<T2>()
- {
- return auto_array_ref<T2>(this->release());
- }
-};
-
-
-} // namespace mySTL
-
-#endif // mySTL_MEMORY_ARRAY_HPP
diff --git a/mysql/extra/yassl/taocrypt/mySTL/pair.hpp b/mysql/extra/yassl/taocrypt/mySTL/pair.hpp
deleted file mode 100644
index 545827a..0000000
--- a/mysql/extra/yassl/taocrypt/mySTL/pair.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
-
- 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
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
-
-
-/* mySTL pair implements pair
- *
- */
-
-#ifndef mySTL_PAIR_HPP
-#define mySTL_PAIR_HPP
-
-
-
-namespace mySTL {
-
-
-template<typename T1, typename T2>
-struct pair {
- typedef T1 first_type;
- typedef T2 second_type;
-
- first_type first;
- second_type second;
-
- pair() {}
- pair(const T1& t1, const T2& t2) : first(t1), second(t2) {}
-
- template<typename U1, typename U2>
- pair(const pair<U1, U2>& p) : first(p.first), second(p.second) {}
-};
-
-
-template<typename T1, typename T2>
-inline pair<T1, T2> make_pair(const T1& a, const T2& b)
-{
- return pair<T1, T2>(a, b);
-}
-
-
-
-} // namespace mySTL
-
-#endif // mySTL_PAIR_HPP
diff --git a/mysql/extra/yassl/taocrypt/mySTL/stdexcept.hpp b/mysql/extra/yassl/taocrypt/mySTL/stdexcept.hpp
deleted file mode 100644
index 79ae6de..0000000
--- a/mysql/extra/yassl/taocrypt/mySTL/stdexcept.hpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
-
- 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
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
-
-
-/* mySTL memory implements exception, runtime_error
- *
- */
-
-#ifndef mySTL_STDEXCEPT_HPP
-#define mySTL_STDEXCEPT_HPP
-
-
-#include <string.h> // strncpy
-#include <stdlib.h> // size_t
-
-
-namespace mySTL {
-
-
-class exception {
-public:
- exception() {}
- virtual ~exception() {} // to shut up compiler warnings
-
- virtual const char* what() const { return ""; }
-
- // for compiler generated call, never used
- static void operator delete(void*) { }
-private:
- // don't allow dynamic creation of exceptions
- static void* operator new(size_t);
-};
-
-
-class named_exception : public exception {
-public:
- enum { NAME_SIZE = 80 };
-
- explicit named_exception(const char* str)
- {
- strncpy(name_, str, NAME_SIZE);
- name_[NAME_SIZE - 1] = 0;
- }
-
- virtual const char* what() const { return name_; }
-private:
- char name_[NAME_SIZE];
-};
-
-
-class runtime_error : public named_exception {
-public:
- explicit runtime_error(const char* str) : named_exception(str) {}
-};
-
-
-
-
-} // namespace mySTL
-
-#endif // mySTL_STDEXCEPT_HPP
diff --git a/mysql/extra/yassl/taocrypt/mySTL/vector.hpp b/mysql/extra/yassl/taocrypt/mySTL/vector.hpp
deleted file mode 100644
index f3702b7..0000000
--- a/mysql/extra/yassl/taocrypt/mySTL/vector.hpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
-
- 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
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA.
-*/
-
-
-/* mySTL vector implements simple vector, w/ swap
- *
- */
-
-#ifndef mySTL_VECTOR_HPP
-#define mySTL_VECTOR_HPP
-
-#include "helpers.hpp" // construct, destory, fill, etc.
-#include "algorithm.hpp" // swap
-
-
-namespace mySTL {
-
-
-template <typename T>
-struct vector_base {
- T* start_;
- T* finish_;
- T* end_of_storage_;
-
- vector_base() : start_(0), finish_(0), end_of_storage_(0) {}
- vector_base(size_t n)
- {
- start_ = GetArrayMemory<T>(n);
- finish_ = start_;
- end_of_storage_ = start_ + n;
- }
-
- ~vector_base()
- {
- FreeArrayMemory(start_);
- }
-
- void Swap(vector_base& that)
- {
- swap(start_, that.start_);
- swap(finish_, that.finish_);
- swap(end_of_storage_, that.end_of_storage_);
- }
-};
-
-
-
-template <typename T>
-class vector {
-public:
- typedef T* iterator;
- typedef const T* const_iterator;
-
- vector() {}
- explicit vector(size_t n) : vec_(n)
- {
- vec_.finish_ = uninit_fill_n(vec_.start_, n, T());
- }
-
- ~vector() { destroy(vec_.start_, vec_.finish_); }
-
- vector(const vector& other) : vec_(other.size())
- {
- vec_.finish_ = uninit_copy(other.vec_.start_, other.vec_.finish_,
- vec_.start_);
- }
-
- size_t capacity() const { return vec_.end_of_storage_ - vec_.start_; }
-
- size_t size() const { return vec_.finish_ - vec_.start_; }
-
- T& operator[](size_t idx) { return *(vec_.start_ + idx); }
- const T& operator[](size_t idx) const { return *(vec_.start_ + idx); }
-
- const T* begin() const { return vec_.start_; }
- const T* end() const { return vec_.finish_; }
-
- void push_back(const T& v)
- {
- if (vec_.finish_ != vec_.end_of_storage_) {
- construct(vec_.finish_, v);
- ++vec_.finish_;
- }
- else {
- vector tmp(size() * 2 + 1, *this);
- construct(tmp.vec_.finish_, v);
- ++tmp.vec_.finish_;
- Swap(tmp);
- }
- }
-
- void resize(size_t n, const T& v)
- {
- if (n == size()) return;
-
- if (n < size()) {
- T* first = vec_.start_ + n;
- destroy(first, vec_.finish_);
- vec_.finish_ -= vec_.finish_ - first;
- }
- else {
- vector tmp(n, *this);
- tmp.vec_.finish_ = uninit_fill_n(tmp.vec_.finish_, n - size(), v);
- Swap(tmp);
- }
- }
-
- void reserve(size_t n)
- {
- if (capacity() < n) {
- vector tmp(n, *this);
- Swap(tmp);
- }
- }
-
- void Swap(vector& that)
- {
- vec_.Swap(that.vec_);
- }
-private:
- vector_base<T> vec_;
-
- vector& operator=(const vector&); // hide assign
-
- // for growing, n must be bigger than other size
- vector(size_t n, const vector& other) : vec_(n)
- {
- if (n > other.size())
- vec_.finish_ = uninit_copy(other.vec_.start_, other.vec_.finish_,
- vec_.start_);
- }
-};
-
-
-
-} // namespace mySTL
-
-#endif // mySTL_VECTOR_HPP