File: tempstream.yo

package info (click to toggle)
bobcat 6.02.02-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,960 kB
  • sloc: cpp: 18,954; fortran: 5,617; makefile: 2,787; sh: 659; perl: 401; ansic: 26
file content (76 lines) | stat: -rw-r--r-- 2,172 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
includefile(include/header)

COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::TempStream)(3bobcat)(_CurYrs_)(libbobcat-dev__CurVers_)
                    (Temporary fstream)

manpagename(FBB::TempStream)(Temporary fstream)

manpagesynopsis()
    bf(#include <bobcat/tempstream>)nl()

manpagedescription()
    bf(FBB::TempStream) objects are temporary tt(std::fstreams) opened with
mode 0600 (user only read+write). The file created by a tt(TempStream) object
is removed from the file system once the tt(TempStream) object goes out of
scope.

    A tt(TempStream) object creates an empty file, and information can
immediately be inserted into the tt(TempStream) object. To switch between
insertion and extraction simply call tt(seekg) (for extraction) or tt(seekp)
(for insertion).

includefile(include/namespace)

manpagesection(INHERITS FROM)
    bf(std::fstream)

manpagesection(CONSTRUCTORS)
    itemization(
    itb(TempStream(std::string const &base = "/tmp/FBB::TempStream"))
        The constructor initializes the object and creates a file with the
given base-name to which six random characters are appended. If the
tt(TempStream) could not be constructed an tt(FBB::Exception) is thrown.
    )

    Copy and move constructors (and assignment operators) are not available.

manpagesection(MEMBER FUNCTIONS)
     All bf(std::fstream) members are available, as bf(FBB::TempStream)
inherits from this class. In addition, tt(TempStream) itself offers
    itemization(
    itb(std::string const &fileName() const)
        The name of the created temporary file.
    )

manpagesection(EXAMPLE)
        verb(
    #include <iostream>
    #include <bobcat/tempstream>

    using namespace std;
    using namespace FBB;

    int main()
    {
        TempStream ts("/tmp/demo");

        ts << "Hello world\n";

        ts.seekg(0);
        string line;
        getline(ts, line);
        cout << line << ", removed: " << ts.fileName() << '\n';
    }
        )

manpagefiles()
    em(bobcat/tempstream) - defines the class interface

manpageseealso()
    bf(bobcat)(7), bf(mkostemp)(3)

manpagebugs()
    None reported.

includefile(include/trailer)