Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/iostreams/test/detail/constants.hpp @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

  • Property svn:executable set to *
File size: 2.0 KB
Line 
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
15namespace 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.
19const BOOST_IOS::openmode in_mode = BOOST_IOS::in | BOOST_IOS::binary;
20const BOOST_IOS::openmode out_mode = BOOST_IOS::out | BOOST_IOS::binary;
21
22// Chunk size for reading or writing in chunks.
23const int chunk_size = 59;       
24
25// Chunk size for reading or writing in chunks.
26const int small_buffer_size = 23;       
27
28// Number of times data is repeated in test files.
29const int data_reps = 300;
30
31namespace detail {
32
33// Returns string which is used to generate test files.
34inline 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.
43inline 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
53inline const char* narrow_data() { return detail::data((char*)0); }
54
55inline const wchar_t* wide_data() { return detail::data((wchar_t*)0); }
56
57// Length of string returned by data().
58inline 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
Note: See TracBrowser for help on using the repository browser.