1 | // (C) Copyright Jonathan Turkanis 2004 |
---|
2 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
---|
3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) |
---|
4 | |
---|
5 | // See http://www.boost.org/libs/iostreams for documentation. |
---|
6 | |
---|
7 | // Contains the definitions of several constants used by the test program. |
---|
8 | |
---|
9 | #ifndef BOOST_IOSTREAMS_TEST_CONSTANTS_HPP_INCLUDED |
---|
10 | #define BOOST_IOSTREAMS_TEST_CONSTANTS_HPP_INCLUDED |
---|
11 | |
---|
12 | #include <string.h> |
---|
13 | #include <boost/config.hpp> |
---|
14 | |
---|
15 | namespace boost { namespace iostreams { namespace test { |
---|
16 | |
---|
17 | // Note: openmode could be a class type, so this header must be included |
---|
18 | // by just one TU. |
---|
19 | const BOOST_IOS::openmode in_mode = BOOST_IOS::in | BOOST_IOS::binary; |
---|
20 | const BOOST_IOS::openmode out_mode = BOOST_IOS::out | BOOST_IOS::binary; |
---|
21 | |
---|
22 | // Chunk size for reading or writing in chunks. |
---|
23 | const int chunk_size = 59; |
---|
24 | |
---|
25 | // Chunk size for reading or writing in chunks. |
---|
26 | const int small_buffer_size = 23; |
---|
27 | |
---|
28 | // Number of times data is repeated in test files. |
---|
29 | const int data_reps = 300; |
---|
30 | |
---|
31 | namespace detail { |
---|
32 | |
---|
33 | // Returns string which is used to generate test files. |
---|
34 | inline const char* data(char*) |
---|
35 | { |
---|
36 | static const char* c = |
---|
37 | "!\"#$%&'()*+,-./0123456879:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
---|
38 | "[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\n"; |
---|
39 | return c; |
---|
40 | } |
---|
41 | |
---|
42 | // Returns string which is used to generate test files. |
---|
43 | inline const wchar_t* data(wchar_t*) |
---|
44 | { |
---|
45 | static const wchar_t* c = |
---|
46 | L"!\"#$%&'()*+,-./0123456879:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
---|
47 | L"[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\n"; |
---|
48 | return c; |
---|
49 | } |
---|
50 | |
---|
51 | } // End namespace detail. |
---|
52 | |
---|
53 | inline const char* narrow_data() { return detail::data((char*)0); } |
---|
54 | |
---|
55 | inline const wchar_t* wide_data() { return detail::data((wchar_t*)0); } |
---|
56 | |
---|
57 | // Length of string returned by data(). |
---|
58 | inline int data_length() |
---|
59 | { |
---|
60 | static int len = (int) strlen(narrow_data()); |
---|
61 | return len; |
---|
62 | } |
---|
63 | |
---|
64 | } } } // End namespaces detail, iostreams, boost. |
---|
65 | |
---|
66 | #endif // #ifndef BOOST_IOSTREAMS_TEST_CONSTANTS_HPP_INCLUDED |
---|