|
From: Foster B. <fos...@us...> - 2005-04-02 05:48:32
|
Update of /cvsroot/adobe-source/adobe-source/adobe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17172/adobe Modified Files: array.hpp circular_queue.hpp config.hpp istream.hpp Log Message: asl 1.0.2 Index: array.hpp =================================================================== RCS file: /cvsroot/adobe-source/adobe-source/adobe/array.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** array.hpp 3 Mar 2005 06:58:15 -0000 1.2 --- array.hpp 2 Apr 2005 05:47:33 -0000 1.3 *************** *** 12,15 **** --- 12,25 ---- /*************************************************************************************************/ + // REVISIT (fbrereto) : GCC has a compiler bug when it comes to befriending a function inside + // another namespace. Herb Sutter has written an article about it: + // http://gcc.gnu.org/ml/gcc-prs/2002-10/msg01010.html -- This flag moves + // the array_get/array_set code out of the implementation namespace so it + // can compile under GCC. + + #define ADOBE_NAMESPACE_FRIEND_GCC_BUG 0 + + /*************************************************************************************************/ + #include <cstddef> #include <iterator> *************** *** 53,61 **** */ template <typename T> struct array_get; - /*************************************************************************************************/ - template <class T> array_t& array_set(array_t& object, std::size_t index, const T& value); --- 63,77 ---- */ + /*************************************************************************************************/ + + #if !defined(ADOBE_NO_DOCUMENTATION) + #if ADOBE_NAMESPACE_FRIEND_GCC_BUG + namespace implementation { + #endif + /*************************************************************************************************/ + template <typename T> struct array_get; template <class T> array_t& array_set(array_t& object, std::size_t index, const T& value); *************** *** 64,69 **** array_t& array_push_back(array_t& object, const T& value); ! template <class InputIterator> ! array_t array_ctor(InputIterator first, InputIterator last); /*************************************************************************************************/ --- 80,88 ---- array_t& array_push_back(array_t& object, const T& value); ! /*************************************************************************************************/ ! #if ADOBE_NAMESPACE_FRIEND_GCC_BUG ! } // namespace implementation ! #endif ! #endif /*************************************************************************************************/ *************** *** 74,78 **** class array_t : boost::equality_comparable<array_t> ! { public: #if !defined(ADOBE_NO_DOCUMENTATION) --- 93,97 ---- class array_t : boost::equality_comparable<array_t> ! { public: #if !defined(ADOBE_NO_DOCUMENTATION) *************** *** 91,100 **** typedef std::vector<value_t>::const_iterator const_iterator; ! #if defined(__GNUC__) || defined(BOOST_MSVC) ! // GCC won't compile without this: typedef const_iterator iterator; - // ../../third_party/boost_tp/boost/boost/range/iterator.hpp:37: error: no type - // named `iterator' in `const class adobe::array_t' - #endif #if !defined(ADOBE_NO_DOCUMENTATION) --- 110,119 ---- typedef std::vector<value_t>::const_iterator const_iterator; ! /* ! NOTE (sparent) : All iterators are const - an iterator typedef, however, is needed to meet ! the container requirements. ! */ ! typedef const_iterator iterator; #if !defined(ADOBE_NO_DOCUMENTATION) *************** *** 102,106 **** #endif ! typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // basic methods --- 121,126 ---- #endif ! typedef std::reverse_iterator<const_iterator> const_reverse_iterator; ! typedef const_reverse_iterator reverse_iterator; // basic methods *************** *** 115,126 **** explicit array_t(size_type n, const value_t& item = value_empty()); template <class InputIterator> ! array_t(InputIterator first, InputIterator last) ! { ! while (first != last) ! { ! push_back(value_t(*first++)); ! } ! } // read interface --- 135,145 ---- explicit array_t(size_type n, const value_t& item = value_empty()); + #if 0 + // REVISIT (sparent) : This constructor requires access to implementation - + // so we use a function form (copy) instead. + template <class InputIterator> ! array_t(InputIterator first, InputIterator last); ! #endif // read interface *************** *** 142,149 **** template <class T> array_t& set(size_type index, const T& value) ! { return array_set(*this, index, value); } template <class T> array_t& push_back(const T& value) ! { return array_push_back(*this, value); } class back_insert_iterator : public boost::output_iterator_helper<back_insert_iterator> --- 161,180 ---- template <class T> array_t& set(size_type index, const T& value) ! { ! #if ADOBE_NAMESPACE_FRIEND_GCC_BUG ! return implementation::array_set(*this, index, value); ! #else ! return array_set(*this, index, value); ! #endif ! } template <class T> array_t& push_back(const T& value) ! { ! #if ADOBE_NAMESPACE_FRIEND_GCC_BUG ! return implementation::array_push_back(*this, value); ! #else ! return array_push_back(*this, value); ! #endif ! } class back_insert_iterator : public boost::output_iterator_helper<back_insert_iterator> *************** *** 152,155 **** --- 183,190 ---- typedef value_t value_type; + template <typename T> + back_insert_iterator& operator = (const T& value) + { return operator = (value_type(value)); } + back_insert_iterator& operator = (const value_type& value); private: *************** *** 189,195 **** --- 224,236 ---- #if !defined(ADOBE_NO_DOCUMENTATION) private: + #if ADOBE_NAMESPACE_FRIEND_GCC_BUG + friend struct implementation::array_get<value_t>; + friend array_t& implementation::array_set<>(array_t& object, size_type index, const value_t& value); + friend array_t& implementation::array_push_back<>(array_t& object, const value_t& value); + #else friend struct array_get<value_t>; friend array_t& array_set<>(array_t& object, size_type index, const value_t& value); friend array_t& array_push_back<>(array_t& object, const value_t& value); + #endif friend class write_reference; *************** *** 198,218 **** adobe::copy_on_write<implementation_t> object_m; #endif ! }; /*************************************************************************************************/ class array_t::write_reference ! { public: value_t& operator[] (size_type index); ! protected: friend class array_t; write_reference(array_t& x) : ! fArray(x) { } ! private: ! array_t& fArray; ! }; /*************************************************************************************************/ --- 239,260 ---- adobe::copy_on_write<implementation_t> object_m; #endif ! }; /*************************************************************************************************/ class array_t::write_reference ! { public: value_t& operator[] (size_type index); ! ! private: friend class array_t; write_reference(array_t& x) : ! array_m(x) { } ! ! array_t& array_m; ! }; /*************************************************************************************************/ *************** *** 222,226 **** --- 264,273 ---- /*************************************************************************************************/ + #if ADOBE_NAMESPACE_FRIEND_GCC_BUG + namespace implementation { + #endif + /*************************************************************************************************/ + #if !defined(ADOBE_NO_DOCUMENTATION) template <> struct array_get<value_t> *************** *** 250,277 **** /*************************************************************************************************/ - template <class T> - inline const typename promote<T>::type& array_t::get(size_type index) const - { - return array_get<T>()(*this, index, select<T>()); - } - - template <class T> - inline void array_t::get(size_type index, T& value) const - { - array_get<T>()(*this, index, value); - } - - /*************************************************************************************************/ - - template <class InputIterator> - array_t array_ctor(InputIterator first, InputIterator last) - { - array_t result; - std::copy(first, last, result.back_inserter()); - return result; - } - - /*************************************************************************************************/ - template <> array_t& array_set(array_t&, array_t::size_type, const value_t&); --- 297,300 ---- *************** *** 289,292 **** --- 312,342 ---- array_t& array_push_back(array_t& object, const T& x) { return array_push_back(object, value_t(x)); } + #endif + + /*************************************************************************************************/ + #if ADOBE_NAMESPACE_FRIEND_GCC_BUG + } // namespace implementation + #endif + /*************************************************************************************************/ + + template <class T> + inline const typename promote<T>::type& array_t::get(size_type index) const + { + #if ADOBE_NAMESPACE_FRIEND_GCC_BUG + return implementation::array_get<T>()(*this, index, select<T>()); + #else + return array_get<T>()(*this, index, select<T>()); + #endif + } + + template <class T> + inline void array_t::get(size_type index, T& value) const + { + #if ADOBE_NAMESPACE_FRIEND_GCC_BUG + implementation::array_get<T>()(*this, index, value); + #else + array_get<T>()(*this, index, value); + #endif + } /*************************************************************************************************/ Index: config.hpp =================================================================== RCS file: /cvsroot/adobe-source/adobe-source/adobe/config.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** config.hpp 3 Mar 2005 06:58:15 -0000 1.2 --- config.hpp 2 Apr 2005 05:47:33 -0000 1.3 *************** *** 26,32 **** // ADOBE_VERSION / 100000 is the major version - #define ADOBE_VERSION_SUBMINOR 1 - #define ADOBE_VERSION_MINOR 0 #define ADOBE_VERSION_MAJOR 1 #define ADOBE_VERSION (ADOBE_VERSION_MAJOR * 100000 + ADOBE_VERSION_MINOR * 100 + ADOBE_VERSION_SUBMINOR) --- 26,32 ---- // ADOBE_VERSION / 100000 is the major version #define ADOBE_VERSION_MAJOR 1 + #define ADOBE_VERSION_MINOR 0 + #define ADOBE_VERSION_SUBMINOR 2 #define ADOBE_VERSION (ADOBE_VERSION_MAJOR * 100000 + ADOBE_VERSION_MINOR * 100 + ADOBE_VERSION_SUBMINOR) *************** *** 36,39 **** --- 36,71 ---- /*************************************************************************************************/ + namespace adobe { + + /*************************************************************************************************/ + + namespace implementation { + + /*************************************************************************************************/ + + #if defined(BOOST_MSVC) || defined(__MINGW32__) + + #define ADOBE_PLATFORM_WIN 1 + + #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) + + #define ADOBE_PLATFORM_MAC 1 + + #else + + #error "Your platform is unknown." + + #endif + + /*************************************************************************************************/ + + } // namespace implementation + + /*************************************************************************************************/ + + } // namespace adobe + + /*************************************************************************************************/ + #endif Index: istream.hpp =================================================================== RCS file: /cvsroot/adobe-source/adobe-source/adobe/istream.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** istream.hpp 3 Mar 2005 06:58:15 -0000 1.2 --- istream.hpp 2 Apr 2005 05:47:33 -0000 1.3 *************** *** 68,72 **** std::logic_error(base.what()) { ! adobe::swap(line_position_set_m, base.line_position_set_m); line_position_set_m.push_back(position); } --- 68,72 ---- std::logic_error(base.what()) { ! std::swap(line_position_set_m, base.line_position_set_m); line_position_set_m.push_back(position); } Index: circular_queue.hpp =================================================================== RCS file: /cvsroot/adobe-source/adobe-source/adobe/circular_queue.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** circular_queue.hpp 3 Mar 2005 06:58:15 -0000 1.2 --- circular_queue.hpp 2 Apr 2005 05:47:33 -0000 1.3 *************** *** 87,91 **** #if !defined(ADOBE_NO_DOCUMENTATION) private: ! #ifdef BOOST_MSVC friend void ::swap<T, capacity_k>(adobe::circular_queue<T, Capacity>&, adobe::circular_queue<T, Capacity>&); #else --- 87,91 ---- #if !defined(ADOBE_NO_DOCUMENTATION) private: ! #if (defined BOOST_MSVC) && (_MSC_VER < 1400) friend void ::swap<T, capacity_k>(adobe::circular_queue<T, Capacity>&, adobe::circular_queue<T, Capacity>&); #else |