18974d36b49996aa59a926a53b830332890021e4cNicolas Catania/* -*- c++ -*- */ 28974d36b49996aa59a926a53b830332890021e4cNicolas Catania/* 38974d36b49996aa59a926a53b830332890021e4cNicolas Catania * Copyright (C) 2010 The Android Open Source Project 48974d36b49996aa59a926a53b830332890021e4cNicolas Catania * All rights reserved. 58974d36b49996aa59a926a53b830332890021e4cNicolas Catania * 68974d36b49996aa59a926a53b830332890021e4cNicolas Catania * Redistribution and use in source and binary forms, with or without 78974d36b49996aa59a926a53b830332890021e4cNicolas Catania * modification, are permitted provided that the following conditions 88974d36b49996aa59a926a53b830332890021e4cNicolas Catania * are met: 98974d36b49996aa59a926a53b830332890021e4cNicolas Catania * * Redistributions of source code must retain the above copyright 108974d36b49996aa59a926a53b830332890021e4cNicolas Catania * notice, this list of conditions and the following disclaimer. 118974d36b49996aa59a926a53b830332890021e4cNicolas Catania * * Redistributions in binary form must reproduce the above copyright 128974d36b49996aa59a926a53b830332890021e4cNicolas Catania * notice, this list of conditions and the following disclaimer in 138974d36b49996aa59a926a53b830332890021e4cNicolas Catania * the documentation and/or other materials provided with the 148974d36b49996aa59a926a53b830332890021e4cNicolas Catania * distribution. 158974d36b49996aa59a926a53b830332890021e4cNicolas Catania * 168974d36b49996aa59a926a53b830332890021e4cNicolas Catania * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 178974d36b49996aa59a926a53b830332890021e4cNicolas Catania * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 188974d36b49996aa59a926a53b830332890021e4cNicolas Catania * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 198974d36b49996aa59a926a53b830332890021e4cNicolas Catania * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 208974d36b49996aa59a926a53b830332890021e4cNicolas Catania * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 218974d36b49996aa59a926a53b830332890021e4cNicolas Catania * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 228974d36b49996aa59a926a53b830332890021e4cNicolas Catania * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 238974d36b49996aa59a926a53b830332890021e4cNicolas Catania * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 248974d36b49996aa59a926a53b830332890021e4cNicolas Catania * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 258974d36b49996aa59a926a53b830332890021e4cNicolas Catania * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 268974d36b49996aa59a926a53b830332890021e4cNicolas Catania * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 278974d36b49996aa59a926a53b830332890021e4cNicolas Catania * SUCH DAMAGE. 288974d36b49996aa59a926a53b830332890021e4cNicolas Catania */ 298974d36b49996aa59a926a53b830332890021e4cNicolas Catania 307c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania#ifndef ANDROID_ASTL_IOS_BASE_H__ 317c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania#define ANDROID_ASTL_IOS_BASE_H__ 328974d36b49996aa59a926a53b830332890021e4cNicolas Catania 338974d36b49996aa59a926a53b830332890021e4cNicolas Catania#include <ios_pos_types.h> 348974d36b49996aa59a926a53b830332890021e4cNicolas Catania 35f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catanianamespace android { 36f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania// Flags are used to put the stream is a certain state which affect 37f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania// how data is formatted. 38f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Cataniaenum IosBaseFlags { 39f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_boolalpha = 1 << 0, 40f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_dec = 1 << 1, 41f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_fixed = 1 << 2, 42f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_hex = 1 << 3, 43f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_internal = 1 << 4, 44f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_left = 1 << 5, 45f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_oct = 1 << 6, 46f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_right = 1 << 7, 47f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_scientific = 1 << 8, 48f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_showbase = 1 << 9, 49f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_showpoint = 1 << 10, 50f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_showpos = 1 << 11, 51f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_skipws = 1 << 12, 52f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_unitbuf = 1 << 13, 53f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_uppercase = 1 << 14, 54f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_adjustfield = ios_baseflags_left | ios_baseflags_right | ios_baseflags_internal, 55f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_basefield = ios_baseflags_dec | ios_baseflags_oct | ios_baseflags_hex, 56f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_floatfield = ios_baseflags_scientific | ios_baseflags_fixed, 57f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania ios_baseflags_end = 1 << 15 58f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania}; 59f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania 60f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania// Openmode 61f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Cataniaenum IosBaseOpenmode { 62f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania ios_baseopenmode_app = 1 << 0, 63f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania ios_baseopenmode_ate = 1 << 1, 64f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania ios_baseopenmode_binary = 1 << 2, 65f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania ios_baseopenmode_in = 1 << 3, 66f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania ios_baseopenmode_out = 1 << 4, 67f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania ios_baseopenmode_trunc = 1 << 5, 68f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania ios_baseopenmode_end = 1 << 6 69f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania}; 70f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania 71f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania} // namespace android 72f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania 738974d36b49996aa59a926a53b830332890021e4cNicolas Catanianamespace std { 748974d36b49996aa59a926a53b830332890021e4cNicolas Catania 758974d36b49996aa59a926a53b830332890021e4cNicolas Catania/** 768974d36b49996aa59a926a53b830332890021e4cNicolas Catania * Root of the streams inheritance. 778974d36b49996aa59a926a53b830332890021e4cNicolas Catania * The STL defines ios_base as a template with 2 params char types and 788974d36b49996aa59a926a53b830332890021e4cNicolas Catania * traits. We support only char and no traits. 797c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania * ios_base defines flags, types and fields to hold these values. 807c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania * ios_base is extended by basic_ios which wraps a streambuf and 817c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania * provides common methods for all streams. 827c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania * The only mode supported for the standards streams (cout, cerr, cin) 837c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania * is synced with stdio. 848974d36b49996aa59a926a53b830332890021e4cNicolas Catania */ 858974d36b49996aa59a926a53b830332890021e4cNicolas Catania 868974d36b49996aa59a926a53b830332890021e4cNicolas Cataniaclass ios_base 878974d36b49996aa59a926a53b830332890021e4cNicolas Catania{ 888974d36b49996aa59a926a53b830332890021e4cNicolas Catania public: 898974d36b49996aa59a926a53b830332890021e4cNicolas Catania typedef std::streampos streampos; 908974d36b49996aa59a926a53b830332890021e4cNicolas Catania typedef std::streamoff streamoff; 918974d36b49996aa59a926a53b830332890021e4cNicolas Catania 928974d36b49996aa59a926a53b830332890021e4cNicolas Catania 938974d36b49996aa59a926a53b830332890021e4cNicolas Catania protected: 948974d36b49996aa59a926a53b830332890021e4cNicolas Catania ios_base(); 958974d36b49996aa59a926a53b830332890021e4cNicolas Catania 968974d36b49996aa59a926a53b830332890021e4cNicolas Catania public: 978974d36b49996aa59a926a53b830332890021e4cNicolas Catania virtual ~ios_base(); 98f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania typedef int fmtflags; 99f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania typedef int iostate; 100f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania typedef int openmode; 101f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania typedef int seekdir; 102f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania 103f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania // FLAGS 104f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania 105f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // boolalpha: Insert and extract bool type in alphabetic format. 106f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // dec: Convert integer input or generates integer output in 107f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // decimal base. 108f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // fixed: Generate floating-point output in a fixed-point notation. 109f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // hex: Convert integer input or generates integer output in 110f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // hexadecimal base. 111f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // internal: Adds fill characters as the designated interanl point 112f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // in certain generated output, or identical to right 113f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // if no such point is designated. 114f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // left: Adds fill characters on the right (final positions) of 115f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // certain generated output. 116f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // oct: Convert integer input or generates integer output in octal 117f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // base. 118f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // right: Adds fill characters on the left (initial positions) of 119f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // certain generated output. 120f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // scientific: Generates floating point output in scientific notation. 121f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // showbase: Generates a prefix indicating the numeric base of generated 122f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // integer output. 123f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // showpoint: Generate a decimal point character unconditionally in 124f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // generated floating point output. 125f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // showpos: Generate a + sign in non-negative generated numeric output. 126f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // skipws: Skips leading white space before certain input operations. 127f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // unitbuf: Flushes output after each output operation. 128f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // uppercase: Replaces certain lowercase letters with their upppercase 129f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // equivalents in generated output. 130f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags boolalpha = android::ios_baseflags_boolalpha; 131f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags dec = android::ios_baseflags_dec; 132f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags fixed = android::ios_baseflags_fixed; 133f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags hex = android::ios_baseflags_hex; 134f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags internal = android::ios_baseflags_internal; 135f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags left = android::ios_baseflags_left; 136f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags oct = android::ios_baseflags_oct; 137f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags right = android::ios_baseflags_right; 138f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags scientific = android::ios_baseflags_scientific; 139f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags showbase = android::ios_baseflags_showbase; 140f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags showpoint = android::ios_baseflags_showpoint; 141f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags showpos = android::ios_baseflags_showpos; 142f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags skipws = android::ios_baseflags_skipws; 143f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags unitbuf = android::ios_baseflags_unitbuf; 144f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags uppercase = android::ios_baseflags_uppercase; 145f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania 146f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags adjustfield = android::ios_baseflags_adjustfield; 147f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags basefield = android::ios_baseflags_basefield; 148f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania static const fmtflags floatfield = android::ios_baseflags_floatfield; 149f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania 150f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // Set all the flags at once. 151f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // @return the previous value of the format flags 152f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania fmtflags flags(fmtflags flags); 153f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania 154f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // @return all the flags at once 155f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania fmtflags flags() const { return mFlags; } 156f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania 157f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // Set flags. 158f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // @return the previous value of the format flags 159f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania fmtflags setf(fmtflags flags); 160f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania 161f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // Clears 'mask' and set the 'flags' & 'mask'. 162f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // @return the previous value of the format flags 163f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania fmtflags setf(fmtflags flags, fmtflags mask); 164f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania 165f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // Clears 'mask'. 166f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania void unsetf(fmtflags mask); 1678974d36b49996aa59a926a53b830332890021e4cNicolas Catania 168f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania 169f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania // OPENMODE 170f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania 171f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania // app: seek to end before each write. 172f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania // ate: open and seek to end imediately after opening. 173f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania // binary: perform I/O in binary mode. 174f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania // in: open for input. 175f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania // out: open for output. 176f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania // trunc: truncate and existing stream when opening. 177f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania static const openmode app = android::ios_baseopenmode_app; 178f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania static const openmode ate = android::ios_baseopenmode_ate; 179f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania static const openmode binary = android::ios_baseopenmode_binary; 180f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania static const openmode in = android::ios_baseopenmode_in; 181f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania static const openmode out = android::ios_baseopenmode_out; 182f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania static const openmode trunc = android::ios_baseopenmode_trunc; 183f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania 184f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania // PRECISION and WIDTH 185f759b92d2877872c2f9300304d5aee0e41bd1306Nicolas Catania 1868974d36b49996aa59a926a53b830332890021e4cNicolas Catania /** 1878974d36b49996aa59a926a53b830332890021e4cNicolas Catania * @return The precision (number of digits after the decimal 1888974d36b49996aa59a926a53b830332890021e4cNicolas Catania * point) to generate on certain output conversions. 6 by default. 1898974d36b49996aa59a926a53b830332890021e4cNicolas Catania */ 1908974d36b49996aa59a926a53b830332890021e4cNicolas Catania streamsize precision() const { return mPrecision; } 1918974d36b49996aa59a926a53b830332890021e4cNicolas Catania 1928974d36b49996aa59a926a53b830332890021e4cNicolas Catania /** 1938974d36b49996aa59a926a53b830332890021e4cNicolas Catania * @param precision The new precision value. Values < 0 are ignored. 1948974d36b49996aa59a926a53b830332890021e4cNicolas Catania * @return The previous value of precision(). 0 by default; 1958974d36b49996aa59a926a53b830332890021e4cNicolas Catania */ 1968974d36b49996aa59a926a53b830332890021e4cNicolas Catania streamsize precision(streamsize precision); 1978974d36b49996aa59a926a53b830332890021e4cNicolas Catania 1988974d36b49996aa59a926a53b830332890021e4cNicolas Catania /** 1998974d36b49996aa59a926a53b830332890021e4cNicolas Catania * @return The minimum field width to generate on output 2008974d36b49996aa59a926a53b830332890021e4cNicolas Catania * operations. 2018974d36b49996aa59a926a53b830332890021e4cNicolas Catania */ 2028974d36b49996aa59a926a53b830332890021e4cNicolas Catania streamsize width() const { return mWidth; } 2038974d36b49996aa59a926a53b830332890021e4cNicolas Catania 2048974d36b49996aa59a926a53b830332890021e4cNicolas Catania /** 2058974d36b49996aa59a926a53b830332890021e4cNicolas Catania * @param width The new width value. Values < 0 are ignored. 2068974d36b49996aa59a926a53b830332890021e4cNicolas Catania * @return The previous value of width(). 2078974d36b49996aa59a926a53b830332890021e4cNicolas Catania */ 2088974d36b49996aa59a926a53b830332890021e4cNicolas Catania streamsize width(streamsize width); 2098974d36b49996aa59a926a53b830332890021e4cNicolas Catania 2107c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania // Helper class to initialize the standard streams. Its 211f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // construction ensures the initialization of the stdio streams 212f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // (cout, cerr,...) declared in iostream. These wrap the standard 213f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania // C streams declared in <cstdio>. 2147c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania // The destruction of the last instance of this class will flush 2157c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania // the streams. 2167c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania class Init { 2177c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania public: 2187c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania Init(); 2197c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania ~Init(); 2207c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania 2217c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania static bool done() { return sDone; } 2227c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania private: 2237c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania static int sGuard; 2247c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania static bool sDone; 2257c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania }; 2267c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania 2277c0a09a5022e5fb75b7a7dd6d68d4f811f6c462bNicolas Catania private: 228f1112427006f4fd9b72cb46acd46ddbbf1e7b741Nicolas Catania fmtflags mFlags; 2298974d36b49996aa59a926a53b830332890021e4cNicolas Catania streamsize mPrecision; 2308974d36b49996aa59a926a53b830332890021e4cNicolas Catania streamsize mWidth; 2318974d36b49996aa59a926a53b830332890021e4cNicolas Catania}; 2328974d36b49996aa59a926a53b830332890021e4cNicolas Catania 2338974d36b49996aa59a926a53b830332890021e4cNicolas Catania} // namespace std 2348974d36b49996aa59a926a53b830332890021e4cNicolas Catania 2358974d36b49996aa59a926a53b830332890021e4cNicolas Catania#endif 236