├── draft ├── Bibliography.pdf └── Dynamic Generic Programming with Virtual Concepts.pdf ├── code ├── poly │ ├── poly │ │ ├── detail │ │ │ ├── cat.hpp │ │ │ ├── config.hpp │ │ │ ├── const.hpp │ │ │ ├── ref_macros.hpp │ │ │ ├── strip.hpp │ │ │ ├── seq.hpp │ │ │ ├── is_plain.hpp │ │ │ ├── signature.hpp │ │ │ ├── forward_like.hpp │ │ │ ├── friends.hpp │ │ │ └── signatures.hpp │ │ ├── self.hpp │ │ ├── bad_cast.hpp │ │ ├── forward.hpp │ │ └── returns.hpp │ ├── test_value_semantics_duck_typing.cpp │ └── test_value_semantics_adaptation.cpp ├── adobe.poly │ └── adobe │ │ ├── test │ │ ├── check_null.hpp │ │ ├── check_regular.hpp │ │ ├── check_container.hpp │ │ ├── check_less_than_comparable.hpp │ │ └── check_traversable.hpp │ │ ├── implementation │ │ ├── metrowerks_mach_o.hpp │ │ ├── xml_lex_fwd.hpp │ │ ├── string_pool.hpp │ │ ├── swap.hpp │ │ ├── lex_stream_fwd.hpp │ │ ├── parser_shared.hpp │ │ ├── xml_token.hpp │ │ ├── has_swap.hpp │ │ ├── atomic_primitives.hpp │ │ ├── lex_stream.hpp │ │ ├── xml_lex.hpp │ │ ├── token.hpp │ │ ├── expression_filter.hpp │ │ └── zuid_uuid.hpp │ │ ├── utility.hpp │ │ ├── select.hpp │ │ ├── config │ │ ├── select_compiler.hpp │ │ └── compiler │ │ │ ├── gcc.hpp │ │ │ └── visualc.hpp │ │ ├── thread_id.hpp │ │ ├── vector_fwd.hpp │ │ ├── cstring.hpp │ │ ├── istream_fwd.hpp │ │ ├── iterator │ │ ├── distance.hpp │ │ ├── type_functions.hpp │ │ ├── set_next.hpp │ │ └── value_iterator.hpp │ │ ├── memory_fwd.hpp │ │ ├── is_range.hpp │ │ ├── container │ │ ├── std_fwd.hpp │ │ └── storage.hpp │ │ ├── any_regular_fwd.hpp │ │ ├── array_fwd.hpp │ │ ├── cstdint.hpp │ │ ├── adam_evaluate.hpp │ │ ├── string_fwd.hpp │ │ ├── array.hpp │ │ ├── algorithm │ │ ├── fill.hpp │ │ ├── exists.hpp │ │ ├── generate.hpp │ │ ├── swap_ranges.hpp │ │ ├── other_of.hpp │ │ ├── median.hpp │ │ ├── equal.hpp │ │ ├── random_shuffle.hpp │ │ ├── identity_element.hpp │ │ ├── clamp.hpp │ │ ├── iota.hpp │ │ ├── for_each.hpp │ │ ├── rotate.hpp │ │ ├── merge.hpp │ │ ├── partition.hpp │ │ ├── lexicographical_compare.hpp │ │ ├── count.hpp │ │ ├── for_each_position.hpp │ │ ├── pin.hpp │ │ └── permutation.hpp │ │ ├── iomanip_fwd.hpp │ │ ├── dictionary_fwd.hpp │ │ ├── localization.hpp │ │ ├── utility │ │ └── ignore_unused.hpp │ │ ├── final.hpp │ │ ├── eve_evaluate.hpp │ │ ├── closed_hash_fwd.hpp │ │ ├── external_model.hpp │ │ ├── iomanip_pdf.hpp │ │ ├── iomanip_xml.hpp │ │ ├── iomanip_javascript.hpp │ │ ├── functional │ │ └── is_member.hpp │ │ ├── sheet.hpp │ │ ├── regular_concept.hpp │ │ ├── dictionary.hpp │ │ ├── counter.hpp │ │ ├── name_fwd.hpp │ │ ├── iomanip_asl_cel.hpp │ │ ├── virtual_machine.hpp │ │ ├── poly_copyable.hpp │ │ ├── conversion.hpp │ │ ├── config.hpp │ │ └── empty.hpp └── boost.typeerasure │ ├── test_reference_semantics_duck_typing.cpp │ └── test_value_semantics_duck_typing.cpp ├── README.md └── LICENSE /draft/Bibliography.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyprowl/virtual-concepts/HEAD/draft/Bibliography.pdf -------------------------------------------------------------------------------- /draft/Dynamic Generic Programming with Virtual Concepts.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andyprowl/virtual-concepts/HEAD/draft/Dynamic Generic Programming with Virtual Concepts.pdf -------------------------------------------------------------------------------- /code/poly/poly/detail/cat.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_DETAIL_CAT_HPP_Q6I4FLX 7 | #define POLY_DETAIL_CAT_HPP_Q6I4FLX 8 | 9 | // Standard PP concatenation formula. 10 | #define POLY_DETAIL_CAT_0(x, y) x ## y 11 | #define POLY_DETAIL_CAT(x, y) POLY_DETAIL_CAT_0(x,y) 12 | 13 | #endif // POLY_DETAIL_CAT_HPP_Q6I4FLX 14 | -------------------------------------------------------------------------------- /code/poly/poly/detail/config.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_DETAIL_CONFIG_HPP_0GP7OI1 7 | #define POLY_DETAIL_CONFIG_HPP_0GP7OI1 8 | 9 | #if defined(__GNUC__) && !defined(__clang__) 10 | #define POLY_NO_MULTIPLE_INHERITANCE 11 | #define POLY_NO_REF_QUALIFIERS 12 | #endif 13 | 14 | #endif // POLY_DETAIL_CONFIG_HPP_0GP7OI1 15 | -------------------------------------------------------------------------------- /code/poly/poly/detail/const.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_DETAIL_CONST_HPP_HWFFT6H 7 | #define POLY_DETAIL_CONST_HPP_HWFFT6H 8 | 9 | namespace poly { 10 | namespace detail { 11 | 12 | template T const & const_(T & t) noexcept { return t; } 13 | 14 | } // detail 15 | } // poly 16 | 17 | #endif // POLY_DETAIL_CONST_HPP_HWFFT6H 18 | -------------------------------------------------------------------------------- /code/poly/poly/detail/ref_macros.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_DETAIL_REF_MACROS_HPP_C045URO 7 | #define POLY_DETAIL_REF_MACROS_HPP_C045URO 8 | 9 | #include 10 | 11 | #ifndef POLY_NO_REF_QUALIFIERS 12 | #define POLY_DETAIL_LREF & 13 | #define POLY_DETAIL_RREF && 14 | #else 15 | #define POLY_DETAIL_LREF 16 | #define POLY_DETAIL_RREF 17 | #endif 18 | 19 | #endif // POLY_DETAIL_REF_MACROS_HPP_C045URO 20 | -------------------------------------------------------------------------------- /code/poly/poly/detail/strip.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_DETAIL_STRIP_HPP_LLIN843 7 | #define POLY_DETAIL_STRIP_HPP_LLIN843 8 | 9 | namespace poly { 10 | namespace detail { 11 | 12 | template struct strip { typedef T type; }; 13 | template struct strip : strip {}; 14 | template struct strip : strip {}; 15 | template struct strip : strip {}; 16 | 17 | } // detail 18 | } // poly 19 | 20 | #endif // POLY_DETAIL_STRIP_HPP_LLIN843 21 | -------------------------------------------------------------------------------- /code/poly/poly/detail/seq.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_DETAIL_SEQ_HPP_XLJV79Q 7 | #define POLY_DETAIL_SEQ_HPP_XLJV79Q 8 | 9 | namespace poly { 10 | namespace detail { 11 | 12 | // --- seq, head::type ---------------------------------------------- 13 | 14 | template struct seq {}; 15 | 16 | template struct head { typedef void type; }; 17 | template 18 | struct head> { typedef H type; }; 19 | 20 | } // detail 21 | } // poly 22 | 23 | #endif // POLY_DETAIL_SEQ_HPP_XLJV79Q 24 | -------------------------------------------------------------------------------- /code/poly/poly/self.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_SELF_HPP_GP085EJ 7 | #define POLY_SELF_HPP_GP085EJ 8 | 9 | /// Header 10 | /// ====================== 11 | /// 12 | /// Struct `poly::self` 13 | /// ------------------- 14 | /// 15 | /// Placeholder type for `*this` in interface signatures. Combine with `&`, 16 | /// `const &`, or `&&` as needed. (A plain `self` in the signature always 17 | /// creates a copy of the respective argument.) 18 | /// 19 | /// **See also.** `poly::interface` 20 | 21 | #include 22 | 23 | #endif // POLY_SELF_HPP_GP085EJ 24 | -------------------------------------------------------------------------------- /code/poly/poly/detail/is_plain.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_DETAIL_IS_PLAIN_HPP_C59CAS1 7 | #define POLY_DETAIL_IS_PLAIN_HPP_C59CAS1 8 | 9 | #include 10 | 11 | namespace poly { 12 | namespace detail { 13 | 14 | template struct is_plain : std::true_type {}; 15 | template struct is_plain : std::false_type {}; 16 | template struct is_plain : std::false_type {}; 17 | template struct is_plain : std::false_type {}; 18 | 19 | } // detail 20 | } // poly 21 | 22 | #endif // POLY_DETAIL_IS_PLAIN_HPP_C59CAS1 23 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/test/check_null.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #include 10 | #include 11 | 12 | namespace adobe { 13 | /*! 14 | \addtogroup testing 15 | @{ 16 | */ 17 | 18 | template 19 | void check_null(const T& x) 20 | { 21 | T t = T(); 22 | if(t) 23 | BOOST_ERROR("operator bool"); 24 | BOOST_CHECK_MESSAGE(!t, "operator!"); 25 | 26 | BOOST_CHECK_MESSAGE(x, "operator!"); 27 | if(!x) 28 | BOOST_ERROR("operator bool"); 29 | 30 | } 31 | //! @} 32 | } 33 | 34 | -------------------------------------------------------------------------------- /code/poly/poly/bad_cast.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_BAD_INTERFACE_CAST_HPP_K4SVF0Q 7 | #define POLY_BAD_INTERFACE_CAST_HPP_K4SVF0Q 8 | 9 | /// Header 10 | /// ==================================== 11 | /// 12 | /// The `poly::bad_cast` exception. 13 | /// 14 | /// 15 | /// Class `poly::bad_cast` 16 | /// -------------------------------- 17 | /// 18 | /// Thrown when `poly::cast(x)` fails for a non-pointer `x`. Inherits 19 | /// `std::bad_cast`. 20 | 21 | #include 22 | 23 | namespace poly { 24 | 25 | struct bad_cast : std::bad_cast { 26 | virtual char const * what() const noexcept override { 27 | return "bad_cast"; 28 | } 29 | }; 30 | 31 | } // poly 32 | 33 | #endif // POLY_BAD_INTERFACE_CAST_HPP_K4SVF0Q 34 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/metrowerks_mach_o.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #include 10 | 11 | /* 12 | These are the switches required to build using the MSL C header for a Mach-O target. 13 | */ 14 | 15 | #pragma c99 on 16 | #define _MSL_USING_MW_C_HEADERS 1 17 | 18 | /* 19 | 20 | These defines allow to build 21 | 22 | */ 23 | 24 | #ifndef __NOEXTENSIONS__ 25 | #define __NOEXTENSIONS__ 26 | #endif 27 | #ifndef __CF_USE_FRAMEWORK_INCLUDES__ 28 | #define __CF_USE_FRAMEWORK_INCLUDES__ 29 | #endif 30 | 31 | 32 | /*************************************************************************************************/ 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Dynamic Generic Programming with Virtual Concepts 2 | ================ 3 | 4 | This is a research project aimed at introducing _language support for type erasure in C++_. 5 | 6 | The `draft` folder currently contains a version of what is meant to become a proposal for standardization - or a larger document to be referred from such a proposal. The `code` folder contains examples included in (or referenced from) the draft. 7 | 8 | The draft currently contains: 9 | 10 | * A brief introduction and motivation; 11 | * A section that provides an overview of the existing solutions for Dynamic Generic Programming (DGP) in C++; 12 | * A section stating the design goals for this project; 13 | * A section demonstrating some practical applications of virtual concepts. 14 | 15 | The bibliography is available in a separate file inside the `draft` folder. 16 | 17 | There is a [dedicated thread on std-proposals](https://groups.google.com/a/isocpp.org/d/msg/std-proposals/4gEt2OBbSQM/dFr3Go95iZgJ) for discussion. Any feedback is most welcome. 18 | 19 | Andy 20 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/utility.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_UTILITY_HPP 10 | #define ADOBE_UTILITY_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | /*************************************************************************************************/ 20 | 21 | /*! 22 | \defgroup utility Utility 23 | \ingroup asl_libraries 24 | 25 | */ 26 | 27 | /*************************************************************************************************/ 28 | // ADOBE_UTILITY_HPP 29 | #endif 30 | 31 | /*************************************************************************************************/ 32 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/select.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_SELECT_HPP 10 | #define ADOBE_SELECT_HPP 11 | 12 | #include 13 | 14 | /*************************************************************************************************/ 15 | 16 | namespace adobe { 17 | 18 | /*************************************************************************************************/ 19 | 20 | template struct select { }; 21 | 22 | /*************************************************************************************************/ 23 | 24 | } // namespace adobe 25 | 26 | /*************************************************************************************************/ 27 | 28 | #endif 29 | 30 | /*************************************************************************************************/ 31 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/config/select_compiler.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_CONFIG_SELECT_COMPILER_HPP 10 | #define ADOBE_CONFIG_SELECT_COMPILER_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #if defined __GNUC__ 15 | // GNU C++: (including Darwin) 16 | #include 17 | 18 | #elif defined _MSC_VER 19 | // Must remain the last #elif since some other vendors (Metrowerks, for 20 | // example) also #define _MSC_VER 21 | #include 22 | 23 | #endif 24 | 25 | /*************************************************************************************************/ 26 | 27 | #endif 28 | 29 | /*************************************************************************************************/ 30 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/thread_id.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_THREAD_ID_HPP 10 | #define ADOBE_THREAD_ID_HPP 11 | 12 | #include 13 | 14 | /*************************************************************************************************/ 15 | 16 | namespace adobe { 17 | 18 | /*************************************************************************************************/ 19 | 20 | typedef const struct thread_id_opaque_t* thread_id_t; 21 | 22 | thread_id_t thread_id(); 23 | 24 | /*************************************************************************************************/ 25 | 26 | } // namespace adobe 27 | 28 | /*************************************************************************************************/ 29 | 30 | #endif 31 | 32 | /*************************************************************************************************/ 33 | -------------------------------------------------------------------------------- /code/poly/poly/forward.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_FORWARD_HPP_S2NYKAD 7 | #define POLY_FORWARD_HPP_S2NYKAD 8 | 9 | /// Header 10 | /// ========================= 11 | /// 12 | /// `poly::forward(t)` with `constexpr` support. 13 | /// 14 | /// 15 | /// Function template `poly::forward(t)` 16 | /// --------------------------------------- 17 | /// 18 | /// Reimplementation of `std::forward(t)` from the C++11 standard, with 19 | /// added `constexpr` support. 20 | 21 | #include 22 | 23 | namespace poly { 24 | 25 | template 26 | inline constexpr T && 27 | forward(typename std::remove_reference::type & t) noexcept { 28 | return static_cast(t); 29 | } 30 | template 31 | inline constexpr T && 32 | forward(typename std::remove_reference::type && t) noexcept { 33 | static_assert(!std::is_lvalue_reference::value, ""); 34 | return static_cast(t); 35 | } 36 | 37 | } // poly 38 | 39 | #endif // POLY_FORWARD_HPP_S2NYKAD 40 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/test/check_regular.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace adobe { 14 | /*! 15 | \addtogroup testing 16 | @{ 17 | */ 18 | 19 | template 20 | T arbitrary_regular_value(); 21 | 22 | 23 | template 24 | void check_regular(const T& x) 25 | { 26 | using std::swap; 27 | 28 | BOOST_CHECK(x != T()); 29 | T y = x; 30 | BOOST_CHECK_MESSAGE(x == y, "copy-ctor"); 31 | T z = T(); 32 | BOOST_CHECK_MESSAGE(z != x, "default-ctor"); 33 | z = y; 34 | BOOST_CHECK_MESSAGE(x == z, "assignment"); 35 | T w = T(); 36 | swap(y, w); 37 | BOOST_CHECK(x == w && x != y && y == T()); 38 | } 39 | 40 | 41 | BOOST_TEST_CASE_TEMPLATE_FUNCTION(check_regulars, T) 42 | { 43 | check_regular(arbitrary_regular_value()); 44 | } 45 | 46 | } 47 | 48 | //! @} 49 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/config/compiler/gcc.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_CONFIG_COMPILER_GCC_HPP 10 | #define ADOBE_CONFIG_COMPILER_GCC_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #ifndef ADOBE_CONFIG_HPP 15 | #error "This file is intended to be included by -- please use that file directly." 16 | #endif 17 | 18 | /*************************************************************************************************/ 19 | 20 | #ifndef ADOBE_COMPILER_GCC 21 | #define ADOBE_COMPILER_GCC 1 22 | #endif 23 | 24 | /*************************************************************************************************/ 25 | 26 | // test exceptions here 27 | 28 | /*************************************************************************************************/ 29 | 30 | #endif 31 | 32 | /*************************************************************************************************/ 33 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/xml_lex_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_XML_LEX_FWD_HPP 10 | #define ADOBE_XML_LEX_FWD_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | 18 | /*************************************************************************************************/ 19 | 20 | namespace adobe { 21 | 22 | /*************************************************************************************************/ 23 | 24 | class xml_lex_t; 25 | 26 | /*************************************************************************************************/ 27 | 28 | } // namespace adobe 29 | 30 | /*************************************************************************************************/ 31 | 32 | #endif 33 | 34 | /*************************************************************************************************/ 35 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/vector_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_VECTOR_FWD_HPP 10 | #define ADOBE_VECTOR_FWD_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | #include 16 | 17 | /*************************************************************************************************/ 18 | 19 | namespace adobe { 20 | namespace version_1 { 21 | 22 | /*************************************************************************************************/ 23 | 24 | template > class vector; 25 | 26 | /*************************************************************************************************/ 27 | 28 | } // namespace version_1 29 | 30 | using version_1::vector; 31 | 32 | } // namespace adobe 33 | 34 | #endif 35 | 36 | /*************************************************************************************************/ 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | 26 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/cstring.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_CSTRING_HPP 10 | #define ADOBE_CSTRING_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | /*************************************************************************************************/ 17 | 18 | namespace adobe { 19 | 20 | /*************************************************************************************************/ 21 | 22 | inline int strcmp(const char* x, const char* y) 23 | { 24 | while (*x && *x == *y) { ++x; ++y; } 25 | return *x - *y; 26 | } 27 | 28 | /*************************************************************************************************/ 29 | 30 | } // namespace adobe 31 | 32 | /*************************************************************************************************/ 33 | 34 | #endif 35 | 36 | /*************************************************************************************************/ 37 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/istream_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ISTREAM_FWD_HPP 10 | #define ADOBE_ISTREAM_FWD_HPP 11 | 12 | #include 13 | 14 | #include 15 | 16 | /*************************************************************************************************/ 17 | 18 | namespace adobe { 19 | 20 | /*************************************************************************************************/ 21 | 22 | struct line_position_t; 23 | 24 | class stream_error_t; 25 | 26 | std::string format_stream_error(std::istream&, const stream_error_t&); 27 | 28 | std::string format_stream_error(const stream_error_t&); 29 | 30 | /*************************************************************************************************/ 31 | 32 | } // namespace adobe 33 | 34 | /*************************************************************************************************/ 35 | 36 | #endif // ADOBE_ISTREAM_FWD_HPP 37 | 38 | /*************************************************************************************************/ 39 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/iterator/distance.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ITERATOR_DISTANCE_HPP 10 | #define ADOBE_ITERATOR_DISTANCE_HPP 11 | 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | /*************************************************************************************************/ 19 | 20 | namespace adobe { 21 | 22 | /*************************************************************************************************/ 23 | 24 | /*! 25 | \ingroup adobe_iterator 26 | */ 27 | 28 | template // I models InputRange 29 | inline boost::difference_type::type distance(I& range) 30 | { return std::distance(boost::begin(range), boost::end(range)); } 31 | 32 | /*************************************************************************************************/ 33 | 34 | } // namespace adobe 35 | 36 | /*************************************************************************************************/ 37 | 38 | #endif 39 | // ADOBE_ITERATOR_DISTANCE_HPP 40 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/memory_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2008 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_MEMORY_FWD_HPP 10 | #define ADOBE_MEMORY_FWD_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | /*************************************************************************************************/ 17 | 18 | namespace adobe { 19 | namespace version_1 { 20 | 21 | /*************************************************************************************************/ 22 | 23 | template class capture_allocator; 24 | 25 | /*************************************************************************************************/ 26 | 27 | } // namespace version_1 28 | 29 | using version_1::capture_allocator; 30 | 31 | } // namespace adobe 32 | 33 | /*************************************************************************************************/ 34 | 35 | #endif 36 | 37 | /*************************************************************************************************/ 38 | -------------------------------------------------------------------------------- /code/poly/poly/detail/signature.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_DETAIL_SIGNATURE_HPP_NUZPJW3 7 | #define POLY_DETAIL_SIGNATURE_HPP_NUZPJW3 8 | 9 | #include 10 | #include 11 | 12 | namespace poly { 13 | namespace detail { 14 | 15 | template ::type> 16 | struct signature; 17 | 18 | template 19 | struct signature { 20 | virtual R operator()(F, A...) POLY_DETAIL_RREF = 0; 21 | }; 22 | 23 | template 24 | struct signature { 25 | virtual R operator()(F, A...) POLY_DETAIL_RREF = 0; 26 | }; 27 | 28 | template 29 | struct signature { 30 | virtual R operator()(F, A...) POLY_DETAIL_LREF = 0; 31 | }; 32 | 33 | template 34 | struct signature { 35 | virtual R operator()(F, A...) const POLY_DETAIL_LREF = 0; 36 | }; 37 | 38 | } // detail 39 | } // poly 40 | 41 | #endif // POLY_DETAIL_SIGNATURE_HPP_NUZPJW3 42 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/test/check_container.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #include 10 | 11 | #include 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace adobe { 20 | /*! 21 | \defgroup testing Misc utilities (Testing, Timer, ignore_unused,...) 22 | \ingroup utility 23 | @{ 24 | */ 25 | 26 | template 27 | void check_container(const T& c) 28 | { 29 | adobe::check_traversable(c); 30 | 31 | // Containers add the requirement that each element visited once to traversable 32 | BOOST_CHECK_MESSAGE(c.size() == std::distance(c.begin(), c.end()), "container size"); 33 | BOOST_CHECK_MESSAGE(d.size() == std::distance(d.begin(), d.end()), "container size"); 34 | } 35 | 36 | #if 0 37 | //gcc always instantiates this 38 | BOOST_TEST_CASE_TEMPLATE_FUNCTION(check_containers, T) 39 | { 40 | check_container(arbitrary_container_value()); 41 | } 42 | #endif 43 | 44 | //!@} 45 | } 46 | 47 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/is_range.hpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * 3 | * ADOBE CONFIDENTIAL 4 | * ___________________ 5 | * 6 | * Copyright 2008 Adobe Systems Incorporated 7 | * All Rights Reserved. 8 | * 9 | * NOTICE: All information contained herein is, and remains 10 | * the property of Adobe Systems Incorporated and its suppliers, 11 | * if any. The intellectual and technical concepts contained 12 | * herein are proprietary to Adobe Systems Incorporated and its 13 | * suppliers and may be covered by U.S. and Foreign Patents, 14 | * patents in process, and are protected by trade secret or copyright law. 15 | * Dissemination of this information or reproduction of this material 16 | * is strictly forbidden unless prior written permission is obtained 17 | * from Adobe Systems Incorporated. 18 | **************************************************************************/ 19 | 20 | #ifndef ADOBE_IS_RANGE_HPP 21 | #define ADOBE_IS_RANGE_HPP 22 | 23 | #include 24 | 25 | namespace adobe 26 | { 27 | 28 | /*! 29 | \ingroup inspection 30 | 31 | \brief does T model the boost::range concepts? 32 | */ 33 | template 34 | struct is_range 35 | { 36 | static const bool value = has_type_type >::value; 37 | }; 38 | 39 | } 40 | 41 | #endif // include guard 42 | 43 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/test/check_less_than_comparable.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | 14 | namespace adobe { 15 | 16 | /*! 17 | \addtogroup testing 18 | @{ 19 | */ 20 | 21 | template 22 | void check_transitive(const T& x, const T& y, const T& z, Op op) 23 | { 24 | ignore_unused(y); 25 | assert(op(x,y) && op(y,z)); 26 | BOOST_CHECK_MESSAGE(op(x,z), "tranisitive"); 27 | } 28 | 29 | template 30 | void check_irreflexive(const T& x, Op op) 31 | { 32 | BOOST_CHECK_MESSAGE(!op(x,x), "irreflexive"); 33 | } 34 | 35 | template 36 | void check_antisymmetric(const T& x, const T& y, Op op) 37 | { 38 | BOOST_CHECK_MESSAGE(!(op(x,y) && op(y,x)), "anti-symmetric"); 39 | } 40 | 41 | 42 | template 43 | void check_less_than_comparable(const T& x, const T& y, const T& z, Op op) 44 | { 45 | check_irreflexive(x, op); 46 | check_antisymmetric(x, y, op); 47 | check_transitive(x, y, z, op); 48 | } 49 | 50 | //!@} 51 | } 52 | 53 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/container/std_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2008 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_STD_FWD_HPP 10 | #define ADOBE_STD_FWD_HPP 11 | 12 | #include 13 | 14 | /*************************************************************************************************/ 15 | 16 | #if BOOST_WORKAROUND(__GNUC__, >= 3) && defined(_GLIBCXX_DEBUG) 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #else 25 | 26 | namespace std { 27 | 28 | template class vector; 29 | template class deque; 30 | template class list; 31 | template class set; 32 | template class multiset; 33 | template class map; 34 | template class multimap; 35 | 36 | } // namespace std 37 | 38 | #endif 39 | 40 | /*************************************************************************************************/ 41 | 42 | #endif 43 | 44 | /*************************************************************************************************/ 45 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/any_regular_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_VALUE_FWD_HPP 10 | #define ADOBE_VALUE_FWD_HPP 11 | 12 | #include 13 | 14 | /*************************************************************************************************/ 15 | 16 | namespace adobe { 17 | 18 | namespace version_1 { 19 | 20 | /*************************************************************************************************/ 21 | 22 | class any_regular_t; 23 | 24 | /*************************************************************************************************/ 25 | 26 | } // namespace version_1 27 | 28 | using version_1::any_regular_t; 29 | 30 | #if defined(ADOBE_NO_DOCUMENTATION) 31 | /* REVISIT (mmarcus) : doxygen doesn't seem to understand using 32 | declarartions. This is a doxygen only hack to keep reference links 33 | from breaking. 34 | */ 35 | //!\ingroup abi_container 36 | typedef version_1::any_regular_t any_regular_t; 37 | #endif 38 | 39 | } // namespace adobe 40 | 41 | /*************************************************************************************************/ 42 | 43 | #endif 44 | 45 | /*************************************************************************************************/ 46 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/array_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2008 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ARRAY_FWD_HPP 10 | #define ADOBE_ARRAY_FWD_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | /*************************************************************************************************/ 18 | 19 | namespace adobe { 20 | namespace version_1 { 21 | 22 | /*************************************************************************************************/ 23 | 24 | //!\ingroup abi_container 25 | typedef vector array_t; 26 | 27 | /*************************************************************************************************/ 28 | 29 | } // namespace version_1 30 | 31 | using version_1::array_t; 32 | 33 | #if defined(ADOBE_NO_DOCUMENTATION) 34 | /* REVISIT (mmarcus) : doxygen doesn't seem to understand using 35 | declarartions. This is a doxygen only hack to make the typedef appear 36 | in the documentation 37 | */ 38 | //!\ingroup abi_container 39 | typedef version_1::vector array_t; 40 | #endif 41 | 42 | } // namespace adobe 43 | 44 | /*************************************************************************************************/ 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/cstdint.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_CSTDINT_HPP 10 | #define ADOBE_CSTDINT_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | #if BOOST_MSVC 18 | #include 19 | #endif 20 | 21 | /*************************************************************************************************/ 22 | 23 | namespace adobe { 24 | 25 | /*! 26 | \defgroup tr1 TR1 Components 27 | \ingroup utility 28 | @{ 29 | */ 30 | 31 | /*************************************************************************************************/ 32 | 33 | #if defined(BOOST_HAS_STDINT_H) || defined(BOOST_MSVC) 34 | 35 | using ::intptr_t; 36 | using ::uintptr_t; 37 | 38 | #else 39 | 40 | typedef long intptr_t; 41 | typedef unsigned long uintptr_t; 42 | 43 | #endif 44 | 45 | BOOST_STATIC_ASSERT(!(sizeof(intptr_t) < sizeof(void*))); 46 | BOOST_STATIC_ASSERT(!(sizeof(uintptr_t) < sizeof(void*))); 47 | 48 | //! @} 49 | /*************************************************************************************************/ 50 | } // namespace adobe 51 | 52 | /*************************************************************************************************/ 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/adam_evaluate.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ADAM_EVALUATE_HPP 10 | #define ADOBE_ADAM_EVALUATE_HPP 11 | 12 | #include 13 | 14 | #include // REVISIT (sparent) : need an adam_fwd.hpp 15 | #include 16 | #include 17 | 18 | /*************************************************************************************************/ 19 | 20 | namespace adobe { 21 | 22 | /*! 23 | \defgroup property_model_evaluate Property Model Evaluate 24 | \ingroup property_model 25 | */ 26 | /*************************************************************************************************/ 27 | 28 | /*! 29 | \ingroup property_model_evaluate 30 | */ 31 | adam_callback_suite_t bind_to_sheet(sheet_t&); 32 | adam_callback_suite_t bind_to_sheet(sheet_t&, external_model_t&); 33 | 34 | /*************************************************************************************************/ 35 | 36 | } // namespace adobe 37 | 38 | /*************************************************************************************************/ 39 | 40 | #endif // ADOBE_ADAM_EVALUATE_HPP 41 | 42 | /*************************************************************************************************/ 43 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/string_pool.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_STRING_POOL_HPP 10 | #define ADOBE_STRING_POOL_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | 18 | /*************************************************************************************************/ 19 | 20 | namespace adobe { 21 | 22 | /**************************************************************************************************/ 23 | 24 | class unique_string_pool_t : boost::noncopyable 25 | { 26 | public: 27 | unique_string_pool_t(); 28 | 29 | ~unique_string_pool_t(); 30 | 31 | const char* add(const char* str); 32 | 33 | private: 34 | struct implementation_t; 35 | 36 | implementation_t* object_m; 37 | }; 38 | 39 | 40 | /**************************************************************************************************/ 41 | 42 | } // namespace adobe 43 | 44 | /**************************************************************************************************/ 45 | 46 | #endif 47 | 48 | /**************************************************************************************************/ 49 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/string_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_STRING_FWD_HPP 10 | #define ADOBE_STRING_FWD_HPP 11 | 12 | #ifdef ADOBE_STD_SERIALIZATION 13 | #include 14 | #endif 15 | 16 | /*************************************************************************************************/ 17 | 18 | namespace adobe { 19 | namespace version_1 { 20 | 21 | /*************************************************************************************************/ 22 | 23 | class string_t; 24 | class string16_t; 25 | 26 | /*************************************************************************************************/ 27 | 28 | } // namespace version_1 29 | 30 | /*************************************************************************************************/ 31 | 32 | using version_1::string_t; 33 | using version_1::string16_t; 34 | 35 | /*************************************************************************************************/ 36 | 37 | 38 | /*************************************************************************************************/ 39 | 40 | } // namespace adobe 41 | 42 | /*************************************************************************************************/ 43 | 44 | #endif 45 | 46 | /*************************************************************************************************/ 47 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/array.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /**************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ARRAY_HPP 10 | #define ADOBE_ARRAY_HPP 11 | 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | /**************************************************************************************************/ 21 | 22 | namespace adobe { 23 | namespace version_1 { 24 | 25 | /**************************************************************************************************/ 26 | 27 | template // T models Regular 28 | inline void push_back(array_t& v, T x) 29 | { v.push_back(any_regular_t(adobe::move(x))); } 30 | 31 | inline void push_back(array_t& v, any_regular_t x) 32 | { v.push_back(adobe::move(x)); } 33 | 34 | /**************************************************************************************************/ 35 | 36 | } // namespace version_1 37 | 38 | using version_1::push_back; 39 | 40 | } // namespace adobe 41 | 42 | /**************************************************************************************************/ 43 | 44 | ADOBE_SHORT_NAME_TYPE('a','r','r','y', adobe::array_t) 45 | 46 | /**************************************************************************************************/ 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /code/poly/poly/detail/forward_like.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_DETAIL_FORWARD_LIKE_HPP_7AF5HLG 7 | #define POLY_DETAIL_FORWARD_LIKE_HPP_7AF5HLG 8 | 9 | namespace poly { 10 | namespace detail { 11 | 12 | // --- fwd::type --------------------------------------------------------- 13 | 14 | template struct fwd { typedef U type; }; 15 | template struct fwd : fwd {}; 16 | template struct fwd : fwd {}; 17 | template struct fwd : fwd {}; 18 | template struct fwd { typedef U & type; }; 19 | template struct fwd { typedef U & type; }; 20 | template struct fwd { 21 | typedef U const & type; 22 | }; 23 | template struct fwd { 24 | typedef U const & type; 25 | }; 26 | template struct fwd { 27 | typedef U const & type; 28 | }; 29 | 30 | // --- forward_like(u) ------------------------------------------------------ 31 | 32 | template 33 | typename fwd::type && forward_like(U && u) noexcept { 34 | return static_cast::type &&>(u); 35 | } 36 | 37 | } // detail 38 | } // poly 39 | 40 | #endif // POLY_DETAIL_FORWARD_LIKE_HPP_7AF5HLG 41 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/fill.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_FILL_HPP 10 | #define ADOBE_ALGORITHM_FILL_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | /*************************************************************************************************/ 20 | 21 | namespace adobe { 22 | 23 | /*************************************************************************************************/ 24 | /*! 25 | \defgroup fill fill 26 | \ingroup mutating_algorithm 27 | 28 | \see 29 | - STL documentation for \ref stldoc_fill 30 | */ 31 | /*************************************************************************************************/ 32 | /*! 33 | \ingroup fill 34 | 35 | \brief fill implementation 36 | */ 37 | template 38 | inline void fill(ForwardRange& range, const T& value) 39 | { 40 | std::fill(boost::begin(range), boost::end(range), value); 41 | } 42 | 43 | /*************************************************************************************************/ 44 | 45 | } // namespace adobe 46 | 47 | /*************************************************************************************************/ 48 | 49 | #endif 50 | 51 | /*************************************************************************************************/ 52 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/exists.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_EXISTS_HPP 10 | #define ADOBE_ALGORITHM_EXISTS_HPP 11 | 12 | #include 13 | 14 | #include 15 | 16 | /*************************************************************************************************/ 17 | 18 | namespace adobe { 19 | 20 | /*************************************************************************************************/ 21 | /*! 22 | \defgroup exists exists 23 | \ingroup container_algorithm 24 | */ 25 | /*************************************************************************************************/ 26 | /*! 27 | \ingroup exists 28 | 29 | \todo (sparent) : If we developed the idea of an associative range then we could generalize this 30 | to sorted vectors. This would then consume std::binary_search(). 31 | */ 32 | 33 | template // C models AssociativeContainer 34 | bool exists(const C& c, const typename C::key_type& k) 35 | { return c.find(k) != c.end(); } 36 | 37 | /*************************************************************************************************/ 38 | 39 | } // namespace adobe 40 | 41 | /*************************************************************************************************/ 42 | 43 | #endif 44 | 45 | /*************************************************************************************************/ 46 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/iomanip_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifdef ADOBE_STD_SERIALIZATION 10 | 11 | /*************************************************************************************************/ 12 | 13 | #ifndef ADOBE_IOMANIP_FWD_HPP 14 | #define ADOBE_IOMANIP_FWD_HPP 15 | 16 | /*************************************************************************************************/ 17 | 18 | #include 19 | 20 | #include 21 | 22 | /*************************************************************************************************/ 23 | 24 | namespace adobe { 25 | 26 | /*************************************************************************************************/ 27 | 28 | class format_base; 29 | 30 | /*************************************************************************************************/ 31 | 32 | int format_base_idx(); 33 | 34 | format_base* get_formatter(std::ostream& os); 35 | 36 | /*************************************************************************************************/ 37 | 38 | } // namespace adobe 39 | 40 | /*************************************************************************************************/ 41 | 42 | #endif 43 | 44 | /*************************************************************************************************/ 45 | 46 | #endif 47 | 48 | /*************************************************************************************************/ 49 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/generate.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_GENERATE_HPP 10 | #define ADOBE_ALGORITHM_GENERATE_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | /*************************************************************************************************/ 20 | 21 | namespace adobe { 22 | 23 | /*************************************************************************************************/ 24 | /*! 25 | \defgroup generate generate 26 | \ingroup mutating_algorithm 27 | 28 | \see 29 | - STL documentation for \ref stldoc_generate 30 | */ 31 | /*************************************************************************************************/ 32 | /*! 33 | \ingroup generate 34 | 35 | \brief generate implementation 36 | */ 37 | template 38 | inline void generate(ForwardRange& range, Generator gen) 39 | { 40 | std::generate(boost::begin(range), boost::end(range), gen); 41 | } 42 | 43 | /*************************************************************************************************/ 44 | 45 | } // namespace adobe 46 | 47 | /*************************************************************************************************/ 48 | 49 | #endif 50 | 51 | /*************************************************************************************************/ 52 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/dictionary_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_DICTIONARY_FWD_HPP 10 | #define ADOBE_DICTIONARY_FWD_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | /*************************************************************************************************/ 21 | 22 | namespace adobe { 23 | namespace version_1 { 24 | 25 | /*************************************************************************************************/ 26 | 27 | //!\ingroup abi_container 28 | typedef closed_hash_map dictionary_t; 29 | 30 | /*************************************************************************************************/ 31 | 32 | } // namespace version_1 33 | 34 | using version_1::dictionary_t; 35 | 36 | #if defined(ADOBE_NO_DOCUMENTATION) 37 | /* REVISIT (mmarcus) : doxygen doesn't seem to understand using 38 | declarartions. This is a doxygen only hack to keep reference links 39 | from breaking. 40 | */ 41 | //!\ingroup abi_container 42 | typedef version1::closed_hash_map dictionary_t; 43 | #endif 44 | 45 | } // namespace adobe 46 | 47 | /*************************************************************************************************/ 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/localization.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_LOCALIZATION_HPP 10 | #define ADOBE_LOCALIZATION_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | 18 | /*************************************************************************************************/ 19 | 20 | namespace adobe { 21 | 22 | /*************************************************************************************************/ 23 | 24 | /*! 25 | \defgroup localization localization 26 | \ingroup parsing 27 | @{ 28 | */ 29 | 30 | /*! 31 | The proc used here can expect utf-8 coming in and should output utf-8 encoded text in kind. 32 | */ 33 | 34 | typedef boost::function localization_lookup_proc_t; 35 | 36 | void localization_register(const localization_lookup_proc_t& proc); 37 | 38 | std::string localization_invoke(const std::string& source); 39 | 40 | bool localization_ready(); 41 | 42 | //! @} 43 | 44 | /*************************************************************************************************/ 45 | 46 | } // namespace adobe 47 | 48 | /*************************************************************************************************/ 49 | 50 | #endif 51 | 52 | /*************************************************************************************************/ 53 | -------------------------------------------------------------------------------- /code/poly/poly/detail/friends.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_DETAIL_FRIENDS_HPP_UIZR5HW 7 | #define POLY_DETAIL_FRIENDS_HPP_UIZR5HW 8 | 9 | #include 10 | #include 11 | 12 | namespace poly { 13 | namespace detail { 14 | 15 | template struct friends; 16 | 17 | template struct friends {}; 18 | 19 | template 22 | struct friends, Signatures...> 23 | : friends 24 | { 25 | friend R call(F f, typename self_to_this_::type... args) { 26 | return forward_like(self_from::apply( 27 | std::forward::type>(args)...).get()) 28 | (f, forward_self()(args)...); 29 | } 30 | }; 31 | 32 | template 34 | struct friends, Signatures...> 35 | : friends 36 | { 37 | friend void call(F f, typename self_to_this_::type... args) { 38 | forward_like(self_from::apply( 39 | std::forward::type>(args)...).get()) 40 | (f, forward_self()(args)...); 41 | } 42 | }; 43 | 44 | } // detail 45 | } // poly 46 | 47 | #endif // POLY_DETAIL_FRIENDS_HPP_UIZR5HW 48 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/swap.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_SWAP_HPP 10 | #define ADOBE_SWAP_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | 18 | /*************************************************************************************************/ 19 | 20 | namespace adobe { 21 | 22 | /*************************************************************************************************/ 23 | /*! 24 | \defgroup swap swap 25 | \ingroup algorithm 26 | 27 | We pull swap in from \c std, with a using std::swap declaration, 28 | and employ the idiom that all code in namespace adobe that calls swap 29 | should call it unqualified. This is less cluttered than employing local using declaration and is 30 | forward compatible with C++ '0x constrained swap. We recommend this idiom to clients. 31 | */ 32 | /*************************************************************************************************/ 33 | /*! 34 | \ingroup swap 35 | 36 | 37 | */ 38 | using std::swap; 39 | 40 | /*************************************************************************************************/ 41 | 42 | } // namespace adobe 43 | 44 | /*************************************************************************************************/ 45 | 46 | #endif 47 | 48 | /*************************************************************************************************/ 49 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/iterator/type_functions.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ITERATOR_TYPE_FUNCTIONS_HPP 10 | #define ADOBE_ITERATOR_TYPE_FUNCTIONS_HPP 11 | 12 | #include 13 | 14 | #include 15 | 16 | /*************************************************************************************************/ 17 | 18 | namespace adobe { 19 | 20 | /*************************************************************************************************/ 21 | 22 | /*! \addtogroup adobe_iterator 23 | @{ 24 | */ 25 | #define ADOBE_ITERATOR_TYPE_FUNCTION_BOILERPLATE(type_name) \ 26 | template /*I models InputIterator*/ \ 27 | struct type_name \ 28 | { typedef typename std::iterator_traits::type_name type; }; 29 | 30 | ADOBE_ITERATOR_TYPE_FUNCTION_BOILERPLATE(difference_type) 31 | ADOBE_ITERATOR_TYPE_FUNCTION_BOILERPLATE(iterator_category) 32 | ADOBE_ITERATOR_TYPE_FUNCTION_BOILERPLATE(value_type) 33 | 34 | #define ADOBE_DIFFERENCE_TYPE(I) typename adobe::difference_type::type 35 | #define ADOBE_ITERATOR_CATEGORY(I) typename adobe::iterator_category::type 36 | #define ADOBE_VALUE_TYPE(I) typename adobe::value_type::type 37 | 38 | //!@} 39 | 40 | /*************************************************************************************************/ 41 | 42 | } // namespace adobe 43 | 44 | /*************************************************************************************************/ 45 | 46 | #endif 47 | // ADOBE_ITERATOR_DISTANCE_HPP 48 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/utility/ignore_unused.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_IGNORE_UNUSED_HPP 10 | #define ADOBE_IGNORE_UNUSED_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | /*************************************************************************************************/ 17 | 18 | namespace adobe { 19 | 20 | /*************************************************************************************************/ 21 | 22 | //! \ingroup testing 23 | template 24 | inline void ignore_unused(const T0&) { } 25 | 26 | //! \ingroup testing 27 | template 28 | inline void ignore_unused(const T0&, const T1&) { } 29 | 30 | //! \ingroup testing 31 | template 32 | inline void ignore_unused(const T0&, const T1&, const T2&) { } 33 | 34 | //! \ingroup testing 35 | template 36 | inline void ignore_unused(const T0&, const T1&, const T2&, const T3&) { } 37 | 38 | /*************************************************************************************************/ 39 | 40 | } // namespace adobe 41 | 42 | /*************************************************************************************************/ 43 | 44 | // ADOBE_IGNORE_UNUSED_HPP 45 | #endif 46 | 47 | /*************************************************************************************************/ 48 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/lex_stream_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_LEX_STREAM_FWD_HPP 10 | #define ADOBE_LEX_STREAM_FWD_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | #ifdef __MWERKS__ 17 | #pragma warn_implicitconv off 18 | #endif 19 | 20 | #include 21 | 22 | #ifdef __MWERKS__ 23 | #pragma warn_implicitconv reset 24 | #endif 25 | 26 | #include 27 | 28 | /*************************************************************************************************/ 29 | 30 | namespace adobe { 31 | 32 | /*************************************************************************************************/ 33 | 34 | typedef bool (keyword_extension_lookup_proc_signature_t)(const name_t&); 35 | typedef boost::function keyword_extension_lookup_proc_t; 36 | 37 | /*************************************************************************************************/ 38 | 39 | class lex_stream_t; 40 | 41 | /*************************************************************************************************/ 42 | 43 | } // namespace adobe 44 | 45 | /*************************************************************************************************/ 46 | 47 | #endif 48 | 49 | /*************************************************************************************************/ 50 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/swap_ranges.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_SWAP_RANGES_HPP 10 | #define ADOBE_ALGORITHM_SWAP_RANGES_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | /*************************************************************************************************/ 20 | 21 | namespace adobe { 22 | 23 | /*************************************************************************************************/ 24 | /*! 25 | \defgroup swap_ranges swap_ranges 26 | \ingroup mutating_algorithm 27 | 28 | \see 29 | - STL documentation for \ref stldoc_swap_ranges 30 | */ 31 | /*************************************************************************************************/ 32 | /*! 33 | \ingroup swap_ranges 34 | 35 | \brief swap_ranges implementation 36 | */ 37 | template 38 | inline ForwardIterator2 swap_ranges(ForwardRange1& range1, ForwardIterator2 first2) 39 | { 40 | return std::swap_ranges(boost::begin(range1), boost::end(range1), first2); 41 | } 42 | 43 | /*************************************************************************************************/ 44 | 45 | } // namespace adobe 46 | 47 | /*************************************************************************************************/ 48 | 49 | #endif 50 | 51 | /*************************************************************************************************/ 52 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/final.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_FINAL_HPP 10 | #define ADOBE_FINAL_HPP 11 | 12 | #include 13 | 14 | /*************************************************************************************************/ 15 | 16 | #ifndef ADOBE_NO_DOCUMENTATION 17 | 18 | /*************************************************************************************************/ 19 | 20 | namespace adobe { 21 | 22 | /*************************************************************************************************/ 23 | 24 | namespace implementation { 25 | 26 | /*************************************************************************************************/ 27 | 28 | template 29 | class final 30 | { 31 | protected: 32 | final() { } 33 | }; 34 | 35 | /*************************************************************************************************/ 36 | 37 | } // namespace implementation 38 | 39 | /*************************************************************************************************/ 40 | 41 | } // namespace adobe 42 | 43 | /*************************************************************************************************/ 44 | 45 | #endif 46 | 47 | /*************************************************************************************************/ 48 | 49 | #define ADOBE_FINAL(T) private virtual adobe::implementation::final 50 | 51 | /*************************************************************************************************/ 52 | 53 | #endif 54 | 55 | /*************************************************************************************************/ 56 | -------------------------------------------------------------------------------- /code/poly/poly/detail/signatures.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_DETAIL_SIGNATURES_HPP_NNDM8B4 7 | #define POLY_DETAIL_SIGNATURES_HPP_NNDM8B4 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace poly { 14 | namespace detail { 15 | 16 | template ::type>::type> 19 | struct signatures { 20 | void operator()() const noexcept {} 21 | }; 22 | 23 | template 24 | struct signatures, self> : signatures> { 25 | using signatures>::operator(); 26 | virtual R operator()(F, A...) POLY_DETAIL_RREF = 0; 27 | }; 28 | 29 | template 30 | struct signatures, self &&> : signatures> { 31 | using signatures>::operator(); 32 | virtual R operator()(F, A...) POLY_DETAIL_RREF = 0; 33 | }; 34 | 35 | template 36 | struct signatures, self &> : signatures> { 37 | using signatures>::operator(); 38 | virtual R operator()(F, A...) POLY_DETAIL_LREF = 0; 39 | }; 40 | 41 | template 42 | struct signatures, self const &> 43 | : signatures> 44 | { 45 | using signatures>::operator(); 46 | virtual R operator()(F, A...) const POLY_DETAIL_LREF = 0; 47 | }; 48 | 49 | } // detail 50 | } // poly 51 | 52 | #endif // POLY_DETAIL_SIGNATURES_HPP_NNDM8B4 53 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/parser_shared.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_PARSER_SHARED_HPP 10 | #define ADOBE_PARSER_SHARED_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | /*************************************************************************************************/ 20 | 21 | namespace adobe { 22 | 23 | /*************************************************************************************************/ 24 | 25 | void throw_parser_exception(const char* error_string, 26 | const line_position_t& position); 27 | 28 | void throw_parser_exception(const char* expected, 29 | const char* found, 30 | const line_position_t& position); 31 | 32 | inline void throw_parser_exception( name_t expected, 33 | name_t found, 34 | const line_position_t& position) 35 | { throw_parser_exception(expected.c_str(), found.c_str(), position); } 36 | 37 | /*************************************************************************************************/ 38 | 39 | } // namespace adobe 40 | 41 | /*************************************************************************************************/ 42 | 43 | #endif 44 | 45 | /*************************************************************************************************/ 46 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/container/storage.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2008 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_STORAGE_HPP 10 | #define ADOBE_STORAGE_HPP 11 | 12 | #include 13 | 14 | #include 15 | 16 | /*************************************************************************************************/ 17 | 18 | namespace adobe { 19 | 20 | template // T models Container 21 | struct storage_category; 22 | 23 | class block_tag { }; 24 | class contiguous_tag : public block_tag { }; 25 | class node_tag { }; 26 | 27 | template struct storage_category > 28 | { typedef contiguous_tag type; }; 29 | 30 | template struct storage_category > 31 | { typedef block_tag type; }; 32 | 33 | template struct storage_category > 34 | { typedef node_tag type; }; 35 | 36 | template struct storage_category > 37 | { typedef node_tag type; }; 38 | 39 | template struct storage_category > 40 | { typedef node_tag type; }; 41 | 42 | template struct storage_category > 43 | { typedef node_tag type; }; 44 | 45 | template struct storage_category > 46 | { typedef node_tag type; }; 47 | 48 | } // namespace adobe 49 | 50 | /*************************************************************************************************/ 51 | 52 | #endif 53 | 54 | /*************************************************************************************************/ 55 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/config/compiler/visualc.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_CONFIG_COMPILER_MSVC_HPP 10 | #define ADOBE_CONFIG_COMPILER_MSVC_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #ifndef ADOBE_CONFIG_HPP 15 | #error "This file is intended to be included by -- please use that file directly." 16 | #endif 17 | 18 | /*************************************************************************************************/ 19 | 20 | #ifndef ADOBE_COMPILER_MSVC 21 | #define ADOBE_COMPILER_MSVC 1 22 | #endif 23 | 24 | /*************************************************************************************************/ 25 | 26 | #ifndef ADOBE_TEST_MICROSOFT_NO_DEPRECATE 27 | #define ADOBE_TEST_MICROSOFT_NO_DEPRECATE 1 28 | #endif 29 | 30 | #if ADOBE_TEST_MICROSOFT_NO_DEPRECATE 31 | #if _MSC_VER >= 1400 32 | /* 33 | The explanation for this check is explained at 34 | 35 | http://stlab.adobe.com/wiki/index.php/Troubleshooting 36 | */ 37 | 38 | #ifndef _CRT_SECURE_NO_DEPRECATE 39 | #error "Microsoft 'Safe Standard C Library' is not supported. See " 40 | #endif 41 | 42 | #ifndef _SCL_SECURE_NO_DEPRECATE 43 | #error "Microsoft 'Safe Standard C++ Library' is not supported. See " 44 | #endif 45 | #endif 46 | #endif 47 | 48 | 49 | /*************************************************************************************************/ 50 | 51 | #endif 52 | 53 | /*************************************************************************************************/ 54 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/eve_evaluate.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_EVE_EVALUATE_HPP 10 | #define ADOBE_EVE_EVALUATE_HPP 11 | 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | /*************************************************************************************************/ 25 | 26 | namespace adobe { 27 | 28 | /*************************************************************************************************/ 29 | 30 | typedef boost::function< 31 | eve_callback_suite_t::position_t ( const eve_callback_suite_t::position_t& parent, 32 | name_t name, 33 | dictionary_t arguments)> bind_layout_proc_t; 34 | 35 | eve_callback_suite_t bind_layout(const bind_layout_proc_t& proc, sheet_t& layout_sheet, 36 | virtual_machine_t& evaluator); 37 | 38 | void apply_layout_parameters( layout_attributes_t& data, 39 | const dictionary_t& parameters); 40 | 41 | adobe::any_regular_t layout_variables(adobe::sheet_t& layout_sheet, adobe::name_t name); 42 | 43 | /*************************************************************************************************/ 44 | 45 | } // namespace adobe 46 | 47 | /*************************************************************************************************/ 48 | 49 | #endif 50 | 51 | /*************************************************************************************************/ 52 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/xml_token.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_XML_TOKEN_HPP 10 | #define ADOBE_XML_TOKEN_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | 18 | /*************************************************************************************************/ 19 | 20 | namespace adobe { 21 | 22 | /*************************************************************************************************/ 23 | 24 | enum xml_lex_token_set_t 25 | { 26 | xml_token_open_tag_k = 0, 27 | xml_token_open_slash_tag_k, 28 | xml_token_close_tag_k, 29 | xml_token_slash_close_tag_k, 30 | xml_token_name_k, 31 | xml_token_att_value_k, 32 | xml_token_char_data_k, 33 | xml_token_equals_k, 34 | xml_token_reference_k, 35 | xml_token_comment_k, 36 | xml_token_processing_instruction_k, 37 | xml_token_eof_k 38 | }; 39 | 40 | /*************************************************************************************************/ 41 | 42 | const char* token_to_string(xml_lex_token_set_t token); 43 | 44 | /*************************************************************************************************/ 45 | 46 | template <> 47 | inline xml_lex_token_set_t eof_token() 48 | { return xml_token_eof_k; } 49 | 50 | /*************************************************************************************************/ 51 | 52 | } // namespace adobe 53 | 54 | /*************************************************************************************************/ 55 | 56 | #endif 57 | 58 | /*************************************************************************************************/ 59 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/has_swap.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | /* 10 | This file is borrowed from the boost repository with Dave Abrahams permission. Namespaces have 11 | been changed to protect the innocent. 12 | */ 13 | 14 | // Copyright David Abrahams 2004. Distributed under the Boost 15 | // Software License, Version 1.0. (See accompanying 16 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 17 | #ifndef ADOBE_IMPLEMENTATION_HAS_SWAP_HPP 18 | #define ADOBE_IMPLEMENTATION_HAS_SWAP_HPP 19 | 20 | #include 21 | #include 22 | 23 | namespace adobe { 24 | 25 | 26 | namespace has_swap_ 27 | { 28 | // any soaks up implicit conversions and makes the following 29 | // operator++ less-preferred than any other such operator which 30 | // might be found via ADL. 31 | struct anything { template anything(T const&); }; 32 | struct no_swap 33 | { 34 | char (& operator,(char) )[2]; 35 | }; 36 | no_swap swap(anything,anything); 37 | 38 | #if defined(BOOST_MSVC) 39 | # pragma warning(push) 40 | # pragma warning(disable: 4675) // function found through argument dependent lookup -- duh! 41 | #endif 42 | template 43 | struct has_swap_impl 44 | { 45 | static T& x; 46 | 47 | BOOST_STATIC_CONSTANT(bool, value = sizeof(swap(x,x),'x') == 1); 48 | 49 | #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) 50 | typedef boost::mpl::bool_::value> type; 51 | #else 52 | typedef boost::mpl::bool_ type; 53 | #endif 54 | }; 55 | } 56 | template 57 | struct has_swap 58 | : has_swap_::has_swap_impl::type 59 | {}; 60 | #if defined(BOOST_MSVC) 61 | # pragma warning(pop) 62 | #endif 63 | 64 | } // namespace adobe 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/other_of.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | /*************************************************************************************************/ 7 | 8 | #ifndef ADOBE_ALGORITHM_OTHER_OF_HPP 9 | #define ADOBE_ALGORITHM_OTHER_OF_HPP 10 | 11 | #include 12 | 13 | #include 14 | 15 | /*************************************************************************************************/ 16 | 17 | namespace adobe { 18 | 19 | /*************************************************************************************************/ 20 | /*! 21 | \defgroup other_of other_of 22 | \ingroup non_mutating_algorithm 23 | 24 | Given a pair and an EqualityComparable item, this will return the item that is not equal to the 25 | item passed. In the case when neither item is equal to the item passed the results are 26 | undefined. 27 | */ 28 | /*************************************************************************************************/ 29 | /*! 30 | \ingroup other_of 31 | 32 | \brief other_of implementation 33 | */ 34 | template 36 | typename BinaryPredicate> 37 | inline const T& other_of(const P& pair, const T& x, BinaryPredicate pred) 38 | { 39 | return pred(pair.first, x) ? pair.second : pair.first; 40 | } 41 | 42 | /*! 43 | \ingroup other_of 44 | 45 | \brief other_of implementation 46 | */ 47 | template // P models pair 49 | inline const T& other_of(const P& pair, const T& x) 50 | { 51 | return other_of(pair, x, std::equal_to()); 52 | } 53 | 54 | /*************************************************************************************************/ 55 | 56 | } // namespace adobe 57 | 58 | /*************************************************************************************************/ 59 | 60 | #endif 61 | 62 | /*************************************************************************************************/ 63 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/median.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2008 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | /**************************************************************************************************/ 7 | 8 | #ifndef ADOBE_ALGORITHM_MEDIAN_HPP 9 | #define ADOBE_ALGORITHM_MEDIAN_HPP 10 | 11 | #include 12 | #include 13 | 14 | namespace adobe { 15 | 16 | /**************************************************************************************************/ 17 | /*! 18 | \defgroup median median 19 | \ingroup sorting 20 | 21 | As with adobe::min and adobe::max, adobe::median is a select algorithm. The median algorithm returns 22 | the second of three arguments. The algorithm is stable, which is to say that if the arguments are 23 | in non-decresing order then the identity of the returned element will be the second identity of the 24 | second argument. 25 | 26 | \see 27 | - \ref minmax 28 | - \ref clamp 29 | - \ref select 30 | */ 31 | 32 | /**************************************************************************************************/ 33 | 34 | /*! 35 | \ingroup median 36 | \brief median implementation 37 | */ 38 | template 39 | inline const T& median(const T& a, const T& b, const T& c, R r) 40 | { return select_1(a, b, c, r); } 41 | 42 | /*! 43 | \ingroup median 44 | \brief median implementation 45 | */ 46 | template 47 | inline T& median(T& a, T& b, T& c, R r) 48 | { return select_1(a, b, c, r); } 49 | 50 | /*! 51 | \ingroup median 52 | \brief median implementation 53 | */ 54 | template 55 | inline const T& median(const T& a, const T& b, const T& c) 56 | { return select_1(a, b, c, adobe::less()); } 57 | 58 | /*! 59 | \ingroup median 60 | \brief median implementation 61 | */ 62 | template 63 | inline T& median(T& a, T& b, T& c) 64 | { return select_1(a, b, c, adobe::less()); } 65 | 66 | /**************************************************************************************************/ 67 | 68 | } // namespace adobe 69 | #endif 70 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/atomic_primitives.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2008 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /******************************************************************************/ 8 | 9 | #ifndef ADOBE_IMPLEMENTATION_ATOMIC_PRIMITIVES_HPP 10 | #define ADOBE_IMPLEMENTATION_ATOMIC_PRIMITIVES_HPP 11 | 12 | #include 13 | 14 | #include 15 | #ifndef NDEBUG 16 | #include 17 | #endif 18 | 19 | #if defined(BOOST_HAS_THREADS) 20 | #include 21 | #endif 22 | 23 | #include 24 | 25 | #include 26 | 27 | /******************************************************************************/ 28 | 29 | namespace adobe { 30 | 31 | /******************************************************************************/ 32 | 33 | namespace implementation { 34 | 35 | /******************************************************************************/ 36 | template 37 | struct atomic 38 | { 39 | typedef T value_type; 40 | 41 | #if defined(BOOST_HAS_THREADS) 42 | typedef tbb::atomic type; 43 | #else 44 | typedef T type; 45 | #endif 46 | }; 47 | 48 | /******************************************************************************/ 49 | 50 | #ifndef NDEBUG 51 | template 52 | std::ostream& operator<<(std::ostream& s, const typename atomic::type& x) 53 | { 54 | return s << static_cast(x); 55 | } 56 | #endif 57 | 58 | /******************************************************************************/ 59 | 60 | typedef adobe::implementation::atomic atomic_t; 61 | 62 | BOOST_STATIC_ASSERT((sizeof(atomic_t::type) == 63 | sizeof(atomic_t::value_type))); 64 | 65 | /******************************************************************************/ 66 | 67 | } // namespace implementation 68 | 69 | /******************************************************************************/ 70 | 71 | } // namespace adobe 72 | 73 | /******************************************************************************/ 74 | // ADOBE_IMPLEMENTATION_ATOMIC_PRIMITIVES_HPP 75 | #endif 76 | 77 | /******************************************************************************/ 78 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/equal.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_EQUAL_HPP 10 | #define ADOBE_ALGORITHM_EQUAL_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | /*************************************************************************************************/ 21 | 22 | namespace adobe { 23 | 24 | /*************************************************************************************************/ 25 | /*! 26 | \defgroup equal equal 27 | \ingroup non_mutating_algorithm 28 | 29 | \see 30 | - STL documentation for \ref stldoc_equal 31 | */ 32 | /*************************************************************************************************/ 33 | /*! 34 | \ingroup equal 35 | */ 36 | template 37 | inline bool 38 | equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate pred) 39 | { 40 | return std::equal(first1, last1, first2, boost::bind(pred, _1, _2)); 41 | } 42 | 43 | /*! 44 | \ingroup equal 45 | */ 46 | template 47 | inline bool equal(const InputRange1& range1, InputIterator2 first2) 48 | { 49 | return std::equal(boost::begin(range1), boost::end(range1), first2); 50 | } 51 | 52 | /*! 53 | \ingroup equal 54 | */ 55 | template 56 | inline bool equal(const InputRange1& range1, InputIterator2 first2, BinaryPredicate pred) 57 | { 58 | return adobe::equal(boost::begin(range1), boost::end(range1), first2, pred); 59 | } 60 | 61 | /*************************************************************************************************/ 62 | 63 | } // namespace adobe 64 | 65 | /*************************************************************************************************/ 66 | 67 | #endif 68 | 69 | /*************************************************************************************************/ 70 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/closed_hash_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_CLOSED_HASH_FWD_HPP 10 | #define ADOBE_CLOSED_HASH_FWD_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | /*************************************************************************************************/ 25 | 26 | namespace adobe { 27 | namespace version_1 { 28 | 29 | /*************************************************************************************************/ 30 | 31 | template< typename T, 32 | typename KeyTransform = identity, 33 | typename Hash = boost::hash, 34 | typename Pred = std::equal_to, 35 | typename A = capture_allocator > 36 | class closed_hash_set; 37 | 38 | template, 41 | typename Pred = std::equal_to, 42 | typename A = capture_allocator > > 43 | class closed_hash_map; 44 | 45 | /*************************************************************************************************/ 46 | 47 | } // namespace version_1 48 | 49 | using version_1::closed_hash_set; 50 | using version_1::closed_hash_map; 51 | 52 | #if defined(ADOBE_NO_DOCUMENTATION) 53 | /* REVISIT (mmarcus) : doxygen doesn't seem to understand using 54 | declarartions. This is a doxygen only hack to keep reference links 55 | from breaking. 56 | */ 57 | //!\ingroup abi_container 58 | typedef version_1::closed_hash_set closed_hash_set; 59 | typedef version_1::closed_hash_map closed_hash_map; 60 | #endif 61 | 62 | } // namespace adobe 63 | 64 | /*************************************************************************************************/ 65 | 66 | #endif 67 | 68 | /*************************************************************************************************/ 69 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/iterator/set_next.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | /*************************************************************************************************/ 7 | 8 | #ifndef ADOBE_ITERATOR_SET_NEXT_HPP 9 | #define ADOBE_ITERATOR_SET_NEXT_HPP 10 | 11 | #include 12 | 13 | #include 14 | 15 | /*************************************************************************************************/ 16 | 17 | namespace adobe { 18 | 19 | namespace unsafe { 20 | 21 | /*! \addtogroup adobe_iterator 22 | @{ 23 | */ 24 | 25 | /* 26 | Example: 27 | 28 | template <> 29 | stuct set_next_fn 30 | { 31 | void operator()(T x, T y) const 32 | { 33 | //... 34 | } 35 | }; 36 | */ 37 | 38 | template // I models NodeIterator 39 | struct set_next_fn; // Must be specialized 40 | 41 | /*************************************************************************************************/ 42 | 43 | template // I models NodeIterator 44 | inline void set_next(I x, I y) 45 | { 46 | set_next_fn()(x, y); 47 | } 48 | 49 | /*************************************************************************************************/ 50 | 51 | /* 52 | location: a valid forward node iterator 53 | first and last - two valid node iterators 54 | 55 | postcondition: location->first...last->next(location) 56 | */ 57 | 58 | template // T models ForwardNodeIterator 59 | inline void splice_node_range(I location, I first, I last) 60 | { 61 | I successor(boost::next(location)); 62 | set_next(location, first); 63 | set_next(last, successor); 64 | } 65 | 66 | template // I models ForwardNodeIterator 67 | inline void skip_next_node(I location) 68 | { set_next(location, boost::next(boost::next(location))); } 69 | 70 | template // I models BidirectionalNodeIterator 71 | inline void skip_node(I location) 72 | { set_next(boost::prior(location), boost::next(location)); } 73 | 74 | //!@} 75 | 76 | /*************************************************************************************************/ 77 | 78 | } // namespace unsafe 79 | 80 | } // namespace adobe 81 | 82 | /*************************************************************************************************/ 83 | 84 | // ADOBE_ITERATOR_SET_NEXT_HPP 85 | #endif 86 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/random_shuffle.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_RANDOM_SHUFFLE_HPP 10 | #define ADOBE_ALGORITHM_RANDOM_SHUFFLE_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | /*************************************************************************************************/ 21 | 22 | namespace adobe { 23 | 24 | /*************************************************************************************************/ 25 | /*! 26 | \defgroup random_shuffle random_shuffle 27 | \ingroup mutating_algorithm 28 | 29 | \see 30 | - STL documentation for \ref stldoc_random_shuffle 31 | */ 32 | /*************************************************************************************************/ 33 | /*! 34 | \ingroup random_shuffle 35 | 36 | \brief random_shuffle implementation 37 | */ 38 | template 39 | inline void random_shuffle(RandomAccessRange& range) 40 | { 41 | return std::random_shuffle(boost::begin(range), boost::end(range)); 42 | } 43 | 44 | /*! 45 | \ingroup random_shuffle 46 | 47 | \brief random_shuffle implementation 48 | */ 49 | template 50 | inline void 51 | random_shuffle(RandomAccessIterator first, RandomAccessIterator last, RandomNumberGenerator& rand) 52 | { 53 | return std::random_shuffle(first, last, boost::bind(rand, _1)); 54 | } 55 | 56 | /*! 57 | \ingroup random_shuffle 58 | 59 | \brief random_shuffle implementation 60 | */ 61 | template 62 | inline void random_shuffle(RandomAccessRange& range, RandomNumberGenerator& rand) 63 | { 64 | return adobe::random_shuffle(boost::begin(range), boost::end(range), rand); 65 | } 66 | 67 | /*************************************************************************************************/ 68 | 69 | } // namespace adobe 70 | 71 | /*************************************************************************************************/ 72 | 73 | #endif 74 | 75 | /*************************************************************************************************/ 76 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/identity_element.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | /*************************************************************************************************/ 7 | 8 | #ifndef ADOBE_ALGORITHM_IDENTITY_ELEMENT_HPP 9 | #define ADOBE_ALGORITHM_IDENTITY_ELEMENT_HPP 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | /*************************************************************************************************/ 17 | 18 | namespace adobe { 19 | 20 | /*************************************************************************************************/ 21 | /*! 22 | \defgroup misc_functional Miscellaneous Functional Operators 23 | \ingroup adobe_functional 24 | 25 | \brief utility class to obtain the identity element for an operation 26 | */ 27 | template 28 | struct identity_element 29 | { 30 | /// the type of the identity is the same as the result tyupe of the operation 31 | typedef typename Op::result_type result_type; 32 | 33 | /// Yields the identitiy element 34 | result_type operator()() const; 35 | }; 36 | 37 | /*! 38 | \ingroup misc_functional 39 | 40 | \brief specialization of identity_element for std::plus 41 | */ 42 | template 43 | struct identity_element > 44 | { 45 | /// the type of the identity is the same as the result tyupe of the operation 46 | typedef T result_type; 47 | 48 | /// Yields the identitiy element for addition 49 | result_type operator()() const 50 | { return T(0); } 51 | }; 52 | 53 | /*! 54 | \ingroup misc_functional 55 | 56 | \brief specialization of identity_element for std::multiplies 57 | */ 58 | template 59 | struct identity_element > 60 | { 61 | /// the type of the identity is the same as the result tyupe of the operation 62 | typedef T result_type; 63 | 64 | /// Yields the identitiy element for multiplication 65 | result_type operator()() const 66 | { return T(1); } 67 | }; 68 | 69 | /*************************************************************************************************/ 70 | 71 | } // namespace adobe 72 | 73 | /*************************************************************************************************/ 74 | 75 | #endif 76 | 77 | /*************************************************************************************************/ 78 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/clamp.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2008 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | /**************************************************************************************************/ 7 | 8 | #ifndef ADOBE_ALGORITHM_CLAMP_HPP 9 | #define ADOBE_ALGORITHM_CLAMP_HPP 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | namespace adobe { 17 | 18 | /**************************************************************************************************/ 19 | /*! 20 | \defgroup clamp clamp 21 | \ingroup sorting 22 | 23 | As with adobe::min and adobe::max, clamp is a select algorithm. The clamp algorithm returns min if 24 | \c x is less than \c min and \c max if \c x is greater than max. 25 | 26 | The clamp algorithm is stable with respect to the order min, x, max. 27 | 28 | The clamp_unorderd algorithm does not presume an ordering between \c min and \c max. It is 29 | equivalent to median(min, x, max). 30 | 31 | \see 32 | - \ref minmax 33 | - \ref median 34 | - \ref select 35 | */ 36 | 37 | /**************************************************************************************************/ 38 | 39 | /*! 40 | \ingroup clamp 41 | \brief clamp implementation 42 | \pre !r(max, min) 43 | */ 44 | 45 | template 46 | inline const T& clamp(const T& x, const T& min, const T& max, R r) 47 | { 48 | return select_1_ac(min, x, max, r); 49 | } 50 | 51 | /*! 52 | \ingroup clamp 53 | \brief clamp implementation 54 | \pre !(max < min) 55 | */ 56 | 57 | template 58 | inline const T& clamp(const T& x, const T& min, const T& max) 59 | { 60 | return select_1_ac(min, x, max, adobe::less()); 61 | } 62 | 63 | /*! 64 | \ingroup clamp 65 | \brief clamp_unordered implementation 66 | */ 67 | 68 | template 69 | inline const T& clamp_unordered(const T& x, const T& min, const T& max, R r) 70 | { return select_1(min, x, max, r); } 71 | 72 | /*! 73 | \ingroup clamp 74 | \brief clamp_unordered implementation 75 | */ 76 | 77 | template 78 | inline const T& clamp_unordered(const T& x, const T& min, const T& max) 79 | { return select_1(min, x, max, adobe::less()); } 80 | 81 | /**************************************************************************************************/ 82 | 83 | } // namespace adobe 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/iota.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_IOTA_HPP 10 | #define ADOBE_ALGORITHM_IOTA_HPP 11 | 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | 21 | /*************************************************************************************************/ 22 | 23 | namespace adobe { 24 | 25 | /*************************************************************************************************/ 26 | /*! 27 | \defgroup iota iota 28 | \ingroup numeric 29 | 30 | \c iota assigns sequentially increasing values to a range. That is, it assigns \c value to 31 | \c *first, value + 1 to *(first + 1) and so on. In general, each 32 | iterator \c i in the range [first, last) is assigned 33 | value + (i - first). 34 | 35 | \requirements 36 | - \c ForwardIterator is mutable. 37 | - \c T is Assignable. 38 | - If \c x is an object of type \c T, then \c x++ is defined. 39 | - \c T is convertible to ForwardIterator::value_type 40 | - [first, last) is a valid range. 41 | 42 | \complexity 43 | - Linear. Exactly last - first assignments. 44 | */ 45 | /*************************************************************************************************/ 46 | /*! 47 | \ingroup iota 48 | 49 | \brief iota implementation 50 | */ 51 | template 52 | void iota (ForwardIterator first, ForwardIterator last, const T& value) 53 | { 54 | std::generate(first, last, adobe::sequence_t(value)); 55 | } 56 | 57 | /*! 58 | \ingroup iota 59 | 60 | \brief iota implementation 61 | */ 62 | template 63 | void iota (ForwardRange& range, const T& value) 64 | { 65 | adobe::iota(boost::begin(range), boost::end(range), value); 66 | } 67 | 68 | /*************************************************************************************************/ 69 | 70 | } // namespace adobe 71 | 72 | /*************************************************************************************************/ 73 | 74 | #endif 75 | 76 | /*************************************************************************************************/ 77 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/lex_stream.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_LEX_STREAM_HPP 10 | #define ADOBE_LEX_STREAM_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | 21 | /*************************************************************************************************/ 22 | 23 | void swap(adobe::lex_stream_t&, adobe::lex_stream_t&); 24 | 25 | /*************************************************************************************************/ 26 | 27 | namespace adobe { 28 | 29 | /*************************************************************************************************/ 30 | 31 | class lex_stream_t 32 | { 33 | public: 34 | lex_stream_t(std::istream& in, const line_position_t& position); 35 | 36 | #if !defined(ADOBE_NO_DOCUMENTATION) 37 | lex_stream_t(const lex_stream_t& rhs); 38 | 39 | ~lex_stream_t(); 40 | 41 | lex_stream_t& operator = (const lex_stream_t& rhs); 42 | #endif // !defined(ADOBE_NO_DOCUMENTATION) 43 | 44 | const stream_lex_token_t& get(); 45 | 46 | void putback(); 47 | 48 | const line_position_t& next_position(); 49 | 50 | void set_keyword_extension_lookup(const keyword_extension_lookup_proc_t& proc); 51 | 52 | #if !defined(ADOBE_NO_DOCUMENTATION) 53 | private: 54 | friend void ::swap(adobe::lex_stream_t&, adobe::lex_stream_t&); 55 | 56 | struct implementation_t; 57 | 58 | implementation_t* object_m; 59 | #endif // !defined(ADOBE_NO_DOCUMENTATION) 60 | }; 61 | 62 | /*************************************************************************************************/ 63 | 64 | } // namespace adobe 65 | 66 | /*************************************************************************************************/ 67 | 68 | inline void swap(adobe::lex_stream_t& x, adobe::lex_stream_t& y) 69 | { 70 | std::swap(x.object_m, y.object_m); 71 | } 72 | 73 | /*************************************************************************************************/ 74 | 75 | #endif 76 | 77 | /*************************************************************************************************/ 78 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/for_each.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_FOR_EACH_HPP 10 | #define ADOBE_ALGORITHM_FOR_EACH_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | /*************************************************************************************************/ 21 | 22 | namespace adobe { 23 | 24 | /*************************************************************************************************/ 25 | /*! 26 | \defgroup for_each for_each 27 | \ingroup non_mutating_algorithm 28 | 29 | \note Unlike \c std::for_each(), \c adobe::for_each() does not return a copy of \c f because \c f 30 | may not be a function object (it must model \ref concept_convertible_to_function). If it is 31 | necessary to retrieve information from the function object, pass a \c boost::reference_wrapper of 32 | the function object using \c boost::ref() instead. 33 | */ 34 | /*************************************************************************************************/ 35 | /*! 36 | \ingroup for_each 37 | 38 | \brief for_each implementation 39 | */ 40 | template 41 | inline void for_each(InputIterator first, InputIterator last, UnaryFunction f) 42 | { 43 | std::for_each(first, last, boost::bind(f, _1)); 44 | } 45 | 46 | /*! 47 | \ingroup for_each 48 | 49 | \brief for_each implementation 50 | */ 51 | template 52 | inline void for_each(InputRange& range, UnaryFunction f) 53 | { 54 | adobe::for_each(boost::begin(range), boost::end(range), f); 55 | } 56 | 57 | /*! 58 | \ingroup for_each 59 | 60 | \brief for_each implementation 61 | */ 62 | template 63 | inline void for_each(const InputRange& range, UnaryFunction f) 64 | { 65 | adobe::for_each(boost::begin(range), boost::end(range), f); 66 | } 67 | 68 | /*************************************************************************************************/ 69 | 70 | } // namespace adobe 71 | 72 | /*************************************************************************************************/ 73 | 74 | #endif 75 | 76 | /*************************************************************************************************/ 77 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/external_model.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_EXTERNAL_MODEL_HPP 10 | #define ADOBE_EXTERNAL_MODEL_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | /*************************************************************************************************/ 25 | 26 | namespace adobe { 27 | /*! 28 | \defgroup external_model External Model 29 | \ingroup property_model 30 | */ 31 | 32 | /*************************************************************************************************/ 33 | 34 | /*! 35 | \ingroup external_model 36 | */ 37 | class external_model_t : boost::noncopyable 38 | { 39 | public: 40 | 41 | typedef boost::signals::connection connection_t; 42 | typedef boost::function monitor_t; 43 | 44 | void add_cell(name_t); 45 | 46 | std::size_t count(name_t) const; 47 | connection_t monitor(name_t name, const monitor_t& monitor); 48 | void set(name_t, const any_regular_t&); 49 | 50 | void model_monitor(name_t name, const monitor_t& monitor); 51 | void model_set(name_t, const any_regular_t&); 52 | 53 | private: 54 | typedef boost::signal monitor_list_t; 55 | 56 | struct cell_t 57 | { 58 | // empty copy and assignment - we don't move connections. 59 | cell_t() { } 60 | cell_t(const cell_t&) { } 61 | cell_t& operator=(const cell_t&) { return *this; } 62 | 63 | monitor_list_t monitor_m; 64 | monitor_t model_monitor_m; 65 | }; 66 | 67 | typedef std::map index_t; 68 | 69 | cell_t* lookup(name_t); 70 | 71 | index_t index_m; 72 | std::deque cell_set_m; 73 | }; 74 | 75 | /*************************************************************************************************/ 76 | 77 | } // namespace adobe 78 | 79 | /*************************************************************************************************/ 80 | 81 | #endif 82 | 83 | /*************************************************************************************************/ 84 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/rotate.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | /*************************************************************************************************/ 7 | 8 | #ifndef ADOBE_ALGORITHM_ROTATE_HPP 9 | #define ADOBE_ALGORITHM_ROTATE_HPP 10 | 11 | #include 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | /*************************************************************************************************/ 20 | 21 | namespace adobe { 22 | 23 | /*************************************************************************************************/ 24 | /*! 25 | \defgroup rotate rotate 26 | \ingroup mutating_algorithm 27 | 28 | A better algorithm than std::rotate because: 29 | - It returns both m and m' in the order in which they show up in the sequence, 30 | allowing you to derive whether or not m is before or after m'. 31 | */ 32 | /*************************************************************************************************/ 33 | /*! 34 | \ingroup rotate 35 | 36 | This is the bidirectional optimization for rotate. 37 | */ 38 | template // I models Bidirectional Iterator 39 | std::pair rotate(I f, I m, I l, std::bidirectional_iterator_tag) 40 | { 41 | using std::reverse; 42 | 43 | reverse(f, m); 44 | 45 | reverse(m, l); 46 | 47 | std::pair p = reverse_until(f, m, l); 48 | 49 | reverse(p.first, p.second); 50 | 51 | return p; 52 | } 53 | 54 | /*! 55 | \ingroup rotate 56 | 57 | \param f first item in the sequence 58 | \param m the midpoint around which the range will be rotated 59 | \param l one past the last item in the sequence 60 | 61 | \returns 62 | m and m' as a pair in the order in which they appear in the range. 63 | */ 64 | template // I models Forward Iterator 65 | std::pair rotate(I f, I m, I l) 66 | { 67 | typedef typename std::iterator_traits::iterator_category iterator_category; 68 | 69 | return rotate(f, m, l, iterator_category()); 70 | } 71 | 72 | /*************************************************************************************************/ 73 | 74 | } // namespace adobe 75 | 76 | /*************************************************************************************************/ 77 | 78 | #endif 79 | 80 | /*************************************************************************************************/ 81 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/iomanip_pdf.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifdef ADOBE_STD_SERIALIZATION 10 | 11 | /*************************************************************************************************/ 12 | 13 | #ifndef ADOBE_IOMANIP_PDF_HPP 14 | #define ADOBE_IOMANIP_PDF_HPP 15 | 16 | /*************************************************************************************************/ 17 | 18 | #include 19 | 20 | #include 21 | 22 | /*************************************************************************************************/ 23 | 24 | namespace adobe { 25 | 26 | /*************************************************************************************************/ 27 | 28 | //!\ingroup manipulator 29 | class pdf_format : public format_base 30 | { 31 | typedef format_base inherited_t; 32 | 33 | public: 34 | typedef inherited_t::stream_type stream_type; 35 | 36 | virtual void begin_format(stream_type& os); 37 | 38 | virtual void begin_bag(stream_type& os, const std::string& ident); 39 | 40 | virtual void begin_sequence(stream_type& os); 41 | 42 | virtual void begin_atom(stream_type& os, const any_regular_t&); 43 | 44 | private: 45 | virtual void stack_event(stream_type& os, bool is_push); 46 | 47 | void handle_atom(stream_type& os, bool is_push); 48 | }; 49 | 50 | /*************************************************************************************************/ 51 | 52 | //!\ingroup manipulator 53 | inline std::ostream& begin_pdf(std::ostream& os) 54 | { 55 | replace_pword(os, format_base_idx()); 56 | return os << begin_format; 57 | } 58 | 59 | /*************************************************************************************************/ 60 | 61 | //!\ingroup manipulator 62 | inline std::ostream& end_pdf(std::ostream& os) 63 | { return os << end_format; } 64 | 65 | /*************************************************************************************************/ 66 | 67 | } // namespace adobe 68 | 69 | /*************************************************************************************************/ 70 | 71 | #endif 72 | 73 | /*************************************************************************************************/ 74 | 75 | #endif 76 | 77 | /*************************************************************************************************/ 78 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/iomanip_xml.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifdef ADOBE_STD_SERIALIZATION 10 | 11 | /*************************************************************************************************/ 12 | 13 | #ifndef ADOBE_IOMANIP_XML_HPP 14 | #define ADOBE_IOMANIP_XML_HPP 15 | 16 | /*************************************************************************************************/ 17 | 18 | #include 19 | 20 | #include 21 | 22 | /*************************************************************************************************/ 23 | 24 | namespace adobe { 25 | 26 | /*************************************************************************************************/ 27 | 28 | //!\ingroup manipulator 29 | class xml_format : public format_base 30 | { 31 | typedef format_base inherited_t; 32 | 33 | public: 34 | typedef inherited_t::stream_type stream_type; 35 | 36 | virtual void begin_format(stream_type& os); 37 | 38 | virtual void begin_bag(stream_type& os, const std::string& ident); 39 | 40 | virtual void begin_sequence(stream_type& os); 41 | 42 | virtual void begin_atom(stream_type& os, const any_regular_t&); 43 | 44 | private: 45 | virtual void stack_event(stream_type& os, bool is_push); 46 | 47 | void handle_atom(stream_type& os, bool is_push); 48 | }; 49 | 50 | /*************************************************************************************************/ 51 | 52 | //!\ingroup manipulator 53 | inline std::ostream& begin_xml(std::ostream& os) 54 | { 55 | replace_pword(os, format_base_idx()); 56 | return os << begin_format; 57 | } 58 | 59 | /*************************************************************************************************/ 60 | 61 | //!\ingroup manipulator 62 | inline std::ostream& end_xml(std::ostream& os) 63 | { return os << end_format; } 64 | 65 | /*************************************************************************************************/ 66 | 67 | } // namespace adobe 68 | 69 | /*************************************************************************************************/ 70 | 71 | #endif 72 | 73 | /*************************************************************************************************/ 74 | 75 | #endif 76 | 77 | /*************************************************************************************************/ 78 | -------------------------------------------------------------------------------- /code/poly/test_value_semantics_duck_typing.cpp: -------------------------------------------------------------------------------- 1 | /* =============================================================================== */ 2 | /* Dynamic Generic Programming */ 3 | /* =============================================================================== */ 4 | /* Test project using Pyry Jahkola's Poly library (https://github.com/pyrtsa/poly) */ 5 | /* =============================================================================== */ 6 | /* Author: Andy Prowl */ 7 | /* =============================================================================== */ 8 | 9 | struct Point 10 | { 11 | Point(double x, double y) : x{x}, y{y} { } 12 | friend bool operator == (Point const& lhs, Point const& rhs) 13 | { return (lhs.x == rhs.x) && (lhs.y == rhs.y); } 14 | double x = 0; 15 | double y = 0; 16 | }; 17 | 18 | struct Circle 19 | { 20 | Circle(Point const& center, double radius) 21 | : _center{center}, _radius{radius} { } 22 | double get_area() const { return _radius * _radius * 3.14159; } 23 | double get_perimeter() const { return _radius * 2 * 3.14159; } 24 | private: 25 | Point _center; 26 | double _radius; 27 | }; 28 | 29 | struct Rectangle 30 | { 31 | Rectangle(Point const& center, double width, double height) 32 | : _center{center}, _width{width}, _height{height} { } 33 | double get_area() const { return _width * _height; } 34 | double get_perimeter() const { return (_width + _height) * 2; } 35 | private: 36 | Point _center; 37 | double _width; 38 | double _height; 39 | }; 40 | 41 | #include 42 | 43 | POLY_CALLABLE(get_area); 44 | POLY_CALLABLE(get_perimeter); 45 | 46 | using Shape = poly::interface< 47 | double(get_area_, poly::self const&), 48 | double(get_perimeter_, poly::self const&)>; 49 | 50 | template 51 | double call(get_area_, T const &x) 52 | { 53 | return x.get_area(); 54 | } 55 | 56 | template 57 | double call(get_perimeter_, T const &x) 58 | { 59 | return x.get_perimeter(); 60 | } 61 | 62 | #include 63 | #include 64 | #include 65 | 66 | void print_areas(std::vector const& v) 67 | { 68 | for (auto const& s : v) 69 | { 70 | std::cout << "Area: " << get_area(s) << std::endl; 71 | } 72 | } 73 | 74 | void working_example() 75 | { 76 | auto r = Rectangle{{1.0, 2.0}, 5.0, 6.0}; 77 | 78 | auto c = Circle{{0.0, 0.0}, 42.0}; 79 | 80 | std::vector v{r, c}; 81 | 82 | print_areas(v); 83 | } 84 | 85 | int main() 86 | { 87 | working_example(); 88 | } 89 | -------------------------------------------------------------------------------- /code/poly/poly/returns.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2012 Pyry Jahkola. 2 | // 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | #ifndef POLY_RETURNS_HPP_3LKOAC9 7 | #define POLY_RETURNS_HPP_3LKOAC9 8 | 9 | /// Header 10 | /// ========================= 11 | /// 12 | /// Simplify the return type, noexcept, and return value computation. 13 | /// 14 | /// 15 | /// Macro `POLY_RETURNS(expression)` 16 | /// -------------------------------- 17 | /// 18 | /// Avoid duplication in computation of return type, the noexcept specifier, and 19 | /// return value in a one-expression function definition. To be used with `auto` 20 | /// like the following example illustrates: 21 | /// 22 | /// template 23 | /// auto plus(A && a, B && b) POLY_RETURNS(a + b); 24 | /// 25 | /// **Remark.** Append semicolon where this macro is used. 26 | /// 27 | /// **Remark.** If `POLY_NO_RETURNS_NOEXCEPT` is defined, this macro reduces to 28 | /// `POLY_RETURNS_THROW(expression)`. 29 | /// 30 | /// **See also.** `POLY_RETURNS_THROW(expression)` 31 | /// 32 | /// 33 | /// Macro `POLY_RETURNS_THROW(expression)` 34 | /// -------------------------------------- 35 | /// 36 | /// Avoid duplication in computation of return type and return value in a 37 | /// one-expression function definition. To be used with `auto` like the 38 | /// following example illustrates: 39 | /// 40 | /// template 41 | /// auto plus(A && a, B && b) POLY_RETURNS_THROW(a + b); 42 | /// 43 | /// **Remark.** Append semicolon where this macro is used. 44 | /// 45 | /// **See also**: `POLY_RETURNS(expression)` 46 | 47 | #include 48 | 49 | // ----------------------------------------------------------------------------- 50 | 51 | #define POLY_RETURNS_THROW(...) /**********************/ \ 52 | -> decltype(__VA_ARGS__) { return (__VA_ARGS__); } \ 53 | typedef int POLY_DETAIL_CAT(POLY_RETURNS_, __LINE__) \ 54 | /**/ 55 | 56 | // ----------------------------------------------------------------------------- 57 | 58 | #ifndef POLY_NO_RETURNS_NOEXCEPT 59 | # define POLY_RETURNS(...) /************************************/ \ 60 | noexcept(noexcept(decltype(__VA_ARGS__) \ 61 | (std::forward(__VA_ARGS__)))) \ 62 | -> decltype(__VA_ARGS__) { return (__VA_ARGS__); } \ 63 | typedef int POLY_DETAIL_CAT(POLY_RETURNS_, __LINE__) \ 64 | /**/ 65 | #else 66 | # define POLY_RETURNS(...) POLY_RETURNS_THROW(__VA_ARGS__) 67 | #endif 68 | 69 | #endif // POLY_RETURNS_HPP_3LKOAC9 70 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/iomanip_javascript.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifdef ADOBE_STD_SERIALIZATION 10 | 11 | /*************************************************************************************************/ 12 | 13 | #ifndef ADOBE_IOMANIP_JAVASCRIPT_HPP 14 | #define ADOBE_IOMANIP_JAVASCRIPT_HPP 15 | 16 | /*************************************************************************************************/ 17 | 18 | #include 19 | 20 | #include 21 | 22 | /*************************************************************************************************/ 23 | 24 | namespace adobe { 25 | 26 | /*************************************************************************************************/ 27 | 28 | //!\ingroup manipulator 29 | class javascript_format : public format_base 30 | { 31 | typedef format_base inherited_t; 32 | 33 | public: 34 | typedef inherited_t::stream_type stream_type; 35 | 36 | virtual void begin_format(stream_type& os); 37 | 38 | virtual void begin_bag(stream_type& os, const std::string& ident); 39 | 40 | virtual void begin_sequence(stream_type& os); 41 | 42 | virtual void begin_atom(stream_type& os, const any_regular_t&); 43 | 44 | private: 45 | virtual void stack_event(stream_type& os, bool is_push); 46 | 47 | void handle_atom(stream_type& os, bool is_push); 48 | }; 49 | 50 | /*************************************************************************************************/ 51 | 52 | //!\ingroup manipulator 53 | inline std::ostream& begin_javascript(std::ostream& os) 54 | { 55 | replace_pword(os, format_base_idx()); 56 | return os << begin_format; 57 | } 58 | 59 | /*************************************************************************************************/ 60 | 61 | //!\ingroup manipulator 62 | inline std::ostream& end_javascript(std::ostream& os) 63 | { return os << end_format; } 64 | 65 | /*************************************************************************************************/ 66 | 67 | } // namespace adobe 68 | 69 | /*************************************************************************************************/ 70 | 71 | #endif 72 | 73 | /*************************************************************************************************/ 74 | 75 | #endif 76 | 77 | /*************************************************************************************************/ 78 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/functional/is_member.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2008 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_FUNCTIONAL_IS_MEMBER_HPP 10 | #define ADOBE_FUNCTIONAL_IS_MEMBER_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | /*************************************************************************************************/ 23 | 24 | namespace adobe { 25 | 26 | /*************************************************************************************************/ 27 | 28 | /*! \addtogroup misc_functional 29 | @{ 30 | */ 31 | 32 | template // O modles StrictWeakOrdering 34 | struct is_member 35 | { 36 | typedef bool result_type; 37 | 38 | is_member(I f, I l, O o = O()) : first(f), last(l), compare(o) { } 39 | 40 | bool operator()(const typename boost::iterator_value::type& x) const 41 | { return binary_search(first, last, x, compare) != last; } 42 | 43 | I first; 44 | I last; 45 | O compare; 46 | }; 47 | 48 | template // I models ForwardIterator 49 | is_member make_is_member(I f, I l) { return is_member(f, l); } 50 | 51 | template // O modles StrictWeakOrdering 53 | is_member make_is_member(I f, I l, O o) { return is_member(f, l, o); } 54 | 55 | template // I models ForwardRange 56 | is_member::type, less> make_is_member(const I& r) 57 | { return make_is_member(begin(r), end(r)); } 58 | 59 | template // O modles StrictWeakOrdering 61 | is_member::type, O> make_is_member(const I& r, O o) 62 | { return make_is_member(begin(r), end(r), o); } 63 | 64 | //!@} 65 | 66 | /*************************************************************************************************/ 67 | 68 | } // namespace adobe 69 | 70 | /*************************************************************************************************/ 71 | 72 | #endif 73 | 74 | /*************************************************************************************************/ 75 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/iterator/value_iterator.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ITERATOR_VALUE_ITERATOR_HPP 10 | #define ADOBE_ITERATOR_VALUE_ITERATOR_HPP 11 | 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | /*************************************************************************************************/ 21 | 22 | namespace adobe { 23 | 24 | /*************************************************************************************************/ 25 | 26 | //! \addtogroup adobe_iterator 27 | //! @{ 28 | 29 | 30 | template > // F models UnaryFunction 32 | class value_iterator 33 | { 34 | public: 35 | typedef typename F::result_type value_type; 36 | typedef value_type* pointer; 37 | typedef value_type& reference; 38 | typedef ptrdiff_t difference_type; 39 | typedef std::forward_iterator_tag iterator_category; 40 | 41 | private: 42 | I i; 43 | F f; 44 | 45 | public: 46 | value_iterator() 47 | { } 48 | 49 | value_iterator(const I& x, const F& y) : 50 | i(x), f(y) 51 | { } 52 | 53 | value_iterator& operator++() 54 | { 55 | ++i; 56 | return *this; 57 | } 58 | 59 | value_iterator operator++(int) 60 | { 61 | value_iterator tmp = *this; 62 | 63 | ++*this; 64 | 65 | return tmp; 66 | } 67 | 68 | const value_type& operator*() const 69 | { 70 | return f(i); 71 | } 72 | 73 | value_type operator*() 74 | { 75 | return f(i); 76 | } 77 | 78 | friend bool operator==(const value_iterator& a, const value_iterator& b) 79 | { 80 | // assert(a.f == b.f); 81 | 82 | return a.i == b.i; 83 | } 84 | 85 | friend bool operator!=(const value_iterator& a, const value_iterator& b) 86 | { 87 | return !(a == b); 88 | } 89 | }; 90 | 91 | //! @} 92 | 93 | /*************************************************************************************************/ 94 | 95 | } // namespace adobe 96 | 97 | /*************************************************************************************************/ 98 | 99 | #endif 100 | // ADOBE_ITERATOR_DISTANCE_HPP 101 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/sheet.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_SHEET_HPP 10 | #define ADOBE_SHEET_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | /*************************************************************************************************/ 17 | 18 | namespace adobe { 19 | 20 | /*************************************************************************************************/ 21 | 22 | #ifdef ADOBE_CONCEPTS 23 | 24 | /*************************************************************************************************/ 25 | 26 | auto concept BasicSheetConcept {}; 27 | 28 | /*************************************************************************************************/ 29 | 30 | auto concept SheetConcept : BasicSheetConcept 31 | { 32 | void touch(T& t, const name_t*, const name_t*); 33 | }; 34 | 35 | /*************************************************************************************************/ 36 | 37 | auto concept SheetMFConcept : BasicSheetConcept 38 | { 39 | void T::touch(const name_t*, const name_t*); 40 | }; 41 | 42 | /*************************************************************************************************/ 43 | 44 | template 45 | concept_map SheetConcept 46 | { 47 | inline void touch(T& t, const name_t* x, const name_t* y) 48 | { 49 | t.touch(x, y); 50 | } 51 | }; 52 | 53 | /*************************************************************************************************/ 54 | 55 | template 56 | concept_map BasicSheetConcept > {}; 57 | 58 | /*************************************************************************************************/ 59 | 60 | template 61 | concept_map SheetConcept > 62 | { 63 | inline void touch(boost::reference_wrapper& r, const name_t* x, const name_t* y) 64 | { 65 | SheetConcept::touch(static_cast(r), x, y); 66 | } 67 | }; 68 | 69 | /*************************************************************************************************/ 70 | 71 | #endif 72 | 73 | /*************************************************************************************************/ 74 | 75 | } 76 | 77 | /*************************************************************************************************/ 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/regular_concept.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_REGULAR_HPP 10 | #define ADOBE_REGULAR_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #ifdef ADOBE_HAS_CPLUS0X_CONCEPTS 15 | 16 | /*************************************************************************************************/ 17 | 18 | #include 19 | 20 | /*************************************************************************************************/ 21 | 22 | namespace adobe { 23 | 24 | /*************************************************************************************************/ 25 | 26 | auto concept RegularConcept 27 | : std::CopyConstructible, 28 | std::Assignable, 29 | std::EqualityComparable, 30 | std::Swappable, 31 | std::DefaultConstructible // not yet 32 | { 33 | }; 34 | 35 | /*************************************************************************************************/ 36 | 37 | } // namespace adobe 38 | 39 | /*************************************************************************************************/ 40 | 41 | #else 42 | 43 | /*************************************************************************************************/ 44 | 45 | #include 46 | 47 | /*************************************************************************************************/ 48 | 49 | namespace adobe { 50 | 51 | /*************************************************************************************************/ 52 | 53 | template 54 | struct RegularConcept 55 | { 56 | 57 | // Concept checking: 58 | 59 | void constraints() { 60 | // refinement of: 61 | boost::function_requires >(); 62 | boost::function_requires >(); 63 | boost::function_requires >(); 64 | // boost::function_requires >(); 65 | 66 | swap(t,t); 67 | } 68 | #if !defined(ADOBE_NO_DOCUMENTATION) 69 | T t; 70 | #endif 71 | }; 72 | 73 | /*************************************************************************************************/ 74 | 75 | } // namespace adobe 76 | 77 | /*************************************************************************************************/ 78 | 79 | #endif 80 | 81 | /*************************************************************************************************/ 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/xml_lex.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /**************************************************************************************************/ 8 | 9 | #ifndef ADOBE_XML_LEX_HPP 10 | #define ADOBE_XML_LEX_HPP 11 | 12 | /**************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | /**************************************************************************************************/ 21 | 22 | namespace adobe { 23 | 24 | /**************************************************************************************************/ 25 | 26 | class xml_lex_t : lex_base_t<2, xml_lex_token_set_t> 27 | { 28 | typedef lex_base_t<2, xml_lex_token_set_t> _super; 29 | 30 | public: 31 | typedef _super::token_type token_type; 32 | 33 | xml_lex_t(uchar_ptr_t first, uchar_ptr_t last, const line_position_t& position); 34 | 35 | xml_lex_t(const xml_lex_t& rhs); 36 | 37 | const token_type& get() 38 | { return _super::get_token(); } 39 | 40 | void putback() 41 | { _super::putback_token(); } 42 | 43 | const line_position_t& next_position() 44 | { return _super::next_position(); } 45 | 46 | void set_skip_white_space(bool skip) 47 | { return _super::set_skip_white_space(skip); } 48 | 49 | #if !defined(ADOBE_NO_DOCUMENTATION) 50 | private: 51 | typedef std::istream::pos_type pos_type; 52 | 53 | void parse_token(); 54 | 55 | bool is_processing_instruction(token_type& result); 56 | bool is_comment(token_type& result); 57 | bool is_tag_open(token_type& result); 58 | bool is_tag_close(token_type& result); 59 | bool is_name(token_type& result); 60 | bool is_equals(token_type& result); 61 | bool is_att_value(token_type& result); 62 | bool is_char_data(token_type& result); 63 | bool is_reference(token_type& result); 64 | 65 | bool is_name_start_char(); 66 | bool is_name_char(); 67 | 68 | bool name_possible_m; // names only possible within tags 69 | #endif // !defined(ADOBE_NO_DOCUMENTATION) 70 | }; 71 | 72 | /**************************************************************************************************/ 73 | 74 | } // namespace adobe 75 | 76 | /**************************************************************************************************/ 77 | 78 | #endif 79 | 80 | /**************************************************************************************************/ 81 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/test/check_traversable.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2008 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #include 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | namespace adobe { 18 | /*! 19 | \ingroup testing 20 | */ 21 | template 22 | void check_traversable(const T& c) 23 | { 24 | 25 | // http://www.sgi.com/tech/stl/Container.html 26 | 27 | boost::function_requires< boost::ContainerConcept >(); 28 | check_regular(c); 29 | { 30 | // some valid expressions 31 | const T d1(c); 32 | T d2(c); 33 | typename T::const_iterator i1=d1.begin(), i2=d1.end(), i3=d2.begin(), i4=d2.end(); 34 | typename T::iterator j1=d2.begin(), j2=d2.end(); 35 | } 36 | 37 | 38 | { 39 | T d(c); 40 | BOOST_CHECK_MESSAGE(c.size() == d.size(), "container copy-ctor size"); 41 | typename T::const_iterator i=c.begin(), j=d.begin(); 42 | 43 | BOOST_CHECK_MESSAGE(d==c, "container copy-ctor values"); 44 | } 45 | 46 | { 47 | T d; 48 | d = c; 49 | BOOST_CHECK_MESSAGE(c.size() == d.size(), "container assignment copy-ctor size"); 50 | 51 | 52 | BOOST_CHECK_MESSAGE(d==c, "container copy-ctor values"); 53 | } 54 | 55 | 56 | { 57 | T d; 58 | BOOST_CHECK_MESSAGE(c.max_size() >= c.size() && 0 <= c.size(), "container maximum size"); 59 | BOOST_CHECK_MESSAGE(d.max_size() >= d.size() && 0 <= d.size(), "container maximum size"); 60 | BOOST_CHECK_MESSAGE(c.empty() == (c.size() == 0), "container empty"); 61 | BOOST_CHECK_MESSAGE(d.empty() == (d.size() == 0), "container empty"); 62 | } 63 | 64 | 65 | { 66 | using std::swap; 67 | T d1(c); 68 | T d2(c); 69 | T d3; 70 | T d4; 71 | 72 | d1.swap(d3); 73 | swap(d3,d4); 74 | BOOST_CHECK_MESSAGE(d1 == d3 && d2 == d4, "container swap"); 75 | } 76 | 77 | { 78 | 79 | typename T::iterator x; 80 | typename T::const_iterator y; 81 | 82 | y = x; // Make sure mutable iterator can be converted to const. 83 | 84 | y == x; // Make sure const/mutable iterators can be compared. 85 | x == y; 86 | 87 | } 88 | 89 | 90 | 91 | } 92 | 93 | #if 0 94 | //gcc always instantiates this 95 | BOOST_TEST_CASE_TEMPLATE_FUNCTION(check_traversables, T) 96 | { 97 | check_traversable(arbitrary_traversable()); 98 | } 99 | #endif 100 | 101 | } 102 | 103 | -------------------------------------------------------------------------------- /code/boost.typeerasure/test_reference_semantics_duck_typing.cpp: -------------------------------------------------------------------------------- 1 | /* =============================================================================== */ 2 | /* Dynamic Generic Programming */ 3 | /* =============================================================================== */ 4 | /* Test project using the Boost.TypeErasure library */ 5 | /* (http://www.boost.org/doc/libs/1_56_0/doc/html/boost_typeerasure.html) */ 6 | /* */ 7 | /* Tested with Boost 1.56 */ 8 | /* =============================================================================== */ 9 | /* Author: Andy Prowl */ 10 | /* =============================================================================== */ 11 | 12 | struct Point 13 | { 14 | Point(double x, double y) : x{x}, y{y} { } 15 | friend bool operator == (Point const& lhs, Point const& rhs) 16 | { return (lhs.x == rhs.x) && (lhs.y == rhs.y); } 17 | double x = 0; 18 | double y = 0; 19 | }; 20 | 21 | struct Circle 22 | { 23 | Circle(Point const& center, double radius) 24 | : _center{center}, _radius{radius} { } 25 | double get_area() const { return _radius * _radius * 3.14159; } 26 | double get_perimeter() const { return _radius * 2 * 3.14159; } 27 | private: 28 | Point _center; 29 | double _radius; 30 | }; 31 | 32 | struct Rectangle 33 | { 34 | Rectangle(Point const& center, double width, double height) 35 | : _center{center}, _width{width}, _height{height} { } 36 | double get_area() const { return _width * _height; } 37 | double get_perimeter() const { return (_width + _height) * 2; } 38 | void set_size(double width, double height) { _width = width; _height = height; } 39 | private: 40 | Point _center; 41 | double _width; 42 | double _height; 43 | }; 44 | 45 | #include 46 | #include 47 | #include 48 | 49 | namespace erasure = boost::type_erasure; 50 | 51 | BOOST_TYPE_ERASURE_MEMBER((has_get_area), get_area) 52 | BOOST_TYPE_ERASURE_MEMBER((has_get_perimeter), get_perimeter) 53 | 54 | using ShapeRequirements = boost::mpl::vector< 55 | erasure::copy_constructible<>, 56 | has_get_area, 57 | has_get_perimeter, 58 | erasure::relaxed>; 59 | 60 | using ShapeRef = erasure::any; 61 | 62 | #include 63 | #include 64 | 65 | int main() 66 | { 67 | Rectangle r{{1.0, 2.0}, 5.0, 6.0}; 68 | 69 | ShapeRef s{r}; 70 | 71 | std::cout << s.get_area() << std::endl; 72 | 73 | r.set_size(4, 2); 74 | 75 | std::cout << s.get_area() << std::endl; 76 | } 77 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/merge.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_MERGE_HPP 10 | #define ADOBE_ALGORITHM_MERGE_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | /*************************************************************************************************/ 21 | 22 | namespace adobe { 23 | 24 | /*************************************************************************************************/ 25 | /*! 26 | \defgroup merge merge 27 | \ingroup sorting 28 | 29 | \see 30 | - STL documentation for \ref stldoc_merge 31 | */ 32 | /*************************************************************************************************/ 33 | /*! 34 | \ingroup merge 35 | 36 | \brief merge implementation 37 | */ 38 | template 39 | inline OutputIterator 40 | merge(const InputRange1& range1, const InputRange2& range2, OutputIterator result) 41 | { 42 | return std::merge( boost::begin(range1), boost::end(range1), 43 | boost::begin(range2), boost::end(range2), 44 | result); 45 | } 46 | 47 | /*! 48 | \ingroup merge 49 | 50 | \brief merge implementation 51 | */ 52 | template 53 | inline OutputIterator merge(InputIterator1 first1, InputIterator1 last1, 54 | InputIterator2 first2, InputIterator2 last2, 55 | OutputIterator result, Compare comp) 56 | { 57 | return std::merge(first1, last1, first2, last2, result, boost::bind(comp, _1, _2)); 58 | } 59 | 60 | /*! 61 | \ingroup merge 62 | 63 | \brief merge implementation 64 | */ 65 | template 66 | inline OutputIterator 67 | merge(const InputRange1& range1, const InputRange2& range2, OutputIterator result, Compare comp) 68 | { 69 | return adobe::merge( boost::begin(range1), boost::end(range1), 70 | boost::begin(range2), boost::end(range2), 71 | result, comp); 72 | } 73 | 74 | /*************************************************************************************************/ 75 | 76 | } // namespace adobe 77 | 78 | /*************************************************************************************************/ 79 | 80 | #endif 81 | 82 | /*************************************************************************************************/ 83 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/dictionary.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /**************************************************************************************************/ 8 | 9 | #ifndef ADOBE_DICTIONARY_HPP 10 | #define ADOBE_DICTIONARY_HPP 11 | 12 | /**************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #ifdef ADOBE_STD_SERIALIZATION 27 | #include 28 | #endif 29 | 30 | /**************************************************************************************************/ 31 | 32 | namespace adobe { 33 | namespace version_1 { 34 | 35 | /**************************************************************************************************/ 36 | 37 | template 38 | inline bool get_value(const dictionary_t& dict, name_t key, T& value) 39 | { 40 | dictionary_t::const_iterator i = dict.find(key); 41 | if (i == dict.end()) return false; 42 | return i->second.cast(value); 43 | } 44 | 45 | inline bool get_value(const dictionary_t& dict, name_t key, any_regular_t& value) 46 | { 47 | dictionary_t::const_iterator i = dict.find(key); 48 | if (i == dict.end()) return false; 49 | value = i->second; 50 | return true; 51 | } 52 | 53 | inline const any_regular_t& get_value(const dictionary_t& dict, name_t key) 54 | { 55 | dictionary_t::const_iterator i = dict.find(key); 56 | if (i == dict.end()) 57 | throw std::out_of_range(make_string("dictionary_t: key '", key.c_str(), "' not found")); 58 | 59 | return i->second; 60 | } 61 | 62 | /**************************************************************************************************/ 63 | 64 | #ifdef ADOBE_STD_SERIALIZATION 65 | 66 | // NOTE (sparent@adobe.com) : Code for serialization is located in source/any_regular.cpp. 67 | std::ostream& operator<<(std::ostream& out, const dictionary_t& x); 68 | 69 | #endif 70 | 71 | /**************************************************************************************************/ 72 | 73 | } // namespace version_1 74 | 75 | using version_1::get_value; 76 | 77 | } // namespace adobe 78 | 79 | /**************************************************************************************************/ 80 | 81 | ADOBE_SHORT_NAME_TYPE('d','i','c','t', adobe::dictionary_t) 82 | 83 | /**************************************************************************************************/ 84 | 85 | #endif 86 | 87 | /**************************************************************************************************/ 88 | 89 | -------------------------------------------------------------------------------- /code/boost.typeerasure/test_value_semantics_duck_typing.cpp: -------------------------------------------------------------------------------- 1 | /* =============================================================================== */ 2 | /* Dynamic Generic Programming */ 3 | /* =============================================================================== */ 4 | /* Test project using the Boost.TypeErasure library */ 5 | /* (http://www.boost.org/doc/libs/1_56_0/doc/html/boost_typeerasure.html) */ 6 | /* */ 7 | /* Tested with Boost 1.56 */ 8 | /* =============================================================================== */ 9 | /* Author: Andy Prowl */ 10 | /* =============================================================================== */ 11 | 12 | struct Point 13 | { 14 | Point(double x, double y) : x{x}, y{y} { } 15 | friend bool operator == (Point const& lhs, Point const& rhs) 16 | { return (lhs.x == rhs.x) && (lhs.y == rhs.y); } 17 | double x = 0; 18 | double y = 0; 19 | }; 20 | 21 | struct Circle 22 | { 23 | Circle(Point const& center, double radius) 24 | : _center{center}, _radius{radius} { } 25 | double get_area() const { return _radius * _radius * 3.14159; } 26 | double get_perimeter() const { return _radius * 2 * 3.14159; } 27 | private: 28 | Point _center; 29 | double _radius; 30 | }; 31 | 32 | struct Rectangle 33 | { 34 | Rectangle(Point const& center, double width, double height) 35 | : _center{center}, _width{width}, _height{height} { } 36 | double get_area() const { return _width * _height; } 37 | double get_perimeter() const { return (_width + _height) * 2; } 38 | private: 39 | Point _center; 40 | double _width; 41 | double _height; 42 | }; 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | namespace erasure = boost::type_erasure; 49 | 50 | BOOST_TYPE_ERASURE_MEMBER((has_get_area), get_area) 51 | BOOST_TYPE_ERASURE_MEMBER((has_get_perimeter), get_perimeter) 52 | 53 | using ShapeRequirements = boost::mpl::vector< 54 | erasure::copy_constructible<>, 55 | has_get_area, 56 | has_get_perimeter, 57 | erasure::relaxed>; 58 | 59 | using Shape = erasure::any; 60 | 61 | #include 62 | #include 63 | 64 | void print_areas(std::vector const& v) 65 | { 66 | for (auto const& s : v) 67 | { 68 | std::cout << "Area: " << s.get_area() << std::endl; 69 | } 70 | } 71 | 72 | int main() 73 | { 74 | auto r = Rectangle{{1.0, 2.0}, 5.0, 6.0}; 75 | 76 | auto c = Circle{{0.0, 0.0}, 42.0}; 77 | 78 | std::vector v{r, c}; 79 | 80 | print_areas(v); 81 | } 82 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/partition.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_PARTITION_HPP 10 | #define ADOBE_ALGORITHM_PARTITION_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | /*************************************************************************************************/ 21 | 22 | namespace adobe { 23 | 24 | /*************************************************************************************************/ 25 | /*! 26 | \defgroup partition partition 27 | \ingroup mutating_algorithm 28 | 29 | \see 30 | - STL documentation for \ref stldoc_partition 31 | - STL documentation for \ref stldoc_stable_partition 32 | */ 33 | /*************************************************************************************************/ 34 | /*! 35 | \ingroup partition 36 | 37 | \brief partition implementation 38 | */ 39 | template 40 | inline BidirectionalIterator 41 | partition(BidirectionalIterator first, BidirectionalIterator last, Predicate pred) 42 | { 43 | return std::partition(first, last, boost::bind(pred, _1)); 44 | } 45 | 46 | /*! 47 | \ingroup partition 48 | 49 | \brief partition implementation 50 | */ 51 | template 52 | inline typename boost::range_iterator::type 53 | partition(BidirectionalRange& range, Predicate pred) 54 | { 55 | return adobe::partition(boost::begin(range), boost::end(range), pred); 56 | } 57 | 58 | /*! 59 | \ingroup partition 60 | 61 | \brief partition implementation 62 | */ 63 | template 64 | inline BidirectionalIterator 65 | stable_partition(BidirectionalIterator first, BidirectionalIterator last, Predicate pred) 66 | { 67 | return std::stable_partition(first, last, boost::bind(pred, _1)); 68 | } 69 | 70 | /*! 71 | \ingroup partition 72 | 73 | \brief partition implementation 74 | */ 75 | template 76 | inline typename boost::range_iterator::type 77 | stable_partition(BidirectionalRange& range, Predicate pred) 78 | { 79 | return adobe::stable_partition(boost::begin(range), boost::end(range), pred); 80 | } 81 | 82 | /*************************************************************************************************/ 83 | 84 | } // namespace adobe 85 | 86 | /*************************************************************************************************/ 87 | 88 | #endif 89 | 90 | /*************************************************************************************************/ 91 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/lexicographical_compare.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_LEXICOGRAPHICAL_COMPARE_HPP 10 | #define ADOBE_ALGORITHM_LEXICOGRAPHICAL_COMPARE_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | /*************************************************************************************************/ 21 | 22 | namespace adobe { 23 | 24 | /*************************************************************************************************/ 25 | /*! 26 | \defgroup lexicographical_compare lexicographical_compare 27 | \ingroup sorting 28 | 29 | \see 30 | - STL documentation for \ref stldoc_lexicographical_compare 31 | */ 32 | /*************************************************************************************************/ 33 | /*! 34 | \ingroup lexicographical_compare 35 | 36 | \brief lexicographical_compare implementation 37 | */ 38 | template 39 | inline bool lexicographical_compare(const InputRange1& range1, const InputRange2& range2) 40 | { 41 | return std::lexicographical_compare(boost::begin(range1), boost::end(range1), 42 | boost::begin(range2), boost::end(range2)); 43 | } 44 | 45 | /*! 46 | \ingroup lexicographical_compare 47 | 48 | \brief lexicographical_compare implementation 49 | */ 50 | template 51 | inline bool lexicographical_compare(InputIterator1 first1, InputIterator1 last1, 52 | InputIterator2 first2, InputIterator2 last2, 53 | Compare comp) 54 | 55 | { 56 | return std::lexicographical_compare(first1, last1, first2, last2, boost::bind(comp, _1, _2)); 57 | } 58 | 59 | /*! 60 | \ingroup lexicographical_compare 61 | 62 | \brief lexicographical_compare implementation 63 | */ 64 | template 65 | inline bool 66 | lexicographical_compare(const InputRange1& range1, const InputRange2& range2, Compare comp) 67 | { 68 | return adobe::lexicographical_compare( boost::begin(range1), boost::end(range1), 69 | boost::begin(range2), boost::end(range2), 70 | comp); 71 | } 72 | 73 | /*************************************************************************************************/ 74 | 75 | } // namespace adobe 76 | 77 | /*************************************************************************************************/ 78 | 79 | #endif 80 | 81 | /*************************************************************************************************/ 82 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/token.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_TOKEN_HPP 10 | #define ADOBE_TOKEN_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | 18 | /*************************************************************************************************/ 19 | 20 | /* 21 | REVISIT (sparent) : This code is an implementation detail and should be moved into an implementation 22 | namespace but at this moment that would require too many changes. 23 | */ 24 | 25 | namespace adobe { 26 | 27 | /*************************************************************************************************/ 28 | 29 | extern aggregate_name_t ifelse_k; 30 | 31 | extern aggregate_name_t number_k; 32 | extern aggregate_name_t identifier_k; 33 | extern aggregate_name_t string_k; 34 | extern aggregate_name_t lead_comment_k; 35 | extern aggregate_name_t trail_comment_k; 36 | 37 | extern aggregate_name_t semicolon_k; 38 | extern aggregate_name_t comma_k; 39 | extern aggregate_name_t assign_k; 40 | extern aggregate_name_t question_k; 41 | extern aggregate_name_t colon_k; 42 | extern aggregate_name_t open_brace_k; 43 | extern aggregate_name_t close_brace_k; 44 | extern aggregate_name_t open_parenthesis_k; 45 | extern aggregate_name_t close_parenthesis_k; 46 | extern aggregate_name_t dot_k; 47 | extern aggregate_name_t open_bracket_k; 48 | extern aggregate_name_t close_bracket_k; 49 | extern aggregate_name_t at_k; 50 | extern aggregate_name_t is_k; 51 | extern aggregate_name_t to_k; 52 | 53 | extern aggregate_name_t add_k; 54 | extern aggregate_name_t subtract_k; 55 | extern aggregate_name_t multiply_k; 56 | extern aggregate_name_t divide_k; 57 | extern aggregate_name_t modulus_k; 58 | 59 | extern aggregate_name_t not_k; 60 | extern aggregate_name_t unary_negate_k; 61 | 62 | extern aggregate_name_t less_k; 63 | extern aggregate_name_t greater_k; 64 | 65 | extern aggregate_name_t and_k; 66 | extern aggregate_name_t or_k; 67 | extern aggregate_name_t less_equal_k; 68 | extern aggregate_name_t greater_equal_k; 69 | extern aggregate_name_t not_equal_k; 70 | extern aggregate_name_t equal_k; 71 | 72 | extern aggregate_name_t keyword_k; 73 | extern aggregate_name_t empty_k; 74 | extern aggregate_name_t true_k; 75 | extern aggregate_name_t false_k; 76 | 77 | extern aggregate_name_t function_k; 78 | extern aggregate_name_t variable_k; 79 | extern aggregate_name_t index_k; 80 | extern aggregate_name_t array_k; 81 | extern aggregate_name_t dictionary_k; 82 | 83 | /*************************************************************************************************/ 84 | 85 | } // namespace adobe 86 | 87 | /*************************************************************************************************/ 88 | 89 | #endif 90 | 91 | /*************************************************************************************************/ 92 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/expression_filter.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_EXPRESSION_FILTER_HPP 10 | #define ADOBE_EXPRESSION_FILTER_HPP 11 | 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | /*************************************************************************************************/ 20 | 21 | namespace adobe { 22 | 23 | /*************************************************************************************************/ 24 | 25 | /*! 26 | Takes a unicode code point and returns the equivalent XML entity name. 27 | 28 | Throws if the code point does not have an XML entity mapping. 29 | 30 | Note: The entity name does not contain the standard 31 | entity prefix ('&') or suffix (';') 32 | */ 33 | const adobe::string_t& entity_map_find(boost::uint32_t code_point); 34 | 35 | /*! 36 | Takes an XML entity name and returns the equivalent unicode code point. 37 | 38 | Throws if the XML entity name is invalid. 39 | 40 | Note: The entity name must not contain the standard 41 | entity prefix ('&') or suffix (';') 42 | */ 43 | boost::uint32_t entity_map_find(const adobe::string_t& entity); 44 | 45 | /*! 46 | Returns whether or not a string has at least one character in it 47 | that would be escaped by entity_escape; can be faster than 48 | escape-and-compare, as it could return true before the entire string 49 | is scanned. 50 | */ 51 | bool needs_entity_escape(const string_t& value); 52 | 53 | /*! 54 | Takes a string and converts certain ascii characters found within to 55 | their xml entity equivalents, returning the "entity formatted" string. 56 | "certain ascii characters" are defined as: 57 | - apostrophe (') or quote (") 58 | - characters with an xml entity mapping 59 | - non-printable ASCII characters 60 | - characters with the high-bit set 61 | */ 62 | string_t entity_escape(const string_t& value); 63 | 64 | /*! 65 | Returns whether or not a string has at least one entity in it that 66 | would be unescaped by entity_unescape; can be faster than 67 | unescape-and-compare, as it could return true before the entire 68 | string is scanned. 69 | */ 70 | bool needs_entity_unescape(const string_t& value); 71 | 72 | /*! 73 | Takes a string and converts the xml entity declarations found within to 74 | their ASCII equivalents, returning the "entity flattened" string. 75 | */ 76 | string_t entity_unescape(const string_t& value); 77 | 78 | /*************************************************************************************************/ 79 | 80 | } // namespace adobe 81 | 82 | /*************************************************************************************************/ 83 | // ADOBE_EXPRESSION_FILTER_HPP 84 | #endif 85 | 86 | /*************************************************************************************************/ 87 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/count.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_COUNT_HPP 10 | #define ADOBE_ALGORITHM_COUNT_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include 20 | 21 | /*************************************************************************************************/ 22 | 23 | namespace adobe { 24 | 25 | /*************************************************************************************************/ 26 | /*! 27 | \defgroup count count 28 | \ingroup non_mutating_algorithm 29 | 30 | \see 31 | - STL documentation for \ref stldoc_count 32 | - STL documentation for \ref stldoc_count_if 33 | */ 34 | /*************************************************************************************************/ 35 | /*! 36 | \ingroup count 37 | 38 | \brief count implementation 39 | */ 40 | template 41 | inline typename boost::range_difference::type count(InputRange& range, T& value) 42 | { 43 | return std::count(boost::begin(range), boost::end(range), value); 44 | } 45 | 46 | /*! 47 | \ingroup count 48 | 49 | \brief count implementation 50 | */ 51 | template 52 | inline typename boost::range_difference::type 53 | count(const InputRange& range, T& value) 54 | { 55 | return std::count(boost::begin(range), boost::end(range), value); 56 | } 57 | 58 | /*! 59 | \ingroup count 60 | 61 | \brief count implementation 62 | */ 63 | template 64 | inline typename std::iterator_traits::difference_type 65 | count_if(InputIterator first, InputIterator last, Predicate pred) 66 | { 67 | return std::count_if(first, last, boost::bind(pred, _1)); 68 | } 69 | 70 | /*! 71 | \ingroup count 72 | 73 | \brief count implementation 74 | */ 75 | template 76 | inline typename boost::range_difference::type 77 | count_if(InputRange& range, Predicate pred) 78 | { 79 | return adobe::count_if(boost::begin(range), boost::end(range), pred); 80 | } 81 | 82 | /*! 83 | \ingroup count 84 | 85 | \brief count implementation 86 | */ 87 | template 88 | inline typename boost::range_difference::type 89 | count_if(const InputRange& range, Predicate pred) 90 | { 91 | return adobe::count_if(boost::begin(range), boost::end(range), pred); 92 | } 93 | 94 | /*************************************************************************************************/ 95 | 96 | } // namespace adobe 97 | 98 | /*************************************************************************************************/ 99 | 100 | #endif 101 | 102 | /*************************************************************************************************/ 103 | -------------------------------------------------------------------------------- /code/poly/test_value_semantics_adaptation.cpp: -------------------------------------------------------------------------------- 1 | /* =============================================================================== */ 2 | /* Dynamic Generic Programming */ 3 | /* =============================================================================== */ 4 | /* Test project using Pyry Jahkola's Poly library (https://github.com/pyrtsa/poly) */ 5 | /* =============================================================================== */ 6 | /* Author: Andy Prowl */ 7 | /* =============================================================================== */ 8 | 9 | struct Point 10 | { 11 | Point(double x, double y) : x{x}, y{y} { } 12 | friend bool operator == (Point const& lhs, Point const& rhs) 13 | { return (lhs.x == rhs.x) && (lhs.y == rhs.y); } 14 | double x = 0; 15 | double y = 0; 16 | }; 17 | 18 | /* =============================================================================== */ 19 | /* NOTICE: Circle has functions called compute_area() and compute_perimeter() */ 20 | /* rather than get_area() and get_perimeter() */ 21 | /* =============================================================================== */ 22 | struct Circle 23 | { 24 | Circle(Point const& center, double radius) 25 | : _center{center}, _radius{radius} { } 26 | double compute_area() const { return _radius * _radius * 3.14159; } 27 | double compute_perimeter() const { return _radius * 2 * 3.14159; } 28 | private: 29 | Point _center; 30 | double _radius; 31 | }; 32 | 33 | struct Rectangle 34 | { 35 | Rectangle(Point const& center, double width, double height) 36 | : _center{center}, _width{width}, _height{height} { } 37 | double get_area() const { return _width * _height; } 38 | double get_perimeter() const { return (_width + _height) * 2; } 39 | private: 40 | Point _center; 41 | double _width; 42 | double _height; 43 | }; 44 | 45 | #include 46 | 47 | POLY_CALLABLE(get_area); 48 | POLY_CALLABLE(get_perimeter); 49 | 50 | using Shape = poly::interface< 51 | double(get_area_, poly::self const&), 52 | double(get_perimeter_, poly::self const&)>; 53 | 54 | template 55 | double call(get_area_, T const &x) 56 | { 57 | return x.get_area(); 58 | } 59 | 60 | double call(get_area_, Circle const &x) 61 | { 62 | return x.compute_area(); 63 | } 64 | 65 | template 66 | double call(get_perimeter_, T const &x) 67 | { 68 | return x.get_perimeter(); 69 | } 70 | 71 | double call(get_perimeter_, Circle const &x) 72 | { 73 | return x.compute_perimeter(); 74 | } 75 | 76 | #include 77 | #include 78 | #include 79 | 80 | void print_areas(std::vector const& v) 81 | { 82 | for (auto const& s : v) 83 | { 84 | std::cout << "Area: " << get_area(s) << std::endl; 85 | } 86 | } 87 | 88 | void working_example() 89 | { 90 | auto r = Rectangle{{1.0, 2.0}, 5.0, 6.0}; 91 | 92 | auto c = Circle{{0.0, 0.0}, 42.0}; 93 | 94 | std::vector v{r, c}; 95 | 96 | print_areas(v); 97 | } 98 | 99 | int main() 100 | { 101 | working_example(); 102 | } 103 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/counter.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /******************************************************************************/ 8 | 9 | #ifndef ADOBE_COUNTER_HPP 10 | #define ADOBE_COUNTER_HPP 11 | 12 | /******************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | 20 | /******************************************************************************/ 21 | 22 | namespace adobe { 23 | 24 | /******************************************************************************/ 25 | 26 | /*! 27 | \defgroup asl_counter Thread-safe counter 28 | \ingroup thread 29 | 30 | \class adobe::counter_t 31 | \ingroup asl_counter 32 | 33 | \brief A thread safe counter 34 | 35 | A counter_t is a noncopyable thread safe counter, useful for managing the reference count of a shared resource. 36 | 37 | \par Rationale: 38 | 39 | counter_t wraps reference count operations that require thread safety into a single class. While this does not guarantee client code will be thread safe, it helps to take a step in that direction. It also cleans up client code and keeps thread-handling scoped to a single file. Consider copy_on_write as an example class that leverages counter_t. 40 | 41 | \note 42 | The counter_t class is thread safe when compiled with BOOST_HAS_THREADS defined. 43 | */ 44 | 45 | /*! 46 | \fn adobe::counter_t::counter_t() 47 | 48 | Default constructor. The counter is initialized to 1. 49 | */ 50 | 51 | /*! 52 | \fn void adobe::counter_t::increment() 53 | 54 | Increments the counter by one. 55 | */ 56 | 57 | /*! 58 | \fn bool adobe::counter_t::decrement() 59 | 60 | Decrements the counter by one. 61 | 62 | \return true if the counter is zero at the end of this operation; false otherwise. 63 | */ 64 | 65 | /*! 66 | \fn bool adobe::counter_t::is_one() const 67 | 68 | Checks to see if the counter is one. 69 | 70 | \return true if the counter is one; false otherwise. 71 | */ 72 | 73 | 74 | class counter_t 75 | #if !defined(ADOBE_NO_DOCUMENTATION) 76 | : boost::noncopyable 77 | #endif 78 | { 79 | public: 80 | counter_t() 81 | { 82 | count_m = implementation::atomic_t::value_type(1); 83 | } 84 | 85 | void increment() 86 | { 87 | ++count_m; 88 | } 89 | 90 | bool decrement() 91 | { 92 | return --count_m == implementation::atomic_t::value_type(0); 93 | } 94 | 95 | bool is_one() const 96 | { 97 | return count_m == implementation::atomic_t::value_type(1); 98 | } 99 | 100 | private: 101 | implementation::atomic_t::type count_m; 102 | }; 103 | 104 | /******************************************************************************/ 105 | 106 | } // namespace adobe 107 | 108 | /******************************************************************************/ 109 | // ADOBE_COUNTER_HPP 110 | #endif 111 | 112 | /******************************************************************************/ 113 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/name_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_NAME_FWD_HPP 10 | #define ADOBE_NAME_FWD_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | #include 24 | 25 | #if defined(ADOBE_STD_SERIALIZATION) 26 | #include 27 | #endif 28 | 29 | /*************************************************************************************************/ 30 | 31 | namespace adobe { 32 | 33 | namespace version_1 { 34 | 35 | class name_t; 36 | 37 | inline bool operator < (const name_t& x, const name_t& y); 38 | inline bool operator == (const name_t& x, const name_t& y); 39 | 40 | /*************************************************************************************************/ 41 | 42 | class name_t : boost::totally_ordered 43 | { 44 | private: 45 | operator int () const; 46 | public: 47 | 48 | explicit name_t (const char* string_name = ""); 49 | 50 | const char* c_str() const; 51 | 52 | #if !defined(ADOBE_NO_DOCUMENTATION) 53 | operator bool() const; 54 | bool operator!() const; 55 | 56 | friend void swap(name_t& x, name_t& y) { std::swap(x.name_m, y.name_m); } 57 | #endif 58 | 59 | private: 60 | friend class static_name_t; 61 | friend struct aggregate_name_t; 62 | 63 | struct dont_copy_t { }; 64 | struct dont_initialize_t { }; 65 | 66 | name_t(const char* x, dont_copy_t); 67 | 68 | name_t (dont_initialize_t) { } 69 | 70 | const char* name_m; 71 | }; 72 | 73 | /*************************************************************************************************/ 74 | 75 | class static_name_t; 76 | struct aggregate_name_t; 77 | 78 | /*************************************************************************************************/ 79 | 80 | #if defined(ADOBE_STD_SERIALIZATION) 81 | std::ostream& operator << (std::ostream& os, const name_t& t); 82 | #endif 83 | 84 | /*************************************************************************************************/ 85 | 86 | } // namespace version_1 87 | 88 | using version_1::name_t; 89 | using version_1::static_name_t; 90 | using version_1::aggregate_name_t; 91 | 92 | } // namespace adobe 93 | 94 | /*************************************************************************************************/ 95 | 96 | namespace boost { 97 | 98 | template <> struct is_pod : boost::mpl::true_ { }; 99 | // implies has_nothrow_constructor and has_nothrow_copy 100 | 101 | } 102 | 103 | /*************************************************************************************************/ 104 | 105 | #endif // ADOBE_NAME_FWD_HPP 106 | 107 | /*************************************************************************************************/ 108 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/iomanip_asl_cel.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifdef ADOBE_STD_SERIALIZATION 10 | 11 | /*************************************************************************************************/ 12 | 13 | #ifndef ADOBE_IOMANIP_ASL_CEL_HPP 14 | #define ADOBE_IOMANIP_ASL_CEL_HPP 15 | 16 | /*************************************************************************************************/ 17 | 18 | #include 19 | 20 | #include 21 | 22 | /*************************************************************************************************/ 23 | 24 | namespace adobe { 25 | 26 | /*************************************************************************************************/ 27 | 28 | //!\ingroup manipulator 29 | class asl_cel_format : public format_base 30 | { 31 | typedef format_base inherited_t; 32 | 33 | public: 34 | typedef inherited_t::stream_type stream_type; 35 | 36 | explicit asl_cel_format(bool safe_strings) : 37 | escape_m(safe_strings) 38 | { } 39 | 40 | virtual void begin_format(stream_type& os); 41 | 42 | virtual void begin_bag(stream_type& os, const std::string& ident); 43 | 44 | virtual void begin_sequence(stream_type& os); 45 | 46 | virtual void begin_atom(stream_type& os, const any_regular_t&); 47 | 48 | private: 49 | virtual void stack_event(stream_type& os, bool is_push); 50 | 51 | void handle_atom(stream_type& os, bool is_push); 52 | 53 | bool escape_m; 54 | }; 55 | 56 | /*************************************************************************************************/ 57 | 58 | //!\ingroup manipulator 59 | inline std::ostream& begin_asl_cel(std::ostream& os) 60 | { 61 | replace_pword(os, format_base_idx(), true); 62 | return os << begin_format; 63 | } 64 | 65 | /*************************************************************************************************/ 66 | 67 | //!\ingroup manipulator 68 | inline std::ostream& end_asl_cel(std::ostream& os) 69 | { return os << end_format; } 70 | 71 | /*************************************************************************************************/ 72 | 73 | //!\ingroup manipulator 74 | inline std::ostream& begin_asl_cel_unsafe(std::ostream& os) 75 | { 76 | replace_pword(os, format_base_idx(), false); 77 | return os << begin_format; 78 | } 79 | 80 | /*************************************************************************************************/ 81 | 82 | //!\ingroup manipulator 83 | inline std::ostream& end_asl_cel_unsafe(std::ostream& os) 84 | { return os << end_format; } 85 | 86 | /*************************************************************************************************/ 87 | 88 | } // namespace adobe 89 | 90 | /*************************************************************************************************/ 91 | 92 | #endif 93 | 94 | /*************************************************************************************************/ 95 | 96 | #endif 97 | 98 | /*************************************************************************************************/ 99 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/virtual_machine.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_VIRTUAL_MACHINE_HPP 10 | #define ADOBE_VIRTUAL_MACHINE_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | #define BOOST_FUNCTION_NO_DEPRECATED 18 | #include 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | #include 28 | 29 | /*************************************************************************************************/ 30 | 31 | namespace adobe { 32 | 33 | /*************************************************************************************************/ 34 | 35 | class virtual_machine_t 36 | { 37 | public: 38 | typedef array_t expression_t; 39 | 40 | typedef any_regular_t(variable_lookup_signature_t)(name_t); 41 | typedef any_regular_t(dictionary_function_lookup_signature_t)(name_t, const dictionary_t&); 42 | typedef any_regular_t(array_function_lookup_signature_t)(name_t, const array_t&); 43 | typedef any_regular_t(named_index_lookup_signature_t)(const adobe::any_regular_t&, adobe::name_t index); 44 | typedef any_regular_t(numeric_index_lookup_signature_t)(const adobe::any_regular_t&, std::size_t index); 45 | 46 | typedef boost::function variable_lookup_t; 47 | typedef boost::function dictionary_function_lookup_t; 48 | typedef boost::function array_function_lookup_t; 49 | typedef boost::function named_index_lookup_t; 50 | typedef boost::function numeric_index_lookup_t; 51 | 52 | #if !defined(ADOBE_NO_DOCUMENTATION) 53 | virtual_machine_t(); 54 | virtual_machine_t(const virtual_machine_t&); 55 | 56 | virtual_machine_t& operator = (const virtual_machine_t& rhs); 57 | 58 | ~virtual_machine_t(); 59 | #endif 60 | 61 | void evaluate(const expression_t& expression); 62 | #if 0 63 | void evaluate_named_arguments(const dictionary_t&); 64 | #endif 65 | 66 | const any_regular_t& back() const; 67 | any_regular_t& back(); 68 | void pop_back(); 69 | 70 | void set_variable_lookup(const variable_lookup_t&); 71 | void set_array_function_lookup(const array_function_lookup_t&); 72 | void set_dictionary_function_lookup(const dictionary_function_lookup_t&); 73 | void set_named_index_lookup(const named_index_lookup_t&); 74 | void set_numeric_index_lookup(const numeric_index_lookup_t&); 75 | 76 | class implementation_t; 77 | private: 78 | 79 | implementation_t* object_m; 80 | }; 81 | 82 | /*************************************************************************************************/ 83 | 84 | } // namespace adobe 85 | 86 | /*************************************************************************************************/ 87 | 88 | #endif 89 | 90 | /*************************************************************************************************/ 91 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/poly_copyable.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2006-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | 6 | Author(s): Mat Marcus 7 | */ 8 | 9 | /*************************************************************************************************/ 10 | 11 | #ifndef ADOBE_POLY_COPYABLE_HPP 12 | #define ADOBE_POLY_COPYABLE_HPP 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | 20 | /*************************************************************************************************/ 21 | 22 | namespace adobe { 23 | 24 | /*! 25 | \ingroup poly_related 26 | */ 27 | 28 | /*************************************************************************************************/ 29 | 30 | /*! 31 | \ingroup poly_related 32 | \brief Implementation of a trivial poly interface in terms of types modeling Copyable . 33 | Used in poly implementation. 34 | \sa copyable, poly_copyable_interface, optimized_storage_type 35 | */ 36 | 37 | template 38 | struct poly_copyable_instance : optimized_storage_type::type 39 | { 40 | typedef typename optimized_storage_type::type base_t; 41 | 42 | /*! 43 | Check that T models appropriate concept for C++ 2003 44 | */ 45 | BOOST_CLASS_REQUIRE(T, boost, CopyConstructibleConcept); 46 | 47 | /*! 48 | Construct from concrete copyable 49 | */ 50 | poly_copyable_instance(const T& x) : base_t(x) {} 51 | 52 | /*! 53 | Move constructor 54 | */ 55 | poly_copyable_instance(move_from x) 56 | : base_t(move_from(x.source)) {} 57 | 58 | }; 59 | 60 | /*************************************************************************************************/ 61 | 62 | /*! 63 | \ingroup poly_related 64 | \brief "Handle" class used in poly implementation. 65 | \sa poly_copyable_instance, poly_copyable_interface, poly_copyable_interface, poly_base 66 | */ 67 | 68 | struct copyable : poly_base 69 | { 70 | typedef poly_base base_t; 71 | 72 | /*! 73 | Construct from concrete copyable 74 | */ 75 | template 76 | explicit copyable(const T& s) 77 | : base_t(s) { } 78 | 79 | /*! 80 | Move constructor 81 | */ 82 | copyable(move_from x) 83 | : base_t(move_from(x.source)) {} 84 | }; 85 | 86 | 87 | /*************************************************************************************************/ 88 | 89 | #if !defined(ADOBE_NO_DOCUMENTATION) 90 | 91 | /*************************************************************************************************/ 92 | 93 | typedef poly poly_copyable_t; 94 | 95 | /*************************************************************************************************/ 96 | 97 | #endif 98 | 99 | /*************************************************************************************************/ 100 | 101 | } // namespace adobe 102 | 103 | /*************************************************************************************************/ 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/for_each_position.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_FOR_EACH_POSITION_HPP 10 | #define ADOBE_ALGORITHM_FOR_EACH_POSITION_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | /*************************************************************************************************/ 21 | 22 | namespace adobe { 23 | 24 | /*************************************************************************************************/ 25 | /*! 26 | \defgroup for_each_position for_each_position 27 | \ingroup non_mutating_algorithm 28 | 29 | \c for_each_position applies the function \c f to each iterator, as opposed to element, in the range 30 | [first, last); \c f's return value, if any, is ignored. Applications are performed in forward order, 31 | i.e. from first to last. 32 | 33 | \complexity 34 | Linear. Exactly last - first applications of \c f. 35 | */ 36 | /*************************************************************************************************/ 37 | #ifndef ADOBE_NO_DOCUMENTATION 38 | namespace implementation { 39 | 40 | /*************************************************************************************************/ 41 | 42 | template 43 | void for_each_position(InputIterator first, InputIterator last, UnaryFunction f) 44 | { 45 | while (first != last) 46 | { 47 | f(first); 48 | ++first; 49 | } 50 | } 51 | 52 | /*************************************************************************************************/ 53 | 54 | } // namespace implementation 55 | #endif 56 | /*************************************************************************************************/ 57 | /*! 58 | \ingroup for_each_position 59 | 60 | \brief for_each_position implementation 61 | */ 62 | template 63 | inline void for_each_position(InputIterator first, InputIterator last, UnaryFunction f) 64 | { 65 | adobe::implementation::for_each_position(first, last, boost::bind(f, _1)); 66 | } 67 | 68 | /*! 69 | \ingroup for_each_position 70 | 71 | \brief for_each_position implementation 72 | */ 73 | template 74 | inline void for_each_position(InputRange& range, UnaryFunction f) 75 | { 76 | adobe::for_each_position(boost::begin(range), boost::end(range), f); 77 | } 78 | 79 | /*! 80 | \ingroup for_each_position 81 | 82 | \brief for_each_position implementation 83 | */ 84 | template 85 | inline void for_each_position(const InputRange& range, UnaryFunction f) 86 | { 87 | adobe::for_each_position(boost::begin(range), boost::end(range), f); 88 | } 89 | 90 | /*************************************************************************************************/ 91 | 92 | } // namespace adobe 93 | 94 | /*************************************************************************************************/ 95 | 96 | #endif 97 | 98 | /*************************************************************************************************/ 99 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/pin.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | /*************************************************************************************************/ 7 | 8 | #ifndef ADOBE_ALGORITHM_PIN_HPP 9 | #define ADOBE_ALGORITHM_PIN_HPP 10 | 11 | #include 12 | 13 | #if ADOBE_IS_DEPRECATED_ERROR(100039) 14 | #error "deprecated adobe/algorithm/pin.hpp use adobe/algorithm/clamp.hpp instead." 15 | #endif 16 | 17 | #include 18 | 19 | /*************************************************************************************************/ 20 | 21 | namespace adobe { 22 | 23 | /*************************************************************************************************/ 24 | /*! 25 | \defgroup pin pin 26 | \ingroup non_mutating_algorithm 27 | 28 | \deprecated 29 | The \c pin() and \c pin_unsafe() functions have been deprecated in favor of \c clamp() and 30 | \c clamp_unordered(). Note that the parameter order is different. 31 | 32 | If x is outside the range (min, max) then the closest of either 33 | min or max is returned. If x is within the range 34 | specified then x is returned. 35 | 36 | \pre 37 | min <= max 38 | 39 | \post 40 | min <= result <= max 41 | 42 | pin_safe is similar to pin but should be used when you are not sure which bound is the minimum 43 | and which is the maximum. It is 'safe' in that, at the cost of an extra comparison, will assert 44 | the min and max bounds are placed where they should be when the actual pin is executed. 45 | */ 46 | /*************************************************************************************************/ 47 | /*! 48 | \ingroup pin 49 | 50 | \brief pin implementation 51 | */ 52 | template 53 | inline const T& pin(const T& min, const T& x, const T& max, R r) 54 | { return clamp(x, min, max, r); } 55 | 56 | /*************************************************************************************************/ 57 | /*! 58 | \ingroup pin 59 | 60 | \brief pin implementation 61 | */ 62 | template 63 | inline const T& pin(const T& min, const T& x, const T& max) 64 | { return clamp(x, min, max); } 65 | 66 | 67 | /****************************************************************************************************/ 68 | /*! 69 | \ingroup pin 70 | 71 | \brief pin_safe implementation 72 | */ 73 | template 74 | const T& pin_safe(const T& min, const T& x, const T& max, R r) 75 | { return clamp_unordered(x, min, max, r); } 76 | 77 | /****************************************************************************************************/ 78 | /*! 79 | \ingroup pin 80 | 81 | \brief pin_safe implementation 82 | */ 83 | template 84 | const T& pin_safe(const T& min, const T& x, const T& max) 85 | { return clamp_unordered(x, min, max); } 86 | 87 | /*************************************************************************************************/ 88 | 89 | } // namespace adobe 90 | 91 | /*************************************************************************************************/ 92 | 93 | #endif 94 | 95 | /*************************************************************************************************/ 96 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/algorithm/permutation.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ALGORITHM_PERMUTATION_HPP 10 | #define ADOBE_ALGORITHM_PERMUTATION_HPP 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | /*************************************************************************************************/ 21 | 22 | namespace adobe { 23 | 24 | /*************************************************************************************************/ 25 | /*! 26 | \defgroup permutation permutation 27 | \ingroup sorting 28 | 29 | \see 30 | - STL documentation for \ref stldoc_next_permutation 31 | - STL documentation for \ref stldoc_prev_permutation 32 | */ 33 | /*************************************************************************************************/ 34 | /*! 35 | \ingroup permutation 36 | 37 | \brief permutation implementation 38 | */ 39 | template 40 | inline bool next_permutation(BidirectionalRange& range) 41 | { 42 | return std::next_permutation(boost::begin(range), boost::end(range)); 43 | } 44 | 45 | /*! 46 | \ingroup permutation 47 | 48 | \brief permutation implementation 49 | */ 50 | template 51 | inline bool next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp) 52 | { 53 | return std::next_permutation(first, last, boost::bind(comp, _1, _2)); 54 | } 55 | 56 | /*! 57 | \ingroup permutation 58 | 59 | \brief permutation implementation 60 | */ 61 | template 62 | inline bool next_permutation(BidirectionalRange& range, Compare comp) 63 | { 64 | return adobe::next_permutation(boost::begin(range), boost::end(range), comp); 65 | } 66 | 67 | /*! 68 | \ingroup permutation 69 | 70 | \brief permutation implementation 71 | */ 72 | template 73 | inline bool prev_permutation(BidirectionalRange& range) 74 | { 75 | return std::prev_permutation(boost::begin(range), boost::end(range)); 76 | } 77 | 78 | /*! 79 | \ingroup permutation 80 | 81 | \brief permutation implementation 82 | */ 83 | template 84 | inline bool prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp) 85 | { 86 | return std::prev_permutation(first, last, boost::bind(comp, _1, _2)); 87 | } 88 | 89 | /*! 90 | \ingroup permutation 91 | 92 | \brief permutation implementation 93 | */ 94 | template 95 | inline bool prev_permutation(BidirectionalRange& range, Compare comp) 96 | { 97 | return adobe::prev_permutation(boost::begin(range), boost::end(range), comp); 98 | } 99 | 100 | /*************************************************************************************************/ 101 | 102 | } // namespace adobe 103 | 104 | /*************************************************************************************************/ 105 | 106 | #endif 107 | 108 | /*************************************************************************************************/ 109 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/conversion.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_CONVERSION_HPP 10 | #define ADOBE_CONVERSION_HPP 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | /*************************************************************************************************/ 18 | 19 | namespace adobe { 20 | 21 | /*************************************************************************************************/ 22 | 23 | template 24 | struct promote 25 | { 26 | typedef T type; 27 | }; 28 | 29 | template <> struct promote { typedef double type; }; 30 | template <> struct promote { typedef double type; }; 31 | template <> struct promote { typedef double type; }; 32 | 33 | template <> struct promote { typedef double type; }; 34 | template <> struct promote { typedef double type; }; 35 | template <> struct promote { typedef double type; }; 36 | 37 | template <> struct promote { typedef double type; }; 38 | 39 | // Under 64-bit Windows size_t and ptrdiff_t do not fall into the categories above, 40 | // and can cause bad cast failures in any_regular_t when one presumes it would, as 41 | // is the case in a 32-bit environment. By default, then, we emit an error when an 42 | // attempt is made to promote these types. You can turn off the error by defining 43 | // ADOBE_NO_MSVC64_PROMOTION_ERROR in your project. 44 | #if defined(BOOST_MSVC) && defined(_M_X64) && !defined(ADOBE_NO_MSVC64_PROMOTION_ERROR) 45 | template <> struct promote { }; 46 | template <> struct promote { }; 47 | #endif 48 | 49 | template <> struct promote { typedef version_1::string_t type; }; 50 | template <> struct promote { typedef version_1::string_t type; }; 51 | 52 | /*************************************************************************************************/ 53 | 54 | template 55 | inline lht explicit_cast(const rht& rhs) 56 | { return static_cast(rhs); } 57 | 58 | /*************************************************************************************************/ 59 | 60 | template 61 | struct runtime_cast_t { 62 | R operator()(T& x) const { return dynamic_cast(x); } 63 | }; 64 | 65 | template 66 | inline R runtime_cast(T& x) 67 | { return runtime_cast_t()(x); } 68 | 69 | template 70 | inline R runtime_cast(T* x) 71 | { return runtime_cast_t()(x); } 72 | 73 | template 74 | inline bool runtime_cast(const T& x, R& r) 75 | { 76 | const R* p = runtime_cast(&x); 77 | if (!p) return false; 78 | r = *p; 79 | return true; 80 | } 81 | 82 | /*************************************************************************************************/ 83 | 84 | template 85 | inline T& remove_const(const T& x) 86 | { return const_cast(x); } 87 | 88 | /*************************************************************************************************/ 89 | 90 | } // namespace adobe 91 | 92 | /*************************************************************************************************/ 93 | 94 | #endif 95 | 96 | /*************************************************************************************************/ 97 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/config.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2008 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_CONFIG_HPP 10 | #define ADOBE_CONFIG_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | /*************************************************************************************************/ 17 | 18 | /* 19 | Caution: 20 | This is the only ASL header that is guarenteed to change with every release. Including 21 | this header will cause a recompile every time a new ASL version is released. 22 | 23 | ADOBE_VERSION % 100 is the sub-minor version 24 | ADOBE_VERSION / 100 % 1000 is the minor version 25 | ADOBE_VERSION / 100000 is the major version 26 | */ 27 | 28 | #define ADOBE_VERSION_MAJOR 1 29 | #define ADOBE_VERSION_MINOR 0 30 | #define ADOBE_VERSION_SUBMINOR 43 31 | 32 | #define ADOBE_VERSION (ADOBE_VERSION_MAJOR * 100000 + ADOBE_VERSION_MINOR * 100 + ADOBE_VERSION_SUBMINOR) 33 | 34 | /*************************************************************************************************/ 35 | 36 | #define ADOBE_IS_DEPRECATED_ERROR(version) \ 37 | ((ADOBE_VERSION - version) > 0 || defined(ADOBE_NO_DEPRECATED)) 38 | 39 | /*************************************************************************************************/ 40 | 41 | // Big thanks to Boost here for doing a majority of the work for us. 42 | 43 | #if defined(__CYGWIN__) 44 | // Cygwin is not Win32 45 | #define ADOBE_PLATFORM_CYGWIN 1 46 | 47 | #elif defined(BOOST_WINDOWS) || defined(__MINGW32__) 48 | // Win32 49 | #define ADOBE_PLATFORM_WIN 1 50 | 51 | #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) 52 | // MacOS 53 | #define ADOBE_PLATFORM_MAC 1 54 | 55 | #elif defined(__BEOS__) 56 | // BeOS 57 | #define ADOBE_PLATFORM_BEOS 1 58 | 59 | #elif defined(__IBMCPP__) 60 | // IBM 61 | #define ADOBE_PLATFORM_AIX 1 62 | 63 | #elif defined(__amigaos__) 64 | // AmigaOS 65 | #define ADOBE_PLATFORM_AMIGA 1 66 | 67 | #elif defined(sun) || defined(__sun) 68 | // Solaris 69 | #define ADOBE_PLATFORM_SOLARIS 1 70 | 71 | #elif defined(__sgi) 72 | // SGI Irix 73 | #define ADOBE_PLATFORM_IRIX 1 74 | 75 | #elif defined(__hpux) 76 | // HP Unix 77 | #define ADOBE_PLATFORM_HPUX 1 78 | 79 | #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) 80 | // BSD 81 | #define ADOBE_PLATFORM_BSD 1 82 | 83 | #elif defined(linux) || defined(__linux) || defined(__linux__) 84 | // Linux 85 | #define ADOBE_PLATFORM_LINUX 1 86 | 87 | #elif defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) 88 | // Generic Unix 89 | #define ADOBE_PLATFORM_UNIX 1 90 | 91 | #else 92 | // Unknown 93 | #error "Unknown platform - please configure and report the results to stlab.adobe.com" 94 | 95 | #endif 96 | 97 | /*************************************************************************************************/ 98 | 99 | #include 100 | 101 | /*************************************************************************************************/ 102 | 103 | #endif 104 | 105 | /*************************************************************************************************/ 106 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/implementation/zuid_uuid.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated and others 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_ZUID_UUID_HPP 10 | #define ADOBE_ZUID_UUID_HPP 11 | 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | /*************************************************************************************************/ 19 | 20 | /* 21 | Relevant copyright information is provided below and may not be removed from this file. 22 | */ 23 | 24 | /*************************************************************************************************/ 25 | 26 | /* 27 | Copyright (c) 1990 - 1993, 1996 Open Software Foundation, Inc. 28 | Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & 29 | Digital Equipment Corporation, Maynard, Mass. 30 | Copyright (c) 1998 Microsoft. 31 | 32 | To anyone who acknowledges that this file is provided "AS IS" without any 33 | express or implied warranty: permission to use, copy, modify, and 34 | distribute this file for any purpose is hereby granted without fee, 35 | provided that the above copyright notices and this notice appears in all 36 | source code copies, and that none of the names of Open Software Foundation, 37 | Inc., Hewlett-Packard Company, or Digital Equipment Corporation be used in 38 | advertising or publicity pertaining to distribution of the software without 39 | specific, written prior permission. Neither Open Software Foundation, Inc., 40 | Hewlett-Packard Company, Microsoft, nor Digital Equipment Corporation makes 41 | any representations about the suitability of this software for any purpose. 42 | */ 43 | 44 | /*************************************************************************************************/ 45 | 46 | namespace adobe { 47 | 48 | /*************************************************************************************************/ 49 | 50 | 51 | //REVISIT(mmarcus) Boost 1.35.0 seems to pull in an MS system header 52 | //that #defines uuid_t. For now we #undef it here. 53 | 54 | #ifdef uuid_t 55 | #undef uuid_t 56 | #endif 57 | 58 | /* uuid_create -- generate a UUID */ 59 | boost::int16_t uuid_create(uuid_t * uuid); 60 | 61 | /* uuid_create_from_name -- create a UUID using a "name" from a "name space" */ 62 | void uuid_create_from_name( uuid_t* uuid, /* resulting UUID */ 63 | uuid_t nsid, /* UUID to serve as context, so identical 64 | names from different name spaces generate 65 | different UUIDs */ 66 | boost::uint8_t* name, /* the name from which to generate a UUID */ 67 | boost::uint16_t namelen); /* the length of the name */ 68 | 69 | /* 70 | uuid_compare -- Compare two UUID's "lexically" and return 71 | -1 u1 is lexically before u2 72 | 0 u1 is equal to u2 73 | 1 u1 is lexically after u2 74 | 75 | Note: lexical ordering is not temporal ordering! 76 | */ 77 | boost::int16_t uuid_compare(const uuid_t *u1, const uuid_t *u2); 78 | 79 | /*************************************************************************************************/ 80 | 81 | } // namespace adobe 82 | 83 | /*************************************************************************************************/ 84 | 85 | #endif 86 | 87 | /*************************************************************************************************/ 88 | -------------------------------------------------------------------------------- /code/adobe.poly/adobe/empty.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2005-2007 Adobe Systems Incorporated 3 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 4 | or a copy at http://stlab.adobe.com/licenses.html) 5 | */ 6 | 7 | /*************************************************************************************************/ 8 | 9 | #ifndef ADOBE_EMPTY_HPP 10 | #define ADOBE_EMPTY_HPP 11 | 12 | /*************************************************************************************************/ 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | #if defined(ADOBE_STD_SERIALIZATION) 26 | #include 27 | #endif 28 | 29 | /*************************************************************************************************/ 30 | 31 | namespace adobe { 32 | namespace version_1 { 33 | 34 | /*************************************************************************************************/ 35 | 36 | /*! 37 | \ingroup abi_misc 38 | 39 | \model_of 40 | - \ref concept_regular_type 41 | - \ref stldoc_LessThanComparable 42 | 43 | \brief An empty regular- and less-than-comparable- type. 44 | 45 | \rationale 46 | empty_t is useful for default values. For example, value_t() will construct a value_t containing an empty_t by default. 47 | */ 48 | 49 | struct empty_t : private boost::totally_ordered 50 | { 51 | friend inline bool operator == (const empty_t&, const empty_t&) { return true; } 52 | friend inline bool operator < (const empty_t&, const empty_t&) { return false; } 53 | friend inline void swap(empty_t&, empty_t&) { } 54 | }; 55 | 56 | #if defined(ADOBE_STD_SERIALIZATION) 57 | //!\ingroup abi_misc 58 | std::ostream& operator << (std::ostream& stream, const empty_t&); 59 | #endif 60 | 61 | /*************************************************************************************************/ 62 | 63 | } // namespace version_1 64 | 65 | using version_1::empty_t; 66 | 67 | /*************************************************************************************************/ 68 | 69 | /*! 70 | empty_base is used to provide a unique empty base class when base class chaining is used to 71 | reduce object size overhead such as with Boost operators in Boost 1.31.0 72 | */ 73 | 74 | //!\ingroup util_misc 75 | template 76 | struct empty_base { }; 77 | 78 | /*************************************************************************************************/ 79 | 80 | } // namespace adobe 81 | 82 | /*************************************************************************************************/ 83 | 84 | namespace boost { 85 | 86 | template <> struct is_pod : boost::mpl::true_ { }; 87 | template <> struct is_empty : boost::mpl::true_ { }; 88 | template <> struct has_trivial_constructor : boost::mpl::true_ { }; 89 | template <> struct has_trivial_destructor : boost::mpl::true_ { }; 90 | 91 | } 92 | 93 | /*************************************************************************************************/ 94 | 95 | ADOBE_NAME_TYPE_0("empty_t:version_1:adobe", adobe::version_1::empty_t) 96 | ADOBE_SHORT_NAME_TYPE('e','m','t','y', adobe::version_1::empty_t) 97 | 98 | /*************************************************************************************************/ 99 | 100 | #endif 101 | 102 | /*************************************************************************************************/ 103 | --------------------------------------------------------------------------------