Endian: get ready to test on more compilers

git-svn-id: http://svn.boost.org/svn/boost/sandbox/endian@51856 b8fc166d-592f-0410-95f2-cb63ce0dd405
This commit is contained in:
bemandawes
2009-03-19 15:38:46 +00:00
parent 0f36e2670d
commit 40fa3beec4
4 changed files with 48 additions and 33 deletions

View File

@@ -281,19 +281,19 @@ usual operations on integers are supplied.</p>
namespace integer
{
namespace <a name="endianness">endianness</a> { enum enum_t { big, little, native }; } // simulate C++0x scoped enum
namespace <a name="alignment">alignment</a> { enum enum_t { unaligned, aligned }; } // simulate C++0x scoped enum
enum class <a name="endianness">endianness</a> { big, little, native }; // scoped enum emulated on C++03
enum class <a name="alignment">alignment</a> { unaligned, aligned }; // scoped enum emulated on C++03
template &lt;endianness::enum_t E, typename T, std::size_t n_bits,
alignment::enum_t A = alignment::unaligned&gt;
template &lt;endianness E, typename T, std::size_t n_bits,
alignment A = alignment::unaligned&gt;
class endian : <a href="../../../boost/integer/cover_operators.hpp">integer_cover_operators</a>&lt; endian&lt;E, T, n_bits, A&gt;, T &gt;
{
public:
typedef T value_type;
endian(){}
explicit endian(T v);
endian &amp; operator=(T v);
operator T() const;
<a href="#endian">endian</a>() = default; // = default replaced by {} on C++03
explicit <a href="#explicit-endian">endian</a>(T v);
endian &amp; <a href="#operator-eq">operator=</a>(T v);
<a href="#operator-T">operator T</a>() const;
};
// unaligned big endian signed integer types
@@ -385,29 +385,29 @@ usual operations on integers are supplied.</p>
} // namespace integer
} // namespace boost</pre>
<h3><a name="Members">Members</a></h3>
<p><code>endian(){}</code></p>
<p><code><a name="endian">endian</a>() = default;&nbsp; // C++03: endian(){}</code></p>
<blockquote>
<p><i>Effects:</i> Constructs an object of type <code>endian&lt;E, T, n_bits, A&gt;</code>.</p>
</blockquote>
<p><code>explicit endian(T v);</code></p>
<p><code><a name="explicit-endian">explicit endian</a>(T v);</code></p>
<blockquote>
<p><i>Effects:</i> Constructs an object of type <code>endian&lt;E, T, n_bits, A&gt;</code>.</p>
<p><i>Postcondition:</i> <code>x == v,</code> where <code>x</code> is the
constructed object.</p>
</blockquote>
<p><code>endian &amp; operator=(T v);</code></p>
<p><code>endian &amp; <a name="operator-eq">operator=</a>(T v);</code></p>
<blockquote>
<p><i>Postcondition:</i> <code>x == v,</code> where <code>x</code> is the
constructed object.</p>
<p><i>Returns:</i> <code>*this</code>.</p>
</blockquote>
<p><code>operator T() const;</code></p>
<p><code><a name="operator-T">operator T</a>() const;</code></p>
<blockquote>
<p><i>Returns:</i> The current value stored in <code>*this</code>, converted to
<code>value_type</code>.</p>
</blockquote>
<h3>Other operators</h3>
<p>All other operators on endian objects are forwarded to the equivalent
<p>Other operators on endian objects are forwarded to the equivalent
operator on <code>value_type</code>.</p>
<h2><a name="FAQ">FAQ</a></h2>
<p><b>Why bother with endian types?</b> External data portability and both speed

View File

@@ -2,15 +2,19 @@
# Copyright Beman Dawes 2006
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
# See library home page at http://www.boost.org/libs/endian
# See library home page at http://www.boost.org/libs/integer/doc/endian.html
import testing ;
test-suite "endian"
: [ run endian_test.cpp ]
# [ run endian_operations_test.cpp ]
# [ run endian_in_union_test.cpp ]
;
:
[ run binary_stream_test.cpp ]
[ run endian_binary_stream_test.cpp ]
[ run endian_test.cpp ]
[ run endian_operations_test.cpp ]
[ run endian_in_union_test.cpp ]
[ run scoped_enum_emulation_test.cpp ]
;

View File

@@ -1,8 +1,8 @@
set ENDIAN_LOCATE_ROOT=%temp%\endian-regr
set ENDIAN_LOCATE_ROOT=%TEMP%\endian-regr
md %ENDIAN_LOCATE_ROOT% 2>nul
echo Begin test processing...
bjam --dump-tests "-sALL_LOCATE_TARGET=%ENDIAN_LOCATE_ROOT%" %* >bjam.log 2>&1
bjam --dump-tests includes=/boost/trunk "-sALL_LOCATE_TARGET=%ENDIAN_LOCATE_ROOT%" %* >bjam.log 2>&1
echo Begin log processing...
process_jam_log %ENDIAN_LOCATE_ROOT% <bjam.log
start bjam.log

View File

@@ -2,26 +2,37 @@ echo create zip file...
if $%1 == $ goto error
rmdir /s \tmp\%1 2>nul
rmdir /s \temp\%1 2>nul
pushd .
mkdir \tmp\%1
cd \tmp\%1
mkdir \temp\%1
cd \temp\%1
md doc\html
md boost\integer
md libs\integer\doc
md libs\integer\example
md libs\integer\test
popd
copy ..\..\boost\integer\endian.hpp \tmp\%1\boost\integer
copy ..\..\boost\integer\cover_operators.hpp \tmp\%1\boost\integer
copy ..\..\libs\integer\doc\endian.html \tmp\%1\libs\integer\doc
copy ..\..\libs\integer\example\endian_example.cpp \tmp\%1\libs\integer\example
copy ..\..\libs\integer\test\endian_test.cpp \tmp\%1\libs\integer\test
copy ..\..\libs\integer\test\Jamfile.* \tmp\%1\libs\integer\test
copy ..\..\boost.png \temp\%1
copy ..\..\boost\doc\html\minimal.css \temp\%1\doc\html
copy ..\..\boost\binary_stream.hpp \temp\%1\boost
copy ..\..\boost\integer\endian.hpp \temp\%1\boost\integer
copy ..\..\boost\integer\endian_binary_stream.hpp \temp\%1\boost\integer
copy ..\..\boost\integer\cover_operators.hpp \temp\%1\boost\integer
copy ..\..\libs\integer\doc\endian.html \temp\%1\libs\integer\doc
copy ..\..\libs\integer\example\endian_example.cpp \temp\%1\libs\integer\example
copy ..\..\libs\integer\example\endian_hello_world.cpp \temp\%1\libs\integer\example
copy ..\..\libs\integer\test\endian_test.cpp \temp\%1\libs\integer\test
copy ..\..\libs\integer\test\binary_stream_test.cpp \temp\%1\libs\integer\test
copy ..\..\libs\integer\test\endian_binary_stream_test.cpp \temp\%1\libs\integer\test
copy ..\..\libs\integer\test\endian_in_union_test.cpp \temp\%1\libs\integer\test
copy ..\..\libs\integer\test\endian_operations_test.cpp \temp\%1\libs\integer\test
copy ..\..\libs\integer\test\scoped_enum_emulation_test.cpp \temp\%1\libs\integer\test
copy ..\..\libs\integer\test\Jamfile.* \temp\%1\libs\integer\test
pushd \tmp
pushd \temp
zip -r %1.zip %1
popd
move \tmp\%1.zip .
move \temp\%1.zip .
goto done